xref: /openbmc/qemu/target/i386/tcg/access.h (revision ba379542)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Access guest memory in blocks. */
3 
4 #ifndef X86_TCG_ACCESS_H
5 #define X86_TCG_ACCESS_H
6 
7 /* An access covers at most sizeof(X86XSaveArea), at most 2 pages. */
8 typedef struct X86Access {
9     target_ulong vaddr;
10     void *haddr1;
11     void *haddr2;
12     uint16_t size;
13     uint16_t size1;
14     /*
15      * If we can't access the host page directly, we'll have to do I/O access
16      * via ld/st helpers. These are internal details, so we store the rest
17      * to do the access here instead of passing it around in the helpers.
18      */
19     int mmu_idx;
20     CPUX86State *env;
21     uintptr_t ra;
22 } X86Access;
23 
24 void access_prepare_mmu(X86Access *ret, CPUX86State *env,
25                         vaddr vaddr, unsigned size,
26                         MMUAccessType type, int mmu_idx, uintptr_t ra);
27 void access_prepare(X86Access *ret, CPUX86State *env, vaddr vaddr,
28                     unsigned size, MMUAccessType type, uintptr_t ra);
29 
30 uint8_t  access_ldb(X86Access *ac, vaddr addr);
31 uint16_t access_ldw(X86Access *ac, vaddr addr);
32 uint32_t access_ldl(X86Access *ac, vaddr addr);
33 uint64_t access_ldq(X86Access *ac, vaddr addr);
34 
35 void access_stb(X86Access *ac, vaddr addr, uint8_t val);
36 void access_stw(X86Access *ac, vaddr addr, uint16_t val);
37 void access_stl(X86Access *ac, vaddr addr, uint32_t val);
38 void access_stq(X86Access *ac, vaddr addr, uint64_t val);
39 
40 #endif
41