Merge branch 'upstream-merge'
[qemu-kvm.git] / softmmu_exec.h
blob8c73985599f8ba5371c245c4e69b474010c91cc6
1 /*
2 * Software MMU support
4 * Generate inline load/store functions for all MMU modes (typically
5 * at least _user and _kernel) as well as _data versions, for all data
6 * sizes.
8 * Used by target op helpers.
10 * MMU mode suffixes are defined in target cpu.h.
13 /* XXX: find something cleaner.
14 * Furthermore, this is false for 64 bits targets
16 #define ldul_user ldl_user
17 #define ldul_kernel ldl_kernel
18 #define ldul_hypv ldl_hypv
19 #define ldul_executive ldl_executive
20 #define ldul_supervisor ldl_supervisor
22 #include "softmmu_defs.h"
24 #define ACCESS_TYPE 0
25 #define MEMSUFFIX MMU_MODE0_SUFFIX
26 #define DATA_SIZE 1
27 #include "softmmu_header.h"
29 #define DATA_SIZE 2
30 #include "softmmu_header.h"
32 #define DATA_SIZE 4
33 #include "softmmu_header.h"
35 #define DATA_SIZE 8
36 #include "softmmu_header.h"
37 #undef ACCESS_TYPE
38 #undef MEMSUFFIX
40 #define ACCESS_TYPE 1
41 #define MEMSUFFIX MMU_MODE1_SUFFIX
42 #define DATA_SIZE 1
43 #include "softmmu_header.h"
45 #define DATA_SIZE 2
46 #include "softmmu_header.h"
48 #define DATA_SIZE 4
49 #include "softmmu_header.h"
51 #define DATA_SIZE 8
52 #include "softmmu_header.h"
53 #undef ACCESS_TYPE
54 #undef MEMSUFFIX
56 #if (NB_MMU_MODES >= 3)
58 #define ACCESS_TYPE 2
59 #define MEMSUFFIX MMU_MODE2_SUFFIX
60 #define DATA_SIZE 1
61 #include "softmmu_header.h"
63 #define DATA_SIZE 2
64 #include "softmmu_header.h"
66 #define DATA_SIZE 4
67 #include "softmmu_header.h"
69 #define DATA_SIZE 8
70 #include "softmmu_header.h"
71 #undef ACCESS_TYPE
72 #undef MEMSUFFIX
73 #endif /* (NB_MMU_MODES >= 3) */
75 #if (NB_MMU_MODES >= 4)
77 #define ACCESS_TYPE 3
78 #define MEMSUFFIX MMU_MODE3_SUFFIX
79 #define DATA_SIZE 1
80 #include "softmmu_header.h"
82 #define DATA_SIZE 2
83 #include "softmmu_header.h"
85 #define DATA_SIZE 4
86 #include "softmmu_header.h"
88 #define DATA_SIZE 8
89 #include "softmmu_header.h"
90 #undef ACCESS_TYPE
91 #undef MEMSUFFIX
92 #endif /* (NB_MMU_MODES >= 4) */
94 #if (NB_MMU_MODES >= 5)
96 #define ACCESS_TYPE 4
97 #define MEMSUFFIX MMU_MODE4_SUFFIX
98 #define DATA_SIZE 1
99 #include "softmmu_header.h"
101 #define DATA_SIZE 2
102 #include "softmmu_header.h"
104 #define DATA_SIZE 4
105 #include "softmmu_header.h"
107 #define DATA_SIZE 8
108 #include "softmmu_header.h"
109 #undef ACCESS_TYPE
110 #undef MEMSUFFIX
111 #endif /* (NB_MMU_MODES >= 5) */
113 #if (NB_MMU_MODES >= 6)
115 #define ACCESS_TYPE 5
116 #define MEMSUFFIX MMU_MODE5_SUFFIX
117 #define DATA_SIZE 1
118 #include "softmmu_header.h"
120 #define DATA_SIZE 2
121 #include "softmmu_header.h"
123 #define DATA_SIZE 4
124 #include "softmmu_header.h"
126 #define DATA_SIZE 8
127 #include "softmmu_header.h"
128 #undef ACCESS_TYPE
129 #undef MEMSUFFIX
130 #endif /* (NB_MMU_MODES >= 6) */
132 #if (NB_MMU_MODES > 6)
133 #error "NB_MMU_MODES > 6 is not supported for now"
134 #endif /* (NB_MMU_MODES > 6) */
136 /* these access are slower, they must be as rare as possible */
137 #define ACCESS_TYPE (NB_MMU_MODES)
138 #define MEMSUFFIX _data
139 #define DATA_SIZE 1
140 #include "softmmu_header.h"
142 #define DATA_SIZE 2
143 #include "softmmu_header.h"
145 #define DATA_SIZE 4
146 #include "softmmu_header.h"
148 #define DATA_SIZE 8
149 #include "softmmu_header.h"
150 #undef ACCESS_TYPE
151 #undef MEMSUFFIX
153 #define ldub(p) ldub_data(p)
154 #define ldsb(p) ldsb_data(p)
155 #define lduw(p) lduw_data(p)
156 #define ldsw(p) ldsw_data(p)
157 #define ldl(p) ldl_data(p)
158 #define ldq(p) ldq_data(p)
160 #define stb(p, v) stb_data(p, v)
161 #define stw(p, v) stw_data(p, v)
162 #define stl(p, v) stl_data(p, v)
163 #define stq(p, v) stq_data(p, v)