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