1/* 2 * Software MMU support 3 * 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. 7 * 8 * Used by target op helpers. 9 * 10 * MMU mode suffixes are defined in target cpu.h. 11 */ 12 13/* XXX: find something cleaner. 14 * Furthermore, this is false for 64 bits targets 15 */ 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 21 22#include "exec/softmmu_defs.h" 23 24#define ACCESS_TYPE 0 25#define MEMSUFFIX MMU_MODE0_SUFFIX 26#define DATA_SIZE 1 27#include "exec/softmmu_header.h" 28 29#define DATA_SIZE 2 30#include "exec/softmmu_header.h" 31 32#define DATA_SIZE 4 33#include "exec/softmmu_header.h" 34 35#define DATA_SIZE 8 36#include "exec/softmmu_header.h" 37#undef ACCESS_TYPE 38#undef MEMSUFFIX 39 40#define ACCESS_TYPE 1 41#define MEMSUFFIX MMU_MODE1_SUFFIX 42#define DATA_SIZE 1 43#include "exec/softmmu_header.h" 44 45#define DATA_SIZE 2 46#include "exec/softmmu_header.h" 47 48#define DATA_SIZE 4 49#include "exec/softmmu_header.h" 50 51#define DATA_SIZE 8 52#include "exec/softmmu_header.h" 53#undef ACCESS_TYPE 54#undef MEMSUFFIX 55 56#if (NB_MMU_MODES >= 3) 57 58#define ACCESS_TYPE 2 59#define MEMSUFFIX MMU_MODE2_SUFFIX 60#define DATA_SIZE 1 61#include "exec/softmmu_header.h" 62 63#define DATA_SIZE 2 64#include "exec/softmmu_header.h" 65 66#define DATA_SIZE 4 67#include "exec/softmmu_header.h" 68 69#define DATA_SIZE 8 70#include "exec/softmmu_header.h" 71#undef ACCESS_TYPE 72#undef MEMSUFFIX 73#endif /* (NB_MMU_MODES >= 3) */ 74 75#if (NB_MMU_MODES >= 4) 76 77#define ACCESS_TYPE 3 78#define MEMSUFFIX MMU_MODE3_SUFFIX 79#define DATA_SIZE 1 80#include "exec/softmmu_header.h" 81 82#define DATA_SIZE 2 83#include "exec/softmmu_header.h" 84 85#define DATA_SIZE 4 86#include "exec/softmmu_header.h" 87 88#define DATA_SIZE 8 89#include "exec/softmmu_header.h" 90#undef ACCESS_TYPE 91#undef MEMSUFFIX 92#endif /* (NB_MMU_MODES >= 4) */ 93 94#if (NB_MMU_MODES >= 5) 95 96#define ACCESS_TYPE 4 97#define MEMSUFFIX MMU_MODE4_SUFFIX 98#define DATA_SIZE 1 99#include "exec/softmmu_header.h" 100 101#define DATA_SIZE 2 102#include "exec/softmmu_header.h" 103 104#define DATA_SIZE 4 105#include "exec/softmmu_header.h" 106 107#define DATA_SIZE 8 108#include "exec/softmmu_header.h" 109#undef ACCESS_TYPE 110#undef MEMSUFFIX 111#endif /* (NB_MMU_MODES >= 5) */ 112 113#if (NB_MMU_MODES >= 6) 114 115#define ACCESS_TYPE 5 116#define MEMSUFFIX MMU_MODE5_SUFFIX 117#define DATA_SIZE 1 118#include "exec/softmmu_header.h" 119 120#define DATA_SIZE 2 121#include "exec/softmmu_header.h" 122 123#define DATA_SIZE 4 124#include "exec/softmmu_header.h" 125 126#define DATA_SIZE 8 127#include "exec/softmmu_header.h" 128#undef ACCESS_TYPE 129#undef MEMSUFFIX 130#endif /* (NB_MMU_MODES >= 6) */ 131 132#if (NB_MMU_MODES > 6) 133#error "NB_MMU_MODES > 6 is not supported for now" 134#endif /* (NB_MMU_MODES > 6) */ 135 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 "exec/softmmu_header.h" 141 142#define DATA_SIZE 2 143#include "exec/softmmu_header.h" 144 145#define DATA_SIZE 4 146#include "exec/softmmu_header.h" 147 148#define DATA_SIZE 8 149#include "exec/softmmu_header.h" 150#undef ACCESS_TYPE 151#undef MEMSUFFIX 152 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) 159 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) 164