diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-10-27 21:22:23 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-10-27 21:22:23 +0000 |
commit | 61382a500a9e54ef96ca28e0f221151f569cbb6e (patch) | |
tree | 453252700fc701b0e1be1d4832a8c2969a2b3ec2 /target-i386/exec.h | |
parent | 3a51dee658b9cc781acd57dd11bffbd1e402f93d (diff) |
full softmmu support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@410 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/exec.h')
-rw-r--r-- | target-i386/exec.h | 100 |
1 files changed, 81 insertions, 19 deletions
diff --git a/target-i386/exec.h b/target-i386/exec.h index b53928c98e..eb13186cf6 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -137,8 +137,10 @@ void helper_invlpg(unsigned int addr); void cpu_x86_update_cr0(CPUX86State *env); void cpu_x86_update_cr3(CPUX86State *env); void cpu_x86_flush_tlb(CPUX86State *env, uint32_t addr); -int cpu_x86_handle_mmu_fault(CPUX86State *env, uint32_t addr, int is_write); -void tlb_fill(unsigned long addr, int is_write, void *retaddr); +int cpu_x86_handle_mmu_fault(CPUX86State *env, uint32_t addr, + int is_write, int is_user, int is_softmmu); +void tlb_fill(unsigned long addr, int is_write, int is_user, + void *retaddr); void __hidden cpu_lock(void); void __hidden cpu_unlock(void); void do_interrupt(int intno, int is_int, int error_code, @@ -366,26 +368,30 @@ static inline void load_eflags(int eflags, int update_mask) (eflags & update_mask); } -/* memory access macros */ +/* XXX: move that to a generic header */ +#if !defined(CONFIG_USER_ONLY) -#define ldul ldl -#define lduq ldq #define ldul_user ldl_user #define ldul_kernel ldl_kernel -#define ldub_raw ldub -#define ldsb_raw ldsb -#define lduw_raw lduw -#define ldsw_raw ldsw -#define ldl_raw ldl -#define ldq_raw ldq +#define ACCESS_TYPE 0 +#define MEMSUFFIX _kernel +#define DATA_SIZE 1 +#include "softmmu_header.h" + +#define DATA_SIZE 2 +#include "softmmu_header.h" -#define stb_raw stb -#define stw_raw stw -#define stl_raw stl -#define stq_raw stq +#define DATA_SIZE 4 +#include "softmmu_header.h" + +#define DATA_SIZE 8 +#include "softmmu_header.h" +#undef ACCESS_TYPE +#undef MEMSUFFIX -#define MEMUSER 0 +#define ACCESS_TYPE 1 +#define MEMSUFFIX _user #define DATA_SIZE 1 #include "softmmu_header.h" @@ -397,9 +403,12 @@ static inline void load_eflags(int eflags, int update_mask) #define DATA_SIZE 8 #include "softmmu_header.h" +#undef ACCESS_TYPE +#undef MEMSUFFIX -#undef MEMUSER -#define MEMUSER 1 +/* these access are slower, they must be as rare as possible */ +#define ACCESS_TYPE 2 +#define MEMSUFFIX _data #define DATA_SIZE 1 #include "softmmu_header.h" @@ -411,6 +420,59 @@ static inline void load_eflags(int eflags, int update_mask) #define DATA_SIZE 8 #include "softmmu_header.h" +#undef ACCESS_TYPE +#undef MEMSUFFIX + +#define ldub(p) ldub_data(p) +#define ldsb(p) ldsb_data(p) +#define lduw(p) lduw_data(p) +#define ldsw(p) ldsw_data(p) +#define ldl(p) ldl_data(p) +#define ldq(p) ldq_data(p) + +#define stb(p, v) stb_data(p, v) +#define stw(p, v) stw_data(p, v) +#define stl(p, v) stl_data(p, v) +#define stq(p, v) stq_data(p, v) + +static inline double ldfq(void *ptr) +{ + union { + double d; + uint64_t i; + } u; + u.i = ldq(ptr); + return u.d; +} + +static inline void stfq(void *ptr, double v) +{ + union { + double d; + uint64_t i; + } u; + u.d = v; + stq(ptr, u.i); +} -#undef MEMUSER +static inline float ldfl(void *ptr) +{ + union { + float f; + uint32_t i; + } u; + u.i = ldl(ptr); + return u.f; +} + +static inline void stfl(void *ptr, float v) +{ + union { + float f; + uint32_t i; + } u; + u.f = v; + stl(ptr, u.i); +} +#endif /* !defined(CONFIG_USER_ONLY) */ |