Commit e777e89c4be2b80b37043e72fe6158da5ea4bf6c
1 parent
82642adc
Win64 host port
- Change long/unsigned long to intptr_t/uintptr_t where needed - Use PRIuPTR instead of %zu for printf - Rework parsing of UUIDs - Add support for Win64 ABI to TCG
Showing
52 changed files
with
234 additions
and
200 deletions
arm-semi.c
audio/audio.c
| @@ -192,7 +192,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) | @@ -192,7 +192,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) | ||
| 192 | if (audio_bug ("audio_calloc", cond)) { | 192 | if (audio_bug ("audio_calloc", cond)) { |
| 193 | AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", | 193 | AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", |
| 194 | funcname); | 194 | funcname); |
| 195 | - AUD_log (NULL, "nmemb=%d size=%zu (len=%zu)\n", nmemb, size, len); | 195 | + AUD_log (NULL, "nmemb=%d size=%" PRIuPTR " (len=%" PRIuPTR ")\n", |
| 196 | + nmemb, size, len); | ||
| 196 | return NULL; | 197 | return NULL; |
| 197 | } | 198 | } |
| 198 | 199 | ||
| @@ -804,8 +805,8 @@ static int audio_attach_capture (HWVoiceOut *hw) | @@ -804,8 +805,8 @@ static int audio_attach_capture (HWVoiceOut *hw) | ||
| 804 | 805 | ||
| 805 | sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); | 806 | sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); |
| 806 | if (!sc) { | 807 | if (!sc) { |
| 807 | - dolog ("Could not allocate soft capture voice (%zu bytes)\n", | ||
| 808 | - sizeof (*sc)); | 808 | + dolog ("Could not allocate soft capture voice (%" PRIuPTR |
| 809 | + " bytes)\n", sizeof (*sc)); | ||
| 809 | return -1; | 810 | return -1; |
| 810 | } | 811 | } |
| 811 | 812 | ||
| @@ -1830,8 +1831,8 @@ CaptureVoiceOut *AUD_add_capture ( | @@ -1830,8 +1831,8 @@ CaptureVoiceOut *AUD_add_capture ( | ||
| 1830 | 1831 | ||
| 1831 | cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); | 1832 | cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); |
| 1832 | if (!cb) { | 1833 | if (!cb) { |
| 1833 | - dolog ("Could not allocate capture callback information, size %zu\n", | ||
| 1834 | - sizeof (*cb)); | 1834 | + dolog ("Could not allocate capture callback information, size %" |
| 1835 | + PRIuPTR "\n", sizeof (*cb)); | ||
| 1835 | goto err0; | 1836 | goto err0; |
| 1836 | } | 1837 | } |
| 1837 | cb->ops = *ops; | 1838 | cb->ops = *ops; |
| @@ -1848,7 +1849,7 @@ CaptureVoiceOut *AUD_add_capture ( | @@ -1848,7 +1849,7 @@ CaptureVoiceOut *AUD_add_capture ( | ||
| 1848 | 1849 | ||
| 1849 | cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); | 1850 | cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); |
| 1850 | if (!cap) { | 1851 | if (!cap) { |
| 1851 | - dolog ("Could not allocate capture voice, size %zu\n", | 1852 | + dolog ("Could not allocate capture voice, size %" PRIuPTR "\n", |
| 1852 | sizeof (*cap)); | 1853 | sizeof (*cap)); |
| 1853 | goto err1; | 1854 | goto err1; |
| 1854 | } | 1855 | } |
audio/audio_template.h
| @@ -350,7 +350,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( | @@ -350,7 +350,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( | ||
| 350 | 350 | ||
| 351 | sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); | 351 | sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); |
| 352 | if (!sw) { | 352 | if (!sw) { |
| 353 | - dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", | 353 | + dolog ("Could not allocate soft voice `%s' (%" PRIuPTR " bytes)\n", |
| 354 | sw_name ? sw_name : "unknown", sizeof (*sw)); | 354 | sw_name ? sw_name : "unknown", sizeof (*sw)); |
| 355 | goto err1; | 355 | goto err1; |
| 356 | } | 356 | } |
audio/mixeng.c
| @@ -301,7 +301,8 @@ void *st_rate_start (int inrate, int outrate) | @@ -301,7 +301,8 @@ void *st_rate_start (int inrate, int outrate) | ||
| 301 | struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate)); | 301 | struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate)); |
| 302 | 302 | ||
| 303 | if (!rate) { | 303 | if (!rate) { |
| 304 | - dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate)); | 304 | + dolog ("Could not allocate resampler (%" PRIuPTR " bytes)\n", |
| 305 | + sizeof (*rate)); | ||
| 305 | return NULL; | 306 | return NULL; |
| 306 | } | 307 | } |
| 307 | 308 |
block/qcow2.c
| @@ -96,8 +96,8 @@ static int qcow_read_extensions(BlockDriverState *bs, uint64_t start_offset, | @@ -96,8 +96,8 @@ static int qcow_read_extensions(BlockDriverState *bs, uint64_t start_offset, | ||
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | if (bdrv_pread(s->hd, offset, &ext, sizeof(ext)) != sizeof(ext)) { | 98 | if (bdrv_pread(s->hd, offset, &ext, sizeof(ext)) != sizeof(ext)) { |
| 99 | - fprintf(stderr, "qcow_handle_extension: ERROR: pread fail from offset %llu\n", | ||
| 100 | - (unsigned long long)offset); | 99 | + fprintf(stderr, "qcow_handle_extension: ERROR: pread fail from" |
| 100 | + " offset %" PRIu64 "\n", offset); | ||
| 101 | return 1; | 101 | return 1; |
| 102 | } | 102 | } |
| 103 | be32_to_cpus(&ext.magic); | 103 | be32_to_cpus(&ext.magic); |
| @@ -113,7 +113,7 @@ static int qcow_read_extensions(BlockDriverState *bs, uint64_t start_offset, | @@ -113,7 +113,7 @@ static int qcow_read_extensions(BlockDriverState *bs, uint64_t start_offset, | ||
| 113 | case QCOW_EXT_MAGIC_BACKING_FORMAT: | 113 | case QCOW_EXT_MAGIC_BACKING_FORMAT: |
| 114 | if (ext.len >= sizeof(bs->backing_format)) { | 114 | if (ext.len >= sizeof(bs->backing_format)) { |
| 115 | fprintf(stderr, "ERROR: ext_backing_format: len=%u too large" | 115 | fprintf(stderr, "ERROR: ext_backing_format: len=%u too large" |
| 116 | - " (>=%zu)\n", | 116 | + " (>=%" PRIuPTR ")\n", |
| 117 | ext.len, sizeof(bs->backing_format)); | 117 | ext.len, sizeof(bs->backing_format)); |
| 118 | return 2; | 118 | return 2; |
| 119 | } | 119 | } |
cache-utils.h
| @@ -12,11 +12,11 @@ extern struct qemu_cache_conf qemu_cache_conf; | @@ -12,11 +12,11 @@ extern struct qemu_cache_conf qemu_cache_conf; | ||
| 12 | extern void qemu_cache_utils_init(char **envp); | 12 | extern void qemu_cache_utils_init(char **envp); |
| 13 | 13 | ||
| 14 | /* mildly adjusted code from tcg-dyngen.c */ | 14 | /* mildly adjusted code from tcg-dyngen.c */ |
| 15 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 15 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 16 | { | 16 | { |
| 17 | - unsigned long p, start1, stop1; | ||
| 18 | - unsigned long dsize = qemu_cache_conf.dcache_bsize; | ||
| 19 | - unsigned long isize = qemu_cache_conf.icache_bsize; | 17 | + uintptr_t p, start1, stop1; |
| 18 | + uintptr_t dsize = qemu_cache_conf.dcache_bsize; | ||
| 19 | + uintptr_t isize = qemu_cache_conf.icache_bsize; | ||
| 20 | 20 | ||
| 21 | start1 = start & ~(dsize - 1); | 21 | start1 = start & ~(dsize - 1); |
| 22 | stop1 = (stop + dsize - 1) & ~(dsize - 1); | 22 | stop1 = (stop + dsize - 1) & ~(dsize - 1); |
cpu-all.h
| @@ -651,8 +651,8 @@ extern int have_guest_base; | @@ -651,8 +651,8 @@ extern int have_guest_base; | ||
| 651 | #else /* !CONFIG_USER_ONLY */ | 651 | #else /* !CONFIG_USER_ONLY */ |
| 652 | /* NOTE: we use double casts if pointers and target_ulong have | 652 | /* NOTE: we use double casts if pointers and target_ulong have |
| 653 | different sizes */ | 653 | different sizes */ |
| 654 | -#define saddr(x) (uint8_t *)(long)(x) | ||
| 655 | -#define laddr(x) (uint8_t *)(long)(x) | 654 | +#define saddr(x) (uint8_t *)(intptr_t)(x) |
| 655 | +#define laddr(x) (uint8_t *)(intptr_t)(x) | ||
| 656 | #endif | 656 | #endif |
| 657 | 657 | ||
| 658 | #define ldub_raw(p) ldub_p(laddr((p))) | 658 | #define ldub_raw(p) ldub_p(laddr((p))) |
cpu-defs.h
| @@ -141,8 +141,8 @@ typedef struct CPUWatchpoint { | @@ -141,8 +141,8 @@ typedef struct CPUWatchpoint { | ||
| 141 | /* in order to avoid passing too many arguments to the MMIO \ | 141 | /* in order to avoid passing too many arguments to the MMIO \ |
| 142 | helpers, we store some rarely used information in the CPU \ | 142 | helpers, we store some rarely used information in the CPU \ |
| 143 | context) */ \ | 143 | context) */ \ |
| 144 | - unsigned long mem_io_pc; /* host pc at which the memory was \ | ||
| 145 | - accessed */ \ | 144 | + uintptr_t mem_io_pc; /* host pc at which the memory was \ |
| 145 | + accessed */ \ | ||
| 146 | target_ulong mem_io_vaddr; /* target virtual addr at which the \ | 146 | target_ulong mem_io_vaddr; /* target virtual addr at which the \ |
| 147 | memory was accessed */ \ | 147 | memory was accessed */ \ |
| 148 | uint32_t halted; /* Nonzero if the CPU is in suspend state */ \ | 148 | uint32_t halted; /* Nonzero if the CPU is in suspend state */ \ |
cpu-exec.c
| @@ -94,7 +94,7 @@ void cpu_resume_from_signal(CPUState *env1, void *puc) | @@ -94,7 +94,7 @@ void cpu_resume_from_signal(CPUState *env1, void *puc) | ||
| 94 | could be used if available. */ | 94 | could be used if available. */ |
| 95 | static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) | 95 | static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) |
| 96 | { | 96 | { |
| 97 | - unsigned long next_tb; | 97 | + uintptr_t next_tb; |
| 98 | TranslationBlock *tb; | 98 | TranslationBlock *tb; |
| 99 | 99 | ||
| 100 | /* Should never happen. | 100 | /* Should never happen. |
| @@ -213,7 +213,7 @@ int cpu_exec(CPUState *env1) | @@ -213,7 +213,7 @@ int cpu_exec(CPUState *env1) | ||
| 213 | int ret, interrupt_request; | 213 | int ret, interrupt_request; |
| 214 | TranslationBlock *tb; | 214 | TranslationBlock *tb; |
| 215 | uint8_t *tc_ptr; | 215 | uint8_t *tc_ptr; |
| 216 | - unsigned long next_tb; | 216 | + uintptr_t next_tb; |
| 217 | 217 | ||
| 218 | if (cpu_halted(env1) == EXCP_HALTED) | 218 | if (cpu_halted(env1) == EXCP_HALTED) |
| 219 | return EXCP_HALTED; | 219 | return EXCP_HALTED; |
| @@ -608,8 +608,8 @@ int cpu_exec(CPUState *env1) | @@ -608,8 +608,8 @@ int cpu_exec(CPUState *env1) | ||
| 608 | tb_invalidated_flag = 0; | 608 | tb_invalidated_flag = 0; |
| 609 | } | 609 | } |
| 610 | #ifdef CONFIG_DEBUG_EXEC | 610 | #ifdef CONFIG_DEBUG_EXEC |
| 611 | - qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", | ||
| 612 | - (long)tb->tc_ptr, tb->pc, | 611 | + qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08Ix [" TARGET_FMT_lx "] %s\n", |
| 612 | + (intptr_t)tb->tc_ptr, tb->pc, | ||
| 613 | lookup_symbol(tb->pc)); | 613 | lookup_symbol(tb->pc)); |
| 614 | #endif | 614 | #endif |
| 615 | /* see if we can patch the calling TB. When the TB | 615 | /* see if we can patch the calling TB. When the TB |
| @@ -647,7 +647,7 @@ int cpu_exec(CPUState *env1) | @@ -647,7 +647,7 @@ int cpu_exec(CPUState *env1) | ||
| 647 | if ((next_tb & 3) == 2) { | 647 | if ((next_tb & 3) == 2) { |
| 648 | /* Instruction counter expired. */ | 648 | /* Instruction counter expired. */ |
| 649 | int insns_left; | 649 | int insns_left; |
| 650 | - tb = (TranslationBlock *)(long)(next_tb & ~3); | 650 | + tb = (TranslationBlock *)(intptr_t)(next_tb & ~3); |
| 651 | /* Restore PC. */ | 651 | /* Restore PC. */ |
| 652 | cpu_pc_from_tb(env, tb); | 652 | cpu_pc_from_tb(env, tb); |
| 653 | insns_left = env->icount_decr.u32; | 653 | insns_left = env->icount_decr.u32; |
disas.c
| @@ -235,7 +235,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags) | @@ -235,7 +235,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags) | ||
| 235 | /* Disassemble this for me please... (debugging). */ | 235 | /* Disassemble this for me please... (debugging). */ |
| 236 | void disas(FILE *out, void *code, unsigned long size) | 236 | void disas(FILE *out, void *code, unsigned long size) |
| 237 | { | 237 | { |
| 238 | - unsigned long pc; | 238 | + uintptr_t pc; |
| 239 | int count; | 239 | int count; |
| 240 | struct disassemble_info disasm_info; | 240 | struct disassemble_info disasm_info; |
| 241 | int (*print_insn)(bfd_vma pc, disassemble_info *info); | 241 | int (*print_insn)(bfd_vma pc, disassemble_info *info); |
| @@ -243,7 +243,7 @@ void disas(FILE *out, void *code, unsigned long size) | @@ -243,7 +243,7 @@ void disas(FILE *out, void *code, unsigned long size) | ||
| 243 | INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf); | 243 | INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf); |
| 244 | 244 | ||
| 245 | disasm_info.buffer = code; | 245 | disasm_info.buffer = code; |
| 246 | - disasm_info.buffer_vma = (unsigned long)code; | 246 | + disasm_info.buffer_vma = (uintptr_t)code; |
| 247 | disasm_info.buffer_length = size; | 247 | disasm_info.buffer_length = size; |
| 248 | 248 | ||
| 249 | #ifdef HOST_WORDS_BIGENDIAN | 249 | #ifdef HOST_WORDS_BIGENDIAN |
| @@ -283,8 +283,8 @@ void disas(FILE *out, void *code, unsigned long size) | @@ -283,8 +283,8 @@ void disas(FILE *out, void *code, unsigned long size) | ||
| 283 | (long) code); | 283 | (long) code); |
| 284 | return; | 284 | return; |
| 285 | #endif | 285 | #endif |
| 286 | - for (pc = (unsigned long)code; size > 0; pc += count, size -= count) { | ||
| 287 | - fprintf(out, "0x%08lx: ", pc); | 286 | + for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { |
| 287 | + fprintf(out, "0x%08Ix: ", pc); | ||
| 288 | #ifdef __arm__ | 288 | #ifdef __arm__ |
| 289 | /* since data is included in the code, it is better to | 289 | /* since data is included in the code, it is better to |
| 290 | display code data too */ | 290 | display code data too */ |
dyngen-exec.h
| @@ -94,13 +94,13 @@ extern int printf(const char *, ...); | @@ -94,13 +94,13 @@ extern int printf(const char *, ...); | ||
| 94 | /* The return address may point to the start of the next instruction. | 94 | /* The return address may point to the start of the next instruction. |
| 95 | Subtracting one gets us the call instruction itself. */ | 95 | Subtracting one gets us the call instruction itself. */ |
| 96 | #if defined(__s390__) | 96 | #if defined(__s390__) |
| 97 | -# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) | 97 | +# define GETPC() ((void*)(((uintptr_t)__builtin_return_address(0) & 0x7fffffffUL) - 1)) |
| 98 | #elif defined(__arm__) | 98 | #elif defined(__arm__) |
| 99 | /* Thumb return addresses have the low bit set, so we need to subtract two. | 99 | /* Thumb return addresses have the low bit set, so we need to subtract two. |
| 100 | This is still safe in ARM mode because instructions are 4 bytes. */ | 100 | This is still safe in ARM mode because instructions are 4 bytes. */ |
| 101 | -# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2)) | 101 | +# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 2)) |
| 102 | #else | 102 | #else |
| 103 | -# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) | 103 | +# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 1)) |
| 104 | #endif | 104 | #endif |
| 105 | 105 | ||
| 106 | #endif /* !defined(__DYNGEN_EXEC_H__) */ | 106 | #endif /* !defined(__DYNGEN_EXEC_H__) */ |
exec-all.h
| @@ -61,17 +61,17 @@ extern uint32_t gen_opc_hflags[OPC_BUF_SIZE]; | @@ -61,17 +61,17 @@ extern uint32_t gen_opc_hflags[OPC_BUF_SIZE]; | ||
| 61 | void gen_intermediate_code(CPUState *env, struct TranslationBlock *tb); | 61 | void gen_intermediate_code(CPUState *env, struct TranslationBlock *tb); |
| 62 | void gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb); | 62 | void gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb); |
| 63 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, | 63 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, |
| 64 | - unsigned long searched_pc, int pc_pos, void *puc); | 64 | + uintptr_t searched_pc, int pc_pos, void *puc); |
| 65 | 65 | ||
| 66 | -unsigned long code_gen_max_block_size(void); | 66 | +uintptr_t code_gen_max_block_size(void); |
| 67 | void cpu_gen_init(void); | 67 | void cpu_gen_init(void); |
| 68 | int cpu_gen_code(CPUState *env, struct TranslationBlock *tb, | 68 | int cpu_gen_code(CPUState *env, struct TranslationBlock *tb, |
| 69 | int *gen_code_size_ptr); | 69 | int *gen_code_size_ptr); |
| 70 | int cpu_restore_state(struct TranslationBlock *tb, | 70 | int cpu_restore_state(struct TranslationBlock *tb, |
| 71 | - CPUState *env, unsigned long searched_pc, | 71 | + CPUState *env, uintptr_t searched_pc, |
| 72 | void *puc); | 72 | void *puc); |
| 73 | int cpu_restore_state_copy(struct TranslationBlock *tb, | 73 | int cpu_restore_state_copy(struct TranslationBlock *tb, |
| 74 | - CPUState *env, unsigned long searched_pc, | 74 | + CPUState *env, uintptr_t searched_pc, |
| 75 | void *puc); | 75 | void *puc); |
| 76 | void cpu_resume_from_signal(CPUState *env1, void *puc); | 76 | void cpu_resume_from_signal(CPUState *env1, void *puc); |
| 77 | void cpu_io_recompile(CPUState *env, void *retaddr); | 77 | void cpu_io_recompile(CPUState *env, void *retaddr); |
| @@ -80,7 +80,7 @@ TranslationBlock *tb_gen_code(CPUState *env, | @@ -80,7 +80,7 @@ TranslationBlock *tb_gen_code(CPUState *env, | ||
| 80 | int cflags); | 80 | int cflags); |
| 81 | void cpu_exec_init(CPUState *env); | 81 | void cpu_exec_init(CPUState *env); |
| 82 | void QEMU_NORETURN cpu_loop_exit(void); | 82 | void QEMU_NORETURN cpu_loop_exit(void); |
| 83 | -int page_unprotect(target_ulong address, unsigned long pc, void *puc); | 83 | +int page_unprotect(target_ulong address, uintptr_t pc, void *puc); |
| 84 | void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t end, | 84 | void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t end, |
| 85 | int is_cpu_write_access); | 85 | int is_cpu_write_access); |
| 86 | void tb_invalidate_page_range(target_ulong start, target_ulong end); | 86 | void tb_invalidate_page_range(target_ulong start, target_ulong end); |
| @@ -142,7 +142,7 @@ struct TranslationBlock { | @@ -142,7 +142,7 @@ struct TranslationBlock { | ||
| 142 | #ifdef USE_DIRECT_JUMP | 142 | #ifdef USE_DIRECT_JUMP |
| 143 | uint16_t tb_jmp_offset[2]; /* offset of jump instruction */ | 143 | uint16_t tb_jmp_offset[2]; /* offset of jump instruction */ |
| 144 | #else | 144 | #else |
| 145 | - unsigned long tb_next[2]; /* address of jump generated code */ | 145 | + uintptr_t tb_next[2]; /* address of jump generated code */ |
| 146 | #endif | 146 | #endif |
| 147 | /* list of TBs jumping to this one. This is a circular list using | 147 | /* list of TBs jumping to this one. This is a circular list using |
| 148 | the two least significant bits of the pointers to tell what is | 148 | the two least significant bits of the pointers to tell what is |
| @@ -168,7 +168,7 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) | @@ -168,7 +168,7 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) | ||
| 168 | | (tmp & TB_JMP_ADDR_MASK)); | 168 | | (tmp & TB_JMP_ADDR_MASK)); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | -static inline unsigned int tb_phys_hash_func(unsigned long pc) | 171 | +static inline unsigned int tb_phys_hash_func(uintptr_t pc) |
| 172 | { | 172 | { |
| 173 | return pc & (CODE_GEN_PHYS_HASH_SIZE - 1); | 173 | return pc & (CODE_GEN_PHYS_HASH_SIZE - 1); |
| 174 | } | 174 | } |
| @@ -187,17 +187,17 @@ extern int code_gen_max_blocks; | @@ -187,17 +187,17 @@ extern int code_gen_max_blocks; | ||
| 187 | #if defined(USE_DIRECT_JUMP) | 187 | #if defined(USE_DIRECT_JUMP) |
| 188 | 188 | ||
| 189 | #if defined(_ARCH_PPC) | 189 | #if defined(_ARCH_PPC) |
| 190 | -extern void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr); | 190 | +extern void ppc_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr); |
| 191 | #define tb_set_jmp_target1 ppc_tb_set_jmp_target | 191 | #define tb_set_jmp_target1 ppc_tb_set_jmp_target |
| 192 | #elif defined(__i386__) || defined(__x86_64__) | 192 | #elif defined(__i386__) || defined(__x86_64__) |
| 193 | -static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr) | 193 | +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) |
| 194 | { | 194 | { |
| 195 | /* patch the branch destination */ | 195 | /* patch the branch destination */ |
| 196 | *(uint32_t *)jmp_addr = addr - (jmp_addr + 4); | 196 | *(uint32_t *)jmp_addr = addr - (jmp_addr + 4); |
| 197 | /* no need to flush icache explicitly */ | 197 | /* no need to flush icache explicitly */ |
| 198 | } | 198 | } |
| 199 | #elif defined(__arm__) | 199 | #elif defined(__arm__) |
| 200 | -static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr) | 200 | +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) |
| 201 | { | 201 | { |
| 202 | #if QEMU_GNUC_PREREQ(4, 1) | 202 | #if QEMU_GNUC_PREREQ(4, 1) |
| 203 | void __clear_cache(char *beg, char *end); | 203 | void __clear_cache(char *beg, char *end); |
| @@ -223,19 +223,19 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr | @@ -223,19 +223,19 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr | ||
| 223 | #endif | 223 | #endif |
| 224 | 224 | ||
| 225 | static inline void tb_set_jmp_target(TranslationBlock *tb, | 225 | static inline void tb_set_jmp_target(TranslationBlock *tb, |
| 226 | - int n, unsigned long addr) | 226 | + int n, uintptr_t addr) |
| 227 | { | 227 | { |
| 228 | - unsigned long offset; | 228 | + uintptr_t offset; |
| 229 | 229 | ||
| 230 | offset = tb->tb_jmp_offset[n]; | 230 | offset = tb->tb_jmp_offset[n]; |
| 231 | - tb_set_jmp_target1((unsigned long)(tb->tc_ptr + offset), addr); | 231 | + tb_set_jmp_target1((uintptr_t)(tb->tc_ptr + offset), addr); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | #else | 234 | #else |
| 235 | 235 | ||
| 236 | /* set the jump target */ | 236 | /* set the jump target */ |
| 237 | static inline void tb_set_jmp_target(TranslationBlock *tb, | 237 | static inline void tb_set_jmp_target(TranslationBlock *tb, |
| 238 | - int n, unsigned long addr) | 238 | + int n, uintptr_t addr) |
| 239 | { | 239 | { |
| 240 | tb->tb_next[n] = addr; | 240 | tb->tb_next[n] = addr; |
| 241 | } | 241 | } |
| @@ -248,15 +248,15 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, | @@ -248,15 +248,15 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, | ||
| 248 | /* NOTE: this test is only needed for thread safety */ | 248 | /* NOTE: this test is only needed for thread safety */ |
| 249 | if (!tb->jmp_next[n]) { | 249 | if (!tb->jmp_next[n]) { |
| 250 | /* patch the native jump address */ | 250 | /* patch the native jump address */ |
| 251 | - tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr); | 251 | + tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr); |
| 252 | 252 | ||
| 253 | /* add in TB jmp circular list */ | 253 | /* add in TB jmp circular list */ |
| 254 | tb->jmp_next[n] = tb_next->jmp_first; | 254 | tb->jmp_next[n] = tb_next->jmp_first; |
| 255 | - tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n)); | 255 | + tb_next->jmp_first = (TranslationBlock *)((uintptr_t)(tb) | (n)); |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | -TranslationBlock *tb_find_pc(unsigned long pc_ptr); | 259 | +TranslationBlock *tb_find_pc(uintptr_t pc_ptr); |
| 260 | 260 | ||
| 261 | extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; | 261 | extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; |
| 262 | extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; | 262 | extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; |
| @@ -325,7 +325,7 @@ static inline target_ulong get_phys_addr_code(CPUState *env1, target_ulong addr) | @@ -325,7 +325,7 @@ static inline target_ulong get_phys_addr_code(CPUState *env1, target_ulong addr) | ||
| 325 | cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x" TARGET_FMT_lx "\n", addr); | 325 | cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x" TARGET_FMT_lx "\n", addr); |
| 326 | #endif | 326 | #endif |
| 327 | } | 327 | } |
| 328 | - p = (void *)(unsigned long)addr | 328 | + p = (void *)(uintptr_t)addr |
| 329 | + env1->tlb_table[mmu_idx][page_index].addend; | 329 | + env1->tlb_table[mmu_idx][page_index].addend; |
| 330 | return qemu_ram_addr_from_host(p); | 330 | return qemu_ram_addr_from_host(p); |
| 331 | } | 331 | } |
exec.c
| @@ -706,8 +706,8 @@ static inline void tb_page_remove(TranslationBlock **ptb, TranslationBlock *tb) | @@ -706,8 +706,8 @@ static inline void tb_page_remove(TranslationBlock **ptb, TranslationBlock *tb) | ||
| 706 | 706 | ||
| 707 | for(;;) { | 707 | for(;;) { |
| 708 | tb1 = *ptb; | 708 | tb1 = *ptb; |
| 709 | - n1 = (long)tb1 & 3; | ||
| 710 | - tb1 = (TranslationBlock *)((long)tb1 & ~3); | 709 | + n1 = (intptr_t)tb1 & 3; |
| 710 | + tb1 = (TranslationBlock *)((intptr_t)tb1 & ~3); | ||
| 711 | if (tb1 == tb) { | 711 | if (tb1 == tb) { |
| 712 | *ptb = tb1->page_next[n1]; | 712 | *ptb = tb1->page_next[n1]; |
| 713 | break; | 713 | break; |
| @@ -727,8 +727,8 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) | @@ -727,8 +727,8 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) | ||
| 727 | /* find tb(n) in circular list */ | 727 | /* find tb(n) in circular list */ |
| 728 | for(;;) { | 728 | for(;;) { |
| 729 | tb1 = *ptb; | 729 | tb1 = *ptb; |
| 730 | - n1 = (long)tb1 & 3; | ||
| 731 | - tb1 = (TranslationBlock *)((long)tb1 & ~3); | 730 | + n1 = (intptr_t)tb1 & 3; |
| 731 | + tb1 = (TranslationBlock *)((intptr_t)tb1 & ~3); | ||
| 732 | if (n1 == n && tb1 == tb) | 732 | if (n1 == n && tb1 == tb) |
| 733 | break; | 733 | break; |
| 734 | if (n1 == 2) { | 734 | if (n1 == 2) { |
| @@ -748,7 +748,7 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) | @@ -748,7 +748,7 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) | ||
| 748 | another TB */ | 748 | another TB */ |
| 749 | static inline void tb_reset_jump(TranslationBlock *tb, int n) | 749 | static inline void tb_reset_jump(TranslationBlock *tb, int n) |
| 750 | { | 750 | { |
| 751 | - tb_set_jmp_target(tb, n, (unsigned long)(tb->tc_ptr + tb->tb_next_offset[n])); | 751 | + tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n])); |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | void tb_phys_invalidate(TranslationBlock *tb, target_ulong page_addr) | 754 | void tb_phys_invalidate(TranslationBlock *tb, target_ulong page_addr) |
| @@ -793,16 +793,16 @@ void tb_phys_invalidate(TranslationBlock *tb, target_ulong page_addr) | @@ -793,16 +793,16 @@ void tb_phys_invalidate(TranslationBlock *tb, target_ulong page_addr) | ||
| 793 | /* suppress any remaining jumps to this TB */ | 793 | /* suppress any remaining jumps to this TB */ |
| 794 | tb1 = tb->jmp_first; | 794 | tb1 = tb->jmp_first; |
| 795 | for(;;) { | 795 | for(;;) { |
| 796 | - n1 = (long)tb1 & 3; | 796 | + n1 = (intptr_t)tb1 & 3; |
| 797 | if (n1 == 2) | 797 | if (n1 == 2) |
| 798 | break; | 798 | break; |
| 799 | - tb1 = (TranslationBlock *)((long)tb1 & ~3); | 799 | + tb1 = (TranslationBlock *)((intptr_t)tb1 & ~3); |
| 800 | tb2 = tb1->jmp_next[n1]; | 800 | tb2 = tb1->jmp_next[n1]; |
| 801 | tb_reset_jump(tb1, n1); | 801 | tb_reset_jump(tb1, n1); |
| 802 | tb1->jmp_next[n1] = NULL; | 802 | tb1->jmp_next[n1] = NULL; |
| 803 | tb1 = tb2; | 803 | tb1 = tb2; |
| 804 | } | 804 | } |
| 805 | - tb->jmp_first = (TranslationBlock *)((long)tb | 2); /* fail safe */ | 805 | + tb->jmp_first = (TranslationBlock *)((intptr_t)tb | 2); /* fail safe */ |
| 806 | 806 | ||
| 807 | tb_phys_invalidate_count++; | 807 | tb_phys_invalidate_count++; |
| 808 | } | 808 | } |
| @@ -843,8 +843,8 @@ static void build_page_bitmap(PageDesc *p) | @@ -843,8 +843,8 @@ static void build_page_bitmap(PageDesc *p) | ||
| 843 | 843 | ||
| 844 | tb = p->first_tb; | 844 | tb = p->first_tb; |
| 845 | while (tb != NULL) { | 845 | while (tb != NULL) { |
| 846 | - n = (long)tb & 3; | ||
| 847 | - tb = (TranslationBlock *)((long)tb & ~3); | 846 | + n = (intptr_t)tb & 3; |
| 847 | + tb = (TranslationBlock *)((intptr_t)tb & ~3); | ||
| 848 | /* NOTE: this is subtle as a TB may span two physical pages */ | 848 | /* NOTE: this is subtle as a TB may span two physical pages */ |
| 849 | if (n == 0) { | 849 | if (n == 0) { |
| 850 | /* NOTE: tb_end may be after the end of the page, but | 850 | /* NOTE: tb_end may be after the end of the page, but |
| @@ -887,7 +887,7 @@ TranslationBlock *tb_gen_code(CPUState *env, | @@ -887,7 +887,7 @@ TranslationBlock *tb_gen_code(CPUState *env, | ||
| 887 | tb->flags = flags; | 887 | tb->flags = flags; |
| 888 | tb->cflags = cflags; | 888 | tb->cflags = cflags; |
| 889 | cpu_gen_code(env, tb, &code_gen_size); | 889 | cpu_gen_code(env, tb, &code_gen_size); |
| 890 | - code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); | 890 | + code_gen_ptr = (void *)(((uintptr_t)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); |
| 891 | 891 | ||
| 892 | /* check next page if needed */ | 892 | /* check next page if needed */ |
| 893 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; | 893 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; |
| @@ -935,8 +935,8 @@ void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t | @@ -935,8 +935,8 @@ void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t | ||
| 935 | /* XXX: see if in some cases it could be faster to invalidate all the code */ | 935 | /* XXX: see if in some cases it could be faster to invalidate all the code */ |
| 936 | tb = p->first_tb; | 936 | tb = p->first_tb; |
| 937 | while (tb != NULL) { | 937 | while (tb != NULL) { |
| 938 | - n = (long)tb & 3; | ||
| 939 | - tb = (TranslationBlock *)((long)tb & ~3); | 938 | + n = (intptr_t)tb & 3; |
| 939 | + tb = (TranslationBlock *)((intptr_t)tb & ~3); | ||
| 940 | tb_next = tb->page_next[n]; | 940 | tb_next = tb->page_next[n]; |
| 941 | /* NOTE: this is subtle as a TB may span two physical pages */ | 941 | /* NOTE: this is subtle as a TB may span two physical pages */ |
| 942 | if (n == 0) { | 942 | if (n == 0) { |
| @@ -1039,7 +1039,7 @@ static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, int le | @@ -1039,7 +1039,7 @@ static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, int le | ||
| 1039 | 1039 | ||
| 1040 | #if !defined(CONFIG_SOFTMMU) | 1040 | #if !defined(CONFIG_SOFTMMU) |
| 1041 | static void tb_invalidate_phys_page(target_phys_addr_t addr, | 1041 | static void tb_invalidate_phys_page(target_phys_addr_t addr, |
| 1042 | - unsigned long pc, void *puc) | 1042 | + uintptr_t pc, void *puc) |
| 1043 | { | 1043 | { |
| 1044 | TranslationBlock *tb; | 1044 | TranslationBlock *tb; |
| 1045 | PageDesc *p; | 1045 | PageDesc *p; |
| @@ -1064,8 +1064,8 @@ static void tb_invalidate_phys_page(target_phys_addr_t addr, | @@ -1064,8 +1064,8 @@ static void tb_invalidate_phys_page(target_phys_addr_t addr, | ||
| 1064 | } | 1064 | } |
| 1065 | #endif | 1065 | #endif |
| 1066 | while (tb != NULL) { | 1066 | while (tb != NULL) { |
| 1067 | - n = (long)tb & 3; | ||
| 1068 | - tb = (TranslationBlock *)((long)tb & ~3); | 1067 | + n = (intptr_t)tb & 3; |
| 1068 | + tb = (TranslationBlock *)((intptr_t)tb & ~3); | ||
| 1069 | #ifdef TARGET_HAS_PRECISE_SMC | 1069 | #ifdef TARGET_HAS_PRECISE_SMC |
| 1070 | if (current_tb == tb && | 1070 | if (current_tb == tb && |
| 1071 | (current_tb->cflags & CF_COUNT_MASK) != 1) { | 1071 | (current_tb->cflags & CF_COUNT_MASK) != 1) { |
| @@ -1109,7 +1109,7 @@ static inline void tb_alloc_page(TranslationBlock *tb, | @@ -1109,7 +1109,7 @@ static inline void tb_alloc_page(TranslationBlock *tb, | ||
| 1109 | p = page_find_alloc(page_addr >> TARGET_PAGE_BITS); | 1109 | p = page_find_alloc(page_addr >> TARGET_PAGE_BITS); |
| 1110 | tb->page_next[n] = p->first_tb; | 1110 | tb->page_next[n] = p->first_tb; |
| 1111 | last_first_tb = p->first_tb; | 1111 | last_first_tb = p->first_tb; |
| 1112 | - p->first_tb = (TranslationBlock *)((long)tb | n); | 1112 | + p->first_tb = (TranslationBlock *)((intptr_t)tb | n); |
| 1113 | invalidate_page_bitmap(p); | 1113 | invalidate_page_bitmap(p); |
| 1114 | 1114 | ||
| 1115 | #if defined(TARGET_HAS_SMC) || 1 | 1115 | #if defined(TARGET_HAS_SMC) || 1 |
| @@ -1203,7 +1203,7 @@ void tb_link_phys(TranslationBlock *tb, | @@ -1203,7 +1203,7 @@ void tb_link_phys(TranslationBlock *tb, | ||
| 1203 | else | 1203 | else |
| 1204 | tb->page_addr[1] = -1; | 1204 | tb->page_addr[1] = -1; |
| 1205 | 1205 | ||
| 1206 | - tb->jmp_first = (TranslationBlock *)((long)tb | 2); | 1206 | + tb->jmp_first = (TranslationBlock *)((intptr_t)tb | 2); |
| 1207 | tb->jmp_next[0] = NULL; | 1207 | tb->jmp_next[0] = NULL; |
| 1208 | tb->jmp_next[1] = NULL; | 1208 | tb->jmp_next[1] = NULL; |
| 1209 | 1209 | ||
| @@ -1221,16 +1221,16 @@ void tb_link_phys(TranslationBlock *tb, | @@ -1221,16 +1221,16 @@ void tb_link_phys(TranslationBlock *tb, | ||
| 1221 | 1221 | ||
| 1222 | /* find the TB 'tb' such that tb[0].tc_ptr <= tc_ptr < | 1222 | /* find the TB 'tb' such that tb[0].tc_ptr <= tc_ptr < |
| 1223 | tb[1].tc_ptr. Return NULL if not found */ | 1223 | tb[1].tc_ptr. Return NULL if not found */ |
| 1224 | -TranslationBlock *tb_find_pc(unsigned long tc_ptr) | 1224 | +TranslationBlock *tb_find_pc(uintptr_t tc_ptr) |
| 1225 | { | 1225 | { |
| 1226 | int m_min, m_max, m; | 1226 | int m_min, m_max, m; |
| 1227 | - unsigned long v; | 1227 | + uintptr_t v; |
| 1228 | TranslationBlock *tb; | 1228 | TranslationBlock *tb; |
| 1229 | 1229 | ||
| 1230 | if (nb_tbs <= 0) | 1230 | if (nb_tbs <= 0) |
| 1231 | return NULL; | 1231 | return NULL; |
| 1232 | - if (tc_ptr < (unsigned long)code_gen_buffer || | ||
| 1233 | - tc_ptr >= (unsigned long)code_gen_ptr) | 1232 | + if (tc_ptr < (uintptr_t)code_gen_buffer || |
| 1233 | + tc_ptr >= (uintptr_t)code_gen_ptr) | ||
| 1234 | return NULL; | 1234 | return NULL; |
| 1235 | /* binary search (cf Knuth) */ | 1235 | /* binary search (cf Knuth) */ |
| 1236 | m_min = 0; | 1236 | m_min = 0; |
| @@ -1238,7 +1238,7 @@ TranslationBlock *tb_find_pc(unsigned long tc_ptr) | @@ -1238,7 +1238,7 @@ TranslationBlock *tb_find_pc(unsigned long tc_ptr) | ||
| 1238 | while (m_min <= m_max) { | 1238 | while (m_min <= m_max) { |
| 1239 | m = (m_min + m_max) >> 1; | 1239 | m = (m_min + m_max) >> 1; |
| 1240 | tb = &tbs[m]; | 1240 | tb = &tbs[m]; |
| 1241 | - v = (unsigned long)tb->tc_ptr; | 1241 | + v = (uintptr_t)tb->tc_ptr; |
| 1242 | if (v == tc_ptr) | 1242 | if (v == tc_ptr) |
| 1243 | return tb; | 1243 | return tb; |
| 1244 | else if (tc_ptr < v) { | 1244 | else if (tc_ptr < v) { |
| @@ -1261,8 +1261,8 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | @@ -1261,8 +1261,8 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | ||
| 1261 | if (tb1 != NULL) { | 1261 | if (tb1 != NULL) { |
| 1262 | /* find head of list */ | 1262 | /* find head of list */ |
| 1263 | for(;;) { | 1263 | for(;;) { |
| 1264 | - n1 = (long)tb1 & 3; | ||
| 1265 | - tb1 = (TranslationBlock *)((long)tb1 & ~3); | 1264 | + n1 = (intptr_t)tb1 & 3; |
| 1265 | + tb1 = (TranslationBlock *)((intptr_t)tb1 & ~3); | ||
| 1266 | if (n1 == 2) | 1266 | if (n1 == 2) |
| 1267 | break; | 1267 | break; |
| 1268 | tb1 = tb1->jmp_next[n1]; | 1268 | tb1 = tb1->jmp_next[n1]; |
| @@ -1274,8 +1274,8 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | @@ -1274,8 +1274,8 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | ||
| 1274 | ptb = &tb_next->jmp_first; | 1274 | ptb = &tb_next->jmp_first; |
| 1275 | for(;;) { | 1275 | for(;;) { |
| 1276 | tb1 = *ptb; | 1276 | tb1 = *ptb; |
| 1277 | - n1 = (long)tb1 & 3; | ||
| 1278 | - tb1 = (TranslationBlock *)((long)tb1 & ~3); | 1277 | + n1 = (intptr_t)tb1 & 3; |
| 1278 | + tb1 = (TranslationBlock *)((intptr_t)tb1 & ~3); | ||
| 1279 | if (n1 == n && tb1 == tb) | 1279 | if (n1 == n && tb1 == tb) |
| 1280 | break; | 1280 | break; |
| 1281 | ptb = &tb1->jmp_next[n1]; | 1281 | ptb = &tb1->jmp_next[n1]; |
| @@ -1843,7 +1843,7 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | @@ -1843,7 +1843,7 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | ||
| 1843 | int dirty_flags) | 1843 | int dirty_flags) |
| 1844 | { | 1844 | { |
| 1845 | CPUState *env; | 1845 | CPUState *env; |
| 1846 | - unsigned long length, start1; | 1846 | + uintptr_t length, start1; |
| 1847 | int i, mask, len; | 1847 | int i, mask, len; |
| 1848 | uint8_t *p; | 1848 | uint8_t *p; |
| 1849 | 1849 | ||
| @@ -1873,10 +1873,10 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | @@ -1873,10 +1873,10 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | ||
| 1873 | 1873 | ||
| 1874 | /* we modify the TLB cache so that the dirty bit will be set again | 1874 | /* we modify the TLB cache so that the dirty bit will be set again |
| 1875 | when accessing the range */ | 1875 | when accessing the range */ |
| 1876 | - start1 = (unsigned long)qemu_get_ram_ptr(start); | 1876 | + start1 = (uintptr_t)qemu_get_ram_ptr(start); |
| 1877 | /* Chek that we don't span multiple blocks - this breaks the | 1877 | /* Chek that we don't span multiple blocks - this breaks the |
| 1878 | address comparisons below. */ | 1878 | address comparisons below. */ |
| 1879 | - if ((unsigned long)qemu_get_ram_ptr(end - 1) - start1 | 1879 | + if ((uintptr_t)qemu_get_ram_ptr(end - 1) - start1 |
| 1880 | != (end - 1) - start) { | 1880 | != (end - 1) - start) { |
| 1881 | abort(); | 1881 | abort(); |
| 1882 | } | 1882 | } |
| @@ -1921,7 +1921,7 @@ static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry) | @@ -1921,7 +1921,7 @@ static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry) | ||
| 1921 | void *p; | 1921 | void *p; |
| 1922 | 1922 | ||
| 1923 | if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) { | 1923 | if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) { |
| 1924 | - p = (void *)(unsigned long)((tlb_entry->addr_write & TARGET_PAGE_MASK) | 1924 | + p = (void *)(uintptr_t)((tlb_entry->addr_write & TARGET_PAGE_MASK) |
| 1925 | + tlb_entry->addend); | 1925 | + tlb_entry->addend); |
| 1926 | ram_addr = qemu_ram_addr_from_host(p); | 1926 | ram_addr = qemu_ram_addr_from_host(p); |
| 1927 | if (!cpu_physical_memory_is_dirty(ram_addr)) { | 1927 | if (!cpu_physical_memory_is_dirty(ram_addr)) { |
| @@ -1996,7 +1996,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr, | @@ -1996,7 +1996,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr, | ||
| 1996 | /* IO memory case (romd handled later) */ | 1996 | /* IO memory case (romd handled later) */ |
| 1997 | address |= TLB_MMIO; | 1997 | address |= TLB_MMIO; |
| 1998 | } | 1998 | } |
| 1999 | - addend = (unsigned long)qemu_get_ram_ptr(pd & TARGET_PAGE_MASK); | 1999 | + addend = (uintptr_t)qemu_get_ram_ptr(pd & TARGET_PAGE_MASK); |
| 2000 | if ((pd & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) { | 2000 | if ((pd & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) { |
| 2001 | /* Normal RAM. */ | 2001 | /* Normal RAM. */ |
| 2002 | iotlb = pd & TARGET_PAGE_MASK; | 2002 | iotlb = pd & TARGET_PAGE_MASK; |
| @@ -3634,13 +3634,13 @@ void cpu_io_recompile(CPUState *env, void *retaddr) | @@ -3634,13 +3634,13 @@ void cpu_io_recompile(CPUState *env, void *retaddr) | ||
| 3634 | target_ulong pc, cs_base; | 3634 | target_ulong pc, cs_base; |
| 3635 | uint64_t flags; | 3635 | uint64_t flags; |
| 3636 | 3636 | ||
| 3637 | - tb = tb_find_pc((unsigned long)retaddr); | 3637 | + tb = tb_find_pc((uintptr_t)retaddr); |
| 3638 | if (!tb) { | 3638 | if (!tb) { |
| 3639 | cpu_abort(env, "cpu_io_recompile: could not find TB for pc=%p", | 3639 | cpu_abort(env, "cpu_io_recompile: could not find TB for pc=%p", |
| 3640 | retaddr); | 3640 | retaddr); |
| 3641 | } | 3641 | } |
| 3642 | n = env->icount_decr.u16.low + tb->icount; | 3642 | n = env->icount_decr.u16.low + tb->icount; |
| 3643 | - cpu_restore_state(tb, env, (unsigned long)retaddr, NULL); | 3643 | + cpu_restore_state(tb, env, (uintptr_t)retaddr, NULL); |
| 3644 | /* Calculate how many instructions had been executed before the fault | 3644 | /* Calculate how many instructions had been executed before the fault |
| 3645 | occurred. */ | 3645 | occurred. */ |
| 3646 | n = n - env->icount_decr.u16.low; | 3646 | n = n - env->icount_decr.u16.low; |
gen-icount.h
| @@ -27,7 +27,7 @@ static void gen_icount_end(TranslationBlock *tb, int num_insns) | @@ -27,7 +27,7 @@ static void gen_icount_end(TranslationBlock *tb, int num_insns) | ||
| 27 | if (use_icount) { | 27 | if (use_icount) { |
| 28 | *icount_arg = num_insns; | 28 | *icount_arg = num_insns; |
| 29 | gen_set_label(icount_label); | 29 | gen_set_label(icount_label); |
| 30 | - tcg_gen_exit_tb((long)tb + 2); | 30 | + tcg_gen_exit_tb((intptr_t)tb + 2); |
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| 33 | 33 |
hw/usb-ohci.c
| @@ -765,8 +765,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | @@ -765,8 +765,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
| 765 | } | 765 | } |
| 766 | 766 | ||
| 767 | #ifdef DEBUG_ISOCH | 767 | #ifdef DEBUG_ISOCH |
| 768 | - printf("so 0x%.8x eo 0x%.8x\nsa 0x%.8x ea 0x%.8x\ndir %s len %zu ret %d\n", | ||
| 769 | - start_offset, end_offset, start_addr, end_addr, str, len, ret); | 768 | + printf("so 0x%.8x eo 0x%.8x\nsa 0x%.8x ea 0x%.8x\ndir %s len %" PRIuPTR |
| 769 | + " ret %d\n", start_offset, end_offset, start_addr, end_addr, str, | ||
| 770 | + len, ret); | ||
| 770 | #endif | 771 | #endif |
| 771 | 772 | ||
| 772 | /* Writeback */ | 773 | /* Writeback */ |
| @@ -783,7 +784,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | @@ -783,7 +784,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
| 783 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, 0); | 784 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, 0); |
| 784 | } else { | 785 | } else { |
| 785 | if (ret > (ssize_t) len) { | 786 | if (ret > (ssize_t) len) { |
| 786 | - printf("usb-ohci: DataOverrun %d > %zu\n", ret, len); | 787 | + printf("usb-ohci: DataOverrun %d > %" PRIuPTR "\n", ret, len); |
| 787 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC, | 788 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC, |
| 788 | OHCI_CC_DATAOVERRUN); | 789 | OHCI_CC_DATAOVERRUN); |
| 789 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, | 790 | OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, |
migration-tcp.c
| @@ -134,7 +134,7 @@ static void tcp_accept_incoming_migration(void *opaque) | @@ -134,7 +134,7 @@ static void tcp_accept_incoming_migration(void *opaque) | ||
| 134 | { | 134 | { |
| 135 | struct sockaddr_in addr; | 135 | struct sockaddr_in addr; |
| 136 | socklen_t addrlen = sizeof(addr); | 136 | socklen_t addrlen = sizeof(addr); |
| 137 | - int s = (unsigned long)opaque; | 137 | + int s = (intptr_t)opaque; |
| 138 | QEMUFile *f; | 138 | QEMUFile *f; |
| 139 | int c, ret; | 139 | int c, ret; |
| 140 | 140 | ||
| @@ -200,7 +200,7 @@ int tcp_start_incoming_migration(const char *host_port) | @@ -200,7 +200,7 @@ int tcp_start_incoming_migration(const char *host_port) | ||
| 200 | goto err; | 200 | goto err; |
| 201 | 201 | ||
| 202 | qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL, | 202 | qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL, |
| 203 | - (void *)(unsigned long)s); | 203 | + (void *)(intptr_t)s); |
| 204 | 204 | ||
| 205 | return 0; | 205 | return 0; |
| 206 | 206 |
monitor.c
| @@ -2740,9 +2740,9 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | @@ -2740,9 +2740,9 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | ||
| 2740 | } | 2740 | } |
| 2741 | if (nb_args + 3 > MAX_ARGS) | 2741 | if (nb_args + 3 > MAX_ARGS) |
| 2742 | goto error_args; | 2742 | goto error_args; |
| 2743 | - args[nb_args++] = (void*)(long)count; | ||
| 2744 | - args[nb_args++] = (void*)(long)format; | ||
| 2745 | - args[nb_args++] = (void*)(long)size; | 2743 | + args[nb_args++] = (void*)(intptr_t)count; |
| 2744 | + args[nb_args++] = (void*)(intptr_t)format; | ||
| 2745 | + args[nb_args++] = (void*)(intptr_t)size; | ||
| 2746 | } | 2746 | } |
| 2747 | break; | 2747 | break; |
| 2748 | case 'i': | 2748 | case 'i': |
| @@ -2771,7 +2771,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | @@ -2771,7 +2771,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | ||
| 2771 | typestr++; | 2771 | typestr++; |
| 2772 | if (nb_args >= MAX_ARGS) | 2772 | if (nb_args >= MAX_ARGS) |
| 2773 | goto error_args; | 2773 | goto error_args; |
| 2774 | - args[nb_args++] = (void *)(long)has_arg; | 2774 | + args[nb_args++] = (void *)(intptr_t)has_arg; |
| 2775 | if (!has_arg) { | 2775 | if (!has_arg) { |
| 2776 | if (nb_args >= MAX_ARGS) | 2776 | if (nb_args >= MAX_ARGS) |
| 2777 | goto error_args; | 2777 | goto error_args; |
| @@ -2785,16 +2785,16 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | @@ -2785,16 +2785,16 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | ||
| 2785 | if (c == 'i') { | 2785 | if (c == 'i') { |
| 2786 | if (nb_args >= MAX_ARGS) | 2786 | if (nb_args >= MAX_ARGS) |
| 2787 | goto error_args; | 2787 | goto error_args; |
| 2788 | - args[nb_args++] = (void *)(long)val; | 2788 | + args[nb_args++] = (void *)(intptr_t)val; |
| 2789 | } else { | 2789 | } else { |
| 2790 | if ((nb_args + 1) >= MAX_ARGS) | 2790 | if ((nb_args + 1) >= MAX_ARGS) |
| 2791 | goto error_args; | 2791 | goto error_args; |
| 2792 | #if TARGET_PHYS_ADDR_BITS > 32 | 2792 | #if TARGET_PHYS_ADDR_BITS > 32 |
| 2793 | - args[nb_args++] = (void *)(long)((val >> 32) & 0xffffffff); | 2793 | + args[nb_args++] = (void *)(intptr_t)((val >> 32) & 0xffffffff); |
| 2794 | #else | 2794 | #else |
| 2795 | args[nb_args++] = (void *)0; | 2795 | args[nb_args++] = (void *)0; |
| 2796 | #endif | 2796 | #endif |
| 2797 | - args[nb_args++] = (void *)(long)(val & 0xffffffff); | 2797 | + args[nb_args++] = (void *)(intptr_t)(val & 0xffffffff); |
| 2798 | } | 2798 | } |
| 2799 | } | 2799 | } |
| 2800 | break; | 2800 | break; |
| @@ -2821,7 +2821,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | @@ -2821,7 +2821,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) | ||
| 2821 | } | 2821 | } |
| 2822 | if (nb_args >= MAX_ARGS) | 2822 | if (nb_args >= MAX_ARGS) |
| 2823 | goto error_args; | 2823 | goto error_args; |
| 2824 | - args[nb_args++] = (void *)(long)has_option; | 2824 | + args[nb_args++] = (void *)(intptr_t)has_option; |
| 2825 | } | 2825 | } |
| 2826 | break; | 2826 | break; |
| 2827 | default: | 2827 | default: |
qemu-common.h
| @@ -64,10 +64,6 @@ static inline char *realpath(const char *path, char *resolved_path) | @@ -64,10 +64,6 @@ static inline char *realpath(const char *path, char *resolved_path) | ||
| 64 | return resolved_path; | 64 | return resolved_path; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | -#define PRId64 "I64d" | ||
| 68 | -#define PRIx64 "I64x" | ||
| 69 | -#define PRIu64 "I64u" | ||
| 70 | -#define PRIo64 "I64o" | ||
| 71 | #endif | 67 | #endif |
| 72 | 68 | ||
| 73 | /* FIXME: Remove NEED_CPU_H. */ | 69 | /* FIXME: Remove NEED_CPU_H. */ |
slirp/cksum.c
| @@ -72,7 +72,7 @@ int cksum(struct mbuf *m, int len) | @@ -72,7 +72,7 @@ int cksum(struct mbuf *m, int len) | ||
| 72 | /* | 72 | /* |
| 73 | * Force to even boundary. | 73 | * Force to even boundary. |
| 74 | */ | 74 | */ |
| 75 | - if ((1 & (long) w) && (mlen > 0)) { | 75 | + if ((1 & (intptr_t) w) && (mlen > 0)) { |
| 76 | REDUCE; | 76 | REDUCE; |
| 77 | sum <<= 8; | 77 | sum <<= 8; |
| 78 | s_util.c[0] = *(u_int8_t *)w; | 78 | s_util.c[0] = *(u_int8_t *)w; |
softmmu_header.h
| @@ -76,7 +76,7 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) | @@ -76,7 +76,7 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) | ||
| 76 | int page_index; | 76 | int page_index; |
| 77 | RES_TYPE res; | 77 | RES_TYPE res; |
| 78 | target_ulong addr; | 78 | target_ulong addr; |
| 79 | - unsigned long physaddr; | 79 | + uintptr_t physaddr; |
| 80 | int mmu_idx; | 80 | int mmu_idx; |
| 81 | 81 | ||
| 82 | addr = ptr; | 82 | addr = ptr; |
| @@ -87,7 +87,7 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) | @@ -87,7 +87,7 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) | ||
| 87 | res = glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, mmu_idx); | 87 | res = glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, mmu_idx); |
| 88 | } else { | 88 | } else { |
| 89 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; | 89 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; |
| 90 | - res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)physaddr); | 90 | + res = glue(glue(ld, USUFFIX), _raw)(physaddr); |
| 91 | } | 91 | } |
| 92 | return res; | 92 | return res; |
| 93 | } | 93 | } |
| @@ -97,7 +97,7 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) | @@ -97,7 +97,7 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) | ||
| 97 | { | 97 | { |
| 98 | int res, page_index; | 98 | int res, page_index; |
| 99 | target_ulong addr; | 99 | target_ulong addr; |
| 100 | - unsigned long physaddr; | 100 | + uintptr_t physaddr; |
| 101 | int mmu_idx; | 101 | int mmu_idx; |
| 102 | 102 | ||
| 103 | addr = ptr; | 103 | addr = ptr; |
| @@ -108,7 +108,7 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) | @@ -108,7 +108,7 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) | ||
| 108 | res = (DATA_STYPE)glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, mmu_idx); | 108 | res = (DATA_STYPE)glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, mmu_idx); |
| 109 | } else { | 109 | } else { |
| 110 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; | 110 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; |
| 111 | - res = glue(glue(lds, SUFFIX), _raw)((uint8_t *)physaddr); | 111 | + res = glue(glue(lds, SUFFIX), _raw)(physaddr); |
| 112 | } | 112 | } |
| 113 | return res; | 113 | return res; |
| 114 | } | 114 | } |
| @@ -122,7 +122,7 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE | @@ -122,7 +122,7 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE | ||
| 122 | { | 122 | { |
| 123 | int page_index; | 123 | int page_index; |
| 124 | target_ulong addr; | 124 | target_ulong addr; |
| 125 | - unsigned long physaddr; | 125 | + uintptr_t physaddr; |
| 126 | int mmu_idx; | 126 | int mmu_idx; |
| 127 | 127 | ||
| 128 | addr = ptr; | 128 | addr = ptr; |
| @@ -133,7 +133,7 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE | @@ -133,7 +133,7 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE | ||
| 133 | glue(glue(__st, SUFFIX), MMUSUFFIX)(addr, v, mmu_idx); | 133 | glue(glue(__st, SUFFIX), MMUSUFFIX)(addr, v, mmu_idx); |
| 134 | } else { | 134 | } else { |
| 135 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; | 135 | physaddr = addr + env->tlb_table[mmu_idx][page_index].addend; |
| 136 | - glue(glue(st, SUFFIX), _raw)((uint8_t *)physaddr, v); | 136 | + glue(glue(st, SUFFIX), _raw)(physaddr, v); |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 |
softmmu_template.h
| @@ -57,7 +57,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, | @@ -57,7 +57,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, | ||
| 57 | int index; | 57 | int index; |
| 58 | index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | 58 | index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); |
| 59 | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; | 59 | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; |
| 60 | - env->mem_io_pc = (unsigned long)retaddr; | 60 | + env->mem_io_pc = (uintptr_t)retaddr; |
| 61 | if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT) | 61 | if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT) |
| 62 | && !can_do_io(env)) { | 62 | && !can_do_io(env)) { |
| 63 | cpu_io_recompile(env, retaddr); | 63 | cpu_io_recompile(env, retaddr); |
| @@ -122,7 +122,7 @@ DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -122,7 +122,7 @@ DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
| 122 | } | 122 | } |
| 123 | #endif | 123 | #endif |
| 124 | addend = env->tlb_table[mmu_idx][index].addend; | 124 | addend = env->tlb_table[mmu_idx][index].addend; |
| 125 | - res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend)); | 125 | + res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(intptr_t)(addr+addend)); |
| 126 | } | 126 | } |
| 127 | } else { | 127 | } else { |
| 128 | /* the page is not in the TLB : fill it */ | 128 | /* the page is not in the TLB : fill it */ |
| @@ -177,7 +177,7 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -177,7 +177,7 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
| 177 | } else { | 177 | } else { |
| 178 | /* unaligned/aligned access in the same page */ | 178 | /* unaligned/aligned access in the same page */ |
| 179 | addend = env->tlb_table[mmu_idx][index].addend; | 179 | addend = env->tlb_table[mmu_idx][index].addend; |
| 180 | - res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend)); | 180 | + res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(intptr_t)(addr+addend)); |
| 181 | } | 181 | } |
| 182 | } else { | 182 | } else { |
| 183 | /* the page is not in the TLB : fill it */ | 183 | /* the page is not in the TLB : fill it */ |
| @@ -208,7 +208,7 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, | @@ -208,7 +208,7 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, | ||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | env->mem_io_vaddr = addr; | 210 | env->mem_io_vaddr = addr; |
| 211 | - env->mem_io_pc = (unsigned long)retaddr; | 211 | + env->mem_io_pc = (uintptr_t)retaddr; |
| 212 | #if SHIFT <= 2 | 212 | #if SHIFT <= 2 |
| 213 | io_mem_write[index][SHIFT](io_mem_opaque[index], physaddr, val); | 213 | io_mem_write[index][SHIFT](io_mem_opaque[index], physaddr, val); |
| 214 | #else | 214 | #else |
| @@ -262,7 +262,7 @@ void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -262,7 +262,7 @@ void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
| 262 | } | 262 | } |
| 263 | #endif | 263 | #endif |
| 264 | addend = env->tlb_table[mmu_idx][index].addend; | 264 | addend = env->tlb_table[mmu_idx][index].addend; |
| 265 | - glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val); | 265 | + glue(glue(st, SUFFIX), _raw)((uint8_t *)(intptr_t)(addr+addend), val); |
| 266 | } | 266 | } |
| 267 | } else { | 267 | } else { |
| 268 | /* the page is not in the TLB : fill it */ | 268 | /* the page is not in the TLB : fill it */ |
| @@ -313,7 +313,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -313,7 +313,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
| 313 | } else { | 313 | } else { |
| 314 | /* aligned/unaligned access in the same page */ | 314 | /* aligned/unaligned access in the same page */ |
| 315 | addend = env->tlb_table[mmu_idx][index].addend; | 315 | addend = env->tlb_table[mmu_idx][index].addend; |
| 316 | - glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val); | 316 | + glue(glue(st, SUFFIX), _raw)((uint8_t *)(intptr_t)(addr+addend), val); |
| 317 | } | 317 | } |
| 318 | } else { | 318 | } else { |
| 319 | /* the page is not in the TLB : fill it */ | 319 | /* the page is not in the TLB : fill it */ |
sysemu.h
| @@ -21,7 +21,7 @@ extern int vm_running; | @@ -21,7 +21,7 @@ extern int vm_running; | ||
| 21 | extern const char *qemu_name; | 21 | extern const char *qemu_name; |
| 22 | extern uint8_t qemu_uuid[]; | 22 | extern uint8_t qemu_uuid[]; |
| 23 | int qemu_uuid_parse(const char *str, uint8_t *uuid); | 23 | int qemu_uuid_parse(const char *str, uint8_t *uuid); |
| 24 | -#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" | 24 | +#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" |
| 25 | 25 | ||
| 26 | typedef struct vm_change_state_entry VMChangeStateEntry; | 26 | typedef struct vm_change_state_entry VMChangeStateEntry; |
| 27 | typedef void VMChangeStateHandler(void *opaque, int running, int reason); | 27 | typedef void VMChangeStateHandler(void *opaque, int running, int reason); |
target-alpha/op_helper.c
| @@ -1170,7 +1170,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -1170,7 +1170,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 1170 | { | 1170 | { |
| 1171 | TranslationBlock *tb; | 1171 | TranslationBlock *tb; |
| 1172 | CPUState *saved_env; | 1172 | CPUState *saved_env; |
| 1173 | - unsigned long pc; | 1173 | + uintptr_t pc; |
| 1174 | int ret; | 1174 | int ret; |
| 1175 | 1175 | ||
| 1176 | /* XXX: hack to restore env in all cases, even if not called from | 1176 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -1181,7 +1181,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -1181,7 +1181,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 1181 | if (!likely(ret == 0)) { | 1181 | if (!likely(ret == 0)) { |
| 1182 | if (likely(retaddr)) { | 1182 | if (likely(retaddr)) { |
| 1183 | /* now we have a real cpu fault */ | 1183 | /* now we have a real cpu fault */ |
| 1184 | - pc = (unsigned long)retaddr; | 1184 | + pc = (uintptr_t)retaddr; |
| 1185 | tb = tb_find_pc(pc); | 1185 | tb = tb_find_pc(pc); |
| 1186 | if (likely(tb)) { | 1186 | if (likely(tb)) { |
| 1187 | /* the PC is inside the translated code. It means that we have | 1187 | /* the PC is inside the translated code. It means that we have |
target-alpha/translate.c
| @@ -2509,7 +2509,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) | @@ -2509,7 +2509,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) | ||
| 2509 | } | 2509 | } |
| 2510 | 2510 | ||
| 2511 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 2511 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 2512 | - unsigned long searched_pc, int pc_pos, void *puc) | 2512 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 2513 | { | 2513 | { |
| 2514 | env->pc = gen_opc_pc[pc_pos]; | 2514 | env->pc = gen_opc_pc[pc_pos]; |
| 2515 | } | 2515 | } |
target-arm/op_helper.c
| @@ -88,7 +88,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -88,7 +88,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 88 | { | 88 | { |
| 89 | TranslationBlock *tb; | 89 | TranslationBlock *tb; |
| 90 | CPUState *saved_env; | 90 | CPUState *saved_env; |
| 91 | - unsigned long pc; | 91 | + uintptr_t pc; |
| 92 | int ret; | 92 | int ret; |
| 93 | 93 | ||
| 94 | /* XXX: hack to restore env in all cases, even if not called from | 94 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -99,7 +99,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -99,7 +99,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 99 | if (unlikely(ret)) { | 99 | if (unlikely(ret)) { |
| 100 | if (retaddr) { | 100 | if (retaddr) { |
| 101 | /* now we have a real cpu fault */ | 101 | /* now we have a real cpu fault */ |
| 102 | - pc = (unsigned long)retaddr; | 102 | + pc = (uintptr_t)retaddr; |
| 103 | tb = tb_find_pc(pc); | 103 | tb = tb_find_pc(pc); |
| 104 | if (tb) { | 104 | if (tb) { |
| 105 | /* the PC is inside the translated code. It means that we have | 105 | /* the PC is inside the translated code. It means that we have |
target-arm/translate.c
| @@ -3198,7 +3198,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint32_t dest) | @@ -3198,7 +3198,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint32_t dest) | ||
| 3198 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { | 3198 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
| 3199 | tcg_gen_goto_tb(n); | 3199 | tcg_gen_goto_tb(n); |
| 3200 | gen_set_pc_im(dest); | 3200 | gen_set_pc_im(dest); |
| 3201 | - tcg_gen_exit_tb((long)tb + n); | 3201 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 3202 | } else { | 3202 | } else { |
| 3203 | gen_set_pc_im(dest); | 3203 | gen_set_pc_im(dest); |
| 3204 | tcg_gen_exit_tb(0); | 3204 | tcg_gen_exit_tb(0); |
| @@ -9027,7 +9027,7 @@ void cpu_dump_state(CPUState *env, FILE *f, | @@ -9027,7 +9027,7 @@ void cpu_dump_state(CPUState *env, FILE *f, | ||
| 9027 | } | 9027 | } |
| 9028 | 9028 | ||
| 9029 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 9029 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 9030 | - unsigned long searched_pc, int pc_pos, void *puc) | 9030 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 9031 | { | 9031 | { |
| 9032 | env->regs[15] = gen_opc_pc[pc_pos]; | 9032 | env->regs[15] = gen_opc_pc[pc_pos]; |
| 9033 | } | 9033 | } |
target-cris/op_helper.c
| @@ -58,7 +58,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -58,7 +58,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 58 | { | 58 | { |
| 59 | TranslationBlock *tb; | 59 | TranslationBlock *tb; |
| 60 | CPUState *saved_env; | 60 | CPUState *saved_env; |
| 61 | - unsigned long pc; | 61 | + uintptr_t pc; |
| 62 | int ret; | 62 | int ret; |
| 63 | 63 | ||
| 64 | /* XXX: hack to restore env in all cases, even if not called from | 64 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -72,7 +72,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -72,7 +72,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 72 | if (unlikely(ret)) { | 72 | if (unlikely(ret)) { |
| 73 | if (retaddr) { | 73 | if (retaddr) { |
| 74 | /* now we have a real cpu fault */ | 74 | /* now we have a real cpu fault */ |
| 75 | - pc = (unsigned long)retaddr; | 75 | + pc = (uintptr_t)retaddr; |
| 76 | tb = tb_find_pc(pc); | 76 | tb = tb_find_pc(pc); |
| 77 | if (tb) { | 77 | if (tb) { |
| 78 | /* the PC is inside the translated code. It means that we have | 78 | /* the PC is inside the translated code. It means that we have |
target-cris/translate.c
| @@ -523,7 +523,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) | @@ -523,7 +523,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) | ||
| 523 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { | 523 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
| 524 | tcg_gen_goto_tb(n); | 524 | tcg_gen_goto_tb(n); |
| 525 | tcg_gen_movi_tl(env_pc, dest); | 525 | tcg_gen_movi_tl(env_pc, dest); |
| 526 | - tcg_gen_exit_tb((long)tb + n); | 526 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 527 | } else { | 527 | } else { |
| 528 | tcg_gen_movi_tl(env_pc, dest); | 528 | tcg_gen_movi_tl(env_pc, dest); |
| 529 | tcg_gen_exit_tb(0); | 529 | tcg_gen_exit_tb(0); |
| @@ -3478,7 +3478,7 @@ void cpu_reset (CPUCRISState *env) | @@ -3478,7 +3478,7 @@ void cpu_reset (CPUCRISState *env) | ||
| 3478 | } | 3478 | } |
| 3479 | 3479 | ||
| 3480 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, | 3480 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, |
| 3481 | - unsigned long searched_pc, int pc_pos, void *puc) | 3481 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 3482 | { | 3482 | { |
| 3483 | env->pc = gen_opc_pc[pc_pos]; | 3483 | env->pc = gen_opc_pc[pc_pos]; |
| 3484 | } | 3484 | } |
target-i386/op_helper.c
| @@ -4830,7 +4830,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -4830,7 +4830,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 4830 | { | 4830 | { |
| 4831 | TranslationBlock *tb; | 4831 | TranslationBlock *tb; |
| 4832 | int ret; | 4832 | int ret; |
| 4833 | - unsigned long pc; | 4833 | + uintptr_t pc; |
| 4834 | CPUX86State *saved_env; | 4834 | CPUX86State *saved_env; |
| 4835 | 4835 | ||
| 4836 | /* XXX: hack to restore env in all cases, even if not called from | 4836 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -4842,7 +4842,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -4842,7 +4842,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 4842 | if (ret) { | 4842 | if (ret) { |
| 4843 | if (retaddr) { | 4843 | if (retaddr) { |
| 4844 | /* now we have a real cpu fault */ | 4844 | /* now we have a real cpu fault */ |
| 4845 | - pc = (unsigned long)retaddr; | 4845 | + pc = (uintptr_t)retaddr; |
| 4846 | tb = tb_find_pc(pc); | 4846 | tb = tb_find_pc(pc); |
| 4847 | if (tb) { | 4847 | if (tb) { |
| 4848 | /* the PC is inside the translated code. It means that we have | 4848 | /* the PC is inside the translated code. It means that we have |
target-i386/translate.c
| @@ -2293,7 +2293,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip) | @@ -2293,7 +2293,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip) | ||
| 2293 | /* jump to same page: we can use a direct jump */ | 2293 | /* jump to same page: we can use a direct jump */ |
| 2294 | tcg_gen_goto_tb(tb_num); | 2294 | tcg_gen_goto_tb(tb_num); |
| 2295 | gen_jmp_im(eip); | 2295 | gen_jmp_im(eip); |
| 2296 | - tcg_gen_exit_tb((long)tb + tb_num); | 2296 | + tcg_gen_exit_tb((intptr_t)tb + tb_num); |
| 2297 | } else { | 2297 | } else { |
| 2298 | /* jump to another page: currently not optimized */ | 2298 | /* jump to another page: currently not optimized */ |
| 2299 | gen_jmp_im(eip); | 2299 | gen_jmp_im(eip); |
| @@ -7787,7 +7787,7 @@ void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) | @@ -7787,7 +7787,7 @@ void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) | ||
| 7787 | } | 7787 | } |
| 7788 | 7788 | ||
| 7789 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 7789 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 7790 | - unsigned long searched_pc, int pc_pos, void *puc) | 7790 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 7791 | { | 7791 | { |
| 7792 | int cc_op; | 7792 | int cc_op; |
| 7793 | #ifdef DEBUG_DISAS | 7793 | #ifdef DEBUG_DISAS |
| @@ -7799,7 +7799,7 @@ void gen_pc_load(CPUState *env, TranslationBlock *tb, | @@ -7799,7 +7799,7 @@ void gen_pc_load(CPUState *env, TranslationBlock *tb, | ||
| 7799 | qemu_log("0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]); | 7799 | qemu_log("0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]); |
| 7800 | } | 7800 | } |
| 7801 | } | 7801 | } |
| 7802 | - qemu_log("spc=0x%08lx pc_pos=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n", | 7802 | + qemu_log("spc=0x%08Ix pc_pos=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n", |
| 7803 | searched_pc, pc_pos, gen_opc_pc[pc_pos] - tb->cs_base, | 7803 | searched_pc, pc_pos, gen_opc_pc[pc_pos] - tb->cs_base, |
| 7804 | (uint32_t)tb->cs_base); | 7804 | (uint32_t)tb->cs_base); |
| 7805 | } | 7805 | } |
target-m68k/op_helper.c
| @@ -52,7 +52,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -52,7 +52,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 52 | { | 52 | { |
| 53 | TranslationBlock *tb; | 53 | TranslationBlock *tb; |
| 54 | CPUState *saved_env; | 54 | CPUState *saved_env; |
| 55 | - unsigned long pc; | 55 | + uintptr_t pc; |
| 56 | int ret; | 56 | int ret; |
| 57 | 57 | ||
| 58 | /* XXX: hack to restore env in all cases, even if not called from | 58 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -63,7 +63,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -63,7 +63,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 63 | if (unlikely(ret)) { | 63 | if (unlikely(ret)) { |
| 64 | if (retaddr) { | 64 | if (retaddr) { |
| 65 | /* now we have a real cpu fault */ | 65 | /* now we have a real cpu fault */ |
| 66 | - pc = (unsigned long)retaddr; | 66 | + pc = (uintptr_t)retaddr; |
| 67 | tb = tb_find_pc(pc); | 67 | tb = tb_find_pc(pc); |
| 68 | if (tb) { | 68 | if (tb) { |
| 69 | /* the PC is inside the translated code. It means that we have | 69 | /* the PC is inside the translated code. It means that we have |
target-m68k/translate.c
| @@ -862,7 +862,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) | @@ -862,7 +862,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) | ||
| 862 | (s->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { | 862 | (s->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
| 863 | tcg_gen_goto_tb(n); | 863 | tcg_gen_goto_tb(n); |
| 864 | tcg_gen_movi_i32(QREG_PC, dest); | 864 | tcg_gen_movi_i32(QREG_PC, dest); |
| 865 | - tcg_gen_exit_tb((long)tb + n); | 865 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 866 | } else { | 866 | } else { |
| 867 | gen_jmp_im(s, dest); | 867 | gen_jmp_im(s, dest); |
| 868 | tcg_gen_exit_tb(0); | 868 | tcg_gen_exit_tb(0); |
| @@ -3118,7 +3118,7 @@ void cpu_dump_state(CPUState *env, FILE *f, | @@ -3118,7 +3118,7 @@ void cpu_dump_state(CPUState *env, FILE *f, | ||
| 3118 | } | 3118 | } |
| 3119 | 3119 | ||
| 3120 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 3120 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 3121 | - unsigned long searched_pc, int pc_pos, void *puc) | 3121 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 3122 | { | 3122 | { |
| 3123 | env->pc = gen_opc_pc[pc_pos]; | 3123 | env->pc = gen_opc_pc[pc_pos]; |
| 3124 | } | 3124 | } |
target-microblaze/op_helper.c
| @@ -43,7 +43,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -43,7 +43,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 43 | { | 43 | { |
| 44 | TranslationBlock *tb; | 44 | TranslationBlock *tb; |
| 45 | CPUState *saved_env; | 45 | CPUState *saved_env; |
| 46 | - unsigned long pc; | 46 | + uintptr_t pc; |
| 47 | int ret; | 47 | int ret; |
| 48 | 48 | ||
| 49 | /* XXX: hack to restore env in all cases, even if not called from | 49 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -55,7 +55,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -55,7 +55,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 55 | if (unlikely(ret)) { | 55 | if (unlikely(ret)) { |
| 56 | if (retaddr) { | 56 | if (retaddr) { |
| 57 | /* now we have a real cpu fault */ | 57 | /* now we have a real cpu fault */ |
| 58 | - pc = (unsigned long)retaddr; | 58 | + pc = (uintptr_t)retaddr; |
| 59 | tb = tb_find_pc(pc); | 59 | tb = tb_find_pc(pc); |
| 60 | if (tb) { | 60 | if (tb) { |
| 61 | /* the PC is inside the translated code. It means that we have | 61 | /* the PC is inside the translated code. It means that we have |
target-microblaze/translate.c
| @@ -146,7 +146,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) | @@ -146,7 +146,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) | ||
| 146 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { | 146 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
| 147 | tcg_gen_goto_tb(n); | 147 | tcg_gen_goto_tb(n); |
| 148 | tcg_gen_movi_tl(cpu_SR[SR_PC], dest); | 148 | tcg_gen_movi_tl(cpu_SR[SR_PC], dest); |
| 149 | - tcg_gen_exit_tb((long)tb + n); | 149 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 150 | } else { | 150 | } else { |
| 151 | tcg_gen_movi_tl(cpu_SR[SR_PC], dest); | 151 | tcg_gen_movi_tl(cpu_SR[SR_PC], dest); |
| 152 | tcg_gen_exit_tb(0); | 152 | tcg_gen_exit_tb(0); |
| @@ -1388,7 +1388,7 @@ void cpu_reset (CPUState *env) | @@ -1388,7 +1388,7 @@ void cpu_reset (CPUState *env) | ||
| 1388 | } | 1388 | } |
| 1389 | 1389 | ||
| 1390 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, | 1390 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, |
| 1391 | - unsigned long searched_pc, int pc_pos, void *puc) | 1391 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 1392 | { | 1392 | { |
| 1393 | env->sregs[SR_PC] = gen_opc_pc[pc_pos]; | 1393 | env->sregs[SR_PC] = gen_opc_pc[pc_pos]; |
| 1394 | } | 1394 | } |
target-mips/op_helper.c
| @@ -1822,7 +1822,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -1822,7 +1822,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 1822 | { | 1822 | { |
| 1823 | TranslationBlock *tb; | 1823 | TranslationBlock *tb; |
| 1824 | CPUState *saved_env; | 1824 | CPUState *saved_env; |
| 1825 | - unsigned long pc; | 1825 | + uintptr_t pc; |
| 1826 | int ret; | 1826 | int ret; |
| 1827 | 1827 | ||
| 1828 | /* XXX: hack to restore env in all cases, even if not called from | 1828 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -1833,7 +1833,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -1833,7 +1833,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 1833 | if (ret) { | 1833 | if (ret) { |
| 1834 | if (retaddr) { | 1834 | if (retaddr) { |
| 1835 | /* now we have a real cpu fault */ | 1835 | /* now we have a real cpu fault */ |
| 1836 | - pc = (unsigned long)retaddr; | 1836 | + pc = (uintptr_t)retaddr; |
| 1837 | tb = tb_find_pc(pc); | 1837 | tb = tb_find_pc(pc); |
| 1838 | if (tb) { | 1838 | if (tb) { |
| 1839 | /* the PC is inside the translated code. It means that we have | 1839 | /* the PC is inside the translated code. It means that we have |
target-mips/translate.c
| @@ -2462,7 +2462,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | @@ -2462,7 +2462,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | ||
| 2462 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { | 2462 | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
| 2463 | tcg_gen_goto_tb(n); | 2463 | tcg_gen_goto_tb(n); |
| 2464 | gen_save_pc(dest); | 2464 | gen_save_pc(dest); |
| 2465 | - tcg_gen_exit_tb((long)tb + n); | 2465 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 2466 | } else { | 2466 | } else { |
| 2467 | gen_save_pc(dest); | 2467 | gen_save_pc(dest); |
| 2468 | tcg_gen_exit_tb(0); | 2468 | tcg_gen_exit_tb(0); |
| @@ -8640,7 +8640,7 @@ void cpu_reset (CPUMIPSState *env) | @@ -8640,7 +8640,7 @@ void cpu_reset (CPUMIPSState *env) | ||
| 8640 | } | 8640 | } |
| 8641 | 8641 | ||
| 8642 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 8642 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 8643 | - unsigned long searched_pc, int pc_pos, void *puc) | 8643 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 8644 | { | 8644 | { |
| 8645 | env->active_tc.PC = gen_opc_pc[pc_pos]; | 8645 | env->active_tc.PC = gen_opc_pc[pc_pos]; |
| 8646 | env->hflags &= ~MIPS_HFLAG_BMASK; | 8646 | env->hflags &= ~MIPS_HFLAG_BMASK; |
target-ppc/op_helper.c
| @@ -3714,7 +3714,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -3714,7 +3714,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 3714 | { | 3714 | { |
| 3715 | TranslationBlock *tb; | 3715 | TranslationBlock *tb; |
| 3716 | CPUState *saved_env; | 3716 | CPUState *saved_env; |
| 3717 | - unsigned long pc; | 3717 | + uintptr_t pc; |
| 3718 | int ret; | 3718 | int ret; |
| 3719 | 3719 | ||
| 3720 | /* XXX: hack to restore env in all cases, even if not called from | 3720 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -3725,7 +3725,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -3725,7 +3725,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 3725 | if (unlikely(ret != 0)) { | 3725 | if (unlikely(ret != 0)) { |
| 3726 | if (likely(retaddr)) { | 3726 | if (likely(retaddr)) { |
| 3727 | /* now we have a real cpu fault */ | 3727 | /* now we have a real cpu fault */ |
| 3728 | - pc = (unsigned long)retaddr; | 3728 | + pc = (uintptr_t)retaddr; |
| 3729 | tb = tb_find_pc(pc); | 3729 | tb = tb_find_pc(pc); |
| 3730 | if (likely(tb)) { | 3730 | if (likely(tb)) { |
| 3731 | /* the PC is inside the translated code. It means that we have | 3731 | /* the PC is inside the translated code. It means that we have |
target-ppc/translate.c
| @@ -3298,7 +3298,7 @@ static always_inline void gen_goto_tb (DisasContext *ctx, int n, | @@ -3298,7 +3298,7 @@ static always_inline void gen_goto_tb (DisasContext *ctx, int n, | ||
| 3298 | likely(!ctx->singlestep_enabled)) { | 3298 | likely(!ctx->singlestep_enabled)) { |
| 3299 | tcg_gen_goto_tb(n); | 3299 | tcg_gen_goto_tb(n); |
| 3300 | tcg_gen_movi_tl(cpu_nip, dest & ~3); | 3300 | tcg_gen_movi_tl(cpu_nip, dest & ~3); |
| 3301 | - tcg_gen_exit_tb((long)tb + n); | 3301 | + tcg_gen_exit_tb((intptr_t)tb + n); |
| 3302 | } else { | 3302 | } else { |
| 3303 | tcg_gen_movi_tl(cpu_nip, dest & ~3); | 3303 | tcg_gen_movi_tl(cpu_nip, dest & ~3); |
| 3304 | if (unlikely(ctx->singlestep_enabled)) { | 3304 | if (unlikely(ctx->singlestep_enabled)) { |
| @@ -9098,7 +9098,7 @@ void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | @@ -9098,7 +9098,7 @@ void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | ||
| 9098 | } | 9098 | } |
| 9099 | 9099 | ||
| 9100 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 9100 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 9101 | - unsigned long searched_pc, int pc_pos, void *puc) | 9101 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 9102 | { | 9102 | { |
| 9103 | env->nip = gen_opc_pc[pc_pos]; | 9103 | env->nip = gen_opc_pc[pc_pos]; |
| 9104 | } | 9104 | } |
target-sh4/op_helper.c
| @@ -41,7 +41,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -41,7 +41,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 41 | { | 41 | { |
| 42 | TranslationBlock *tb; | 42 | TranslationBlock *tb; |
| 43 | CPUState *saved_env; | 43 | CPUState *saved_env; |
| 44 | - unsigned long pc; | 44 | + uintptr_t pc; |
| 45 | int ret; | 45 | int ret; |
| 46 | 46 | ||
| 47 | /* XXX: hack to restore env in all cases, even if not called from | 47 | /* XXX: hack to restore env in all cases, even if not called from |
| @@ -52,7 +52,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -52,7 +52,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 52 | if (ret) { | 52 | if (ret) { |
| 53 | if (retaddr) { | 53 | if (retaddr) { |
| 54 | /* now we have a real cpu fault */ | 54 | /* now we have a real cpu fault */ |
| 55 | - pc = (unsigned long) retaddr; | 55 | + pc = (uintptr_t) retaddr; |
| 56 | tb = tb_find_pc(pc); | 56 | tb = tb_find_pc(pc); |
| 57 | if (tb) { | 57 | if (tb) { |
| 58 | /* the PC is inside the translated code. It means that we have | 58 | /* the PC is inside the translated code. It means that we have |
target-sh4/translate.c
| @@ -302,7 +302,7 @@ static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest) | @@ -302,7 +302,7 @@ static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest) | ||
| 302 | /* Use a direct jump if in same page and singlestep not enabled */ | 302 | /* Use a direct jump if in same page and singlestep not enabled */ |
| 303 | tcg_gen_goto_tb(n); | 303 | tcg_gen_goto_tb(n); |
| 304 | tcg_gen_movi_i32(cpu_pc, dest); | 304 | tcg_gen_movi_i32(cpu_pc, dest); |
| 305 | - tcg_gen_exit_tb((long) tb + n); | 305 | + tcg_gen_exit_tb((intptr_t) tb + n); |
| 306 | } else { | 306 | } else { |
| 307 | tcg_gen_movi_i32(cpu_pc, dest); | 307 | tcg_gen_movi_i32(cpu_pc, dest); |
| 308 | if (ctx->singlestep_enabled) | 308 | if (ctx->singlestep_enabled) |
| @@ -2030,7 +2030,7 @@ void gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) | @@ -2030,7 +2030,7 @@ void gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) | ||
| 2030 | } | 2030 | } |
| 2031 | 2031 | ||
| 2032 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 2032 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 2033 | - unsigned long searched_pc, int pc_pos, void *puc) | 2033 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 2034 | { | 2034 | { |
| 2035 | env->pc = gen_opc_pc[pc_pos]; | 2035 | env->pc = gen_opc_pc[pc_pos]; |
| 2036 | env->flags = gen_opc_hflags[pc_pos]; | 2036 | env->flags = gen_opc_hflags[pc_pos]; |
target-sparc/translate.c
| @@ -236,7 +236,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, | @@ -236,7 +236,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, | ||
| 236 | tcg_gen_goto_tb(tb_num); | 236 | tcg_gen_goto_tb(tb_num); |
| 237 | tcg_gen_movi_tl(cpu_pc, pc); | 237 | tcg_gen_movi_tl(cpu_pc, pc); |
| 238 | tcg_gen_movi_tl(cpu_npc, npc); | 238 | tcg_gen_movi_tl(cpu_npc, npc); |
| 239 | - tcg_gen_exit_tb((long)tb + tb_num); | 239 | + tcg_gen_exit_tb((intptr_t)tb + tb_num); |
| 240 | } else { | 240 | } else { |
| 241 | /* jump to another page: currently not optimized */ | 241 | /* jump to another page: currently not optimized */ |
| 242 | tcg_gen_movi_tl(cpu_pc, pc); | 242 | tcg_gen_movi_tl(cpu_pc, pc); |
| @@ -4891,7 +4891,7 @@ void gen_intermediate_code_init(CPUSPARCState *env) | @@ -4891,7 +4891,7 @@ void gen_intermediate_code_init(CPUSPARCState *env) | ||
| 4891 | } | 4891 | } |
| 4892 | 4892 | ||
| 4893 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 4893 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
| 4894 | - unsigned long searched_pc, int pc_pos, void *puc) | 4894 | + uintptr_t searched_pc, int pc_pos, void *puc) |
| 4895 | { | 4895 | { |
| 4896 | target_ulong npc; | 4896 | target_ulong npc; |
| 4897 | env->pc = gen_opc_pc[pc_pos]; | 4897 | env->pc = gen_opc_pc[pc_pos]; |
tcg/arm/tcg-target.h
| @@ -69,7 +69,7 @@ enum { | @@ -69,7 +69,7 @@ enum { | ||
| 69 | TCG_AREG0 = TCG_REG_R7, | 69 | TCG_AREG0 = TCG_REG_R7, |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 72 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 73 | { | 73 | { |
| 74 | #if QEMU_GNUC_PREREQ(4, 1) | 74 | #if QEMU_GNUC_PREREQ(4, 1) |
| 75 | __builtin___clear_cache((char *) start, (char *) stop); | 75 | __builtin___clear_cache((char *) start, (char *) stop); |
tcg/hppa/tcg-target.h
| @@ -83,7 +83,7 @@ enum { | @@ -83,7 +83,7 @@ enum { | ||
| 83 | /* Note: must be synced with dyngen-exec.h */ | 83 | /* Note: must be synced with dyngen-exec.h */ |
| 84 | #define TCG_AREG0 TCG_REG_R17 | 84 | #define TCG_AREG0 TCG_REG_R17 |
| 85 | 85 | ||
| 86 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 86 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 87 | { | 87 | { |
| 88 | start &= ~31; | 88 | start &= ~31; |
| 89 | while (start <= stop) | 89 | while (start <= stop) |
tcg/i386/tcg-target.h
| @@ -58,6 +58,6 @@ enum { | @@ -58,6 +58,6 @@ enum { | ||
| 58 | /* Note: must be synced with dyngen-exec.h */ | 58 | /* Note: must be synced with dyngen-exec.h */ |
| 59 | #define TCG_AREG0 TCG_REG_EBP | 59 | #define TCG_AREG0 TCG_REG_EBP |
| 60 | 60 | ||
| 61 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 61 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 62 | { | 62 | { |
| 63 | } | 63 | } |
tcg/ppc/tcg-target.c
| @@ -1120,11 +1120,11 @@ static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args, | @@ -1120,11 +1120,11 @@ static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args, | ||
| 1120 | tcg_out_bc (s, (BC | BI (7, CR_EQ) | BO_COND_TRUE), label_index); | 1120 | tcg_out_bc (s, (BC | BI (7, CR_EQ) | BO_COND_TRUE), label_index); |
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | -void ppc_tb_set_jmp_target (unsigned long jmp_addr, unsigned long addr) | 1123 | +void ppc_tb_set_jmp_target (uintptr_t jmp_addr, uintptr_t addr) |
| 1124 | { | 1124 | { |
| 1125 | uint32_t *ptr; | 1125 | uint32_t *ptr; |
| 1126 | - long disp = addr - jmp_addr; | ||
| 1127 | - unsigned long patch_size; | 1126 | + intptr_t disp = addr - jmp_addr; |
| 1127 | + uintptr_t patch_size; | ||
| 1128 | 1128 | ||
| 1129 | ptr = (uint32_t *)jmp_addr; | 1129 | ptr = (uint32_t *)jmp_addr; |
| 1130 | 1130 |
tcg/sparc/tcg-target.h
| @@ -103,7 +103,7 @@ enum { | @@ -103,7 +103,7 @@ enum { | ||
| 103 | #define TCG_AREG0 TCG_REG_G6 | 103 | #define TCG_AREG0 TCG_REG_G6 |
| 104 | #endif | 104 | #endif |
| 105 | 105 | ||
| 106 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 106 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 107 | { | 107 | { |
| 108 | unsigned long p; | 108 | unsigned long p; |
| 109 | 109 |
tcg/tcg.c
| @@ -244,8 +244,8 @@ void tcg_context_init(TCGContext *s) | @@ -244,8 +244,8 @@ void tcg_context_init(TCGContext *s) | ||
| 244 | s->code_buf = code_gen_prologue; | 244 | s->code_buf = code_gen_prologue; |
| 245 | s->code_ptr = s->code_buf; | 245 | s->code_ptr = s->code_buf; |
| 246 | tcg_target_qemu_prologue(s); | 246 | tcg_target_qemu_prologue(s); |
| 247 | - flush_icache_range((unsigned long)s->code_buf, | ||
| 248 | - (unsigned long)s->code_ptr); | 247 | + flush_icache_range((uintptr_t)s->code_buf, |
| 248 | + (uintptr_t)s->code_ptr); | ||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | void tcg_set_frame(TCGContext *s, int reg, | 251 | void tcg_set_frame(TCGContext *s, int reg, |
| @@ -2153,7 +2153,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, | @@ -2153,7 +2153,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, | ||
| 2153 | break; | 2153 | break; |
| 2154 | case INDEX_op_set_label: | 2154 | case INDEX_op_set_label: |
| 2155 | tcg_reg_alloc_bb_end(s, s->reserved_regs); | 2155 | tcg_reg_alloc_bb_end(s, s->reserved_regs); |
| 2156 | - tcg_out_label(s, args[0], (long)s->code_ptr); | 2156 | + tcg_out_label(s, args[0], (intptr_t)s->code_ptr); |
| 2157 | break; | 2157 | break; |
| 2158 | case INDEX_op_call: | 2158 | case INDEX_op_call: |
| 2159 | dead_iargs = s->op_dead_iargs[op_index]; | 2159 | dead_iargs = s->op_dead_iargs[op_index]; |
| @@ -2202,8 +2202,8 @@ int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf) | @@ -2202,8 +2202,8 @@ int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf) | ||
| 2202 | tcg_gen_code_common(s, gen_code_buf, -1); | 2202 | tcg_gen_code_common(s, gen_code_buf, -1); |
| 2203 | 2203 | ||
| 2204 | /* flush instruction cache */ | 2204 | /* flush instruction cache */ |
| 2205 | - flush_icache_range((unsigned long)gen_code_buf, | ||
| 2206 | - (unsigned long)s->code_ptr); | 2205 | + flush_icache_range((uintptr_t)gen_code_buf, |
| 2206 | + (uintptr_t)s->code_ptr); | ||
| 2207 | return s->code_ptr - gen_code_buf; | 2207 | return s->code_ptr - gen_code_buf; |
| 2208 | } | 2208 | } |
| 2209 | 2209 |
tcg/tcg.h
| @@ -468,7 +468,7 @@ uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); | @@ -468,7 +468,7 @@ uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); | ||
| 468 | extern uint8_t code_gen_prologue[]; | 468 | extern uint8_t code_gen_prologue[]; |
| 469 | #if defined(_ARCH_PPC) && !defined(_ARCH_PPC64) | 469 | #if defined(_ARCH_PPC) && !defined(_ARCH_PPC64) |
| 470 | #define tcg_qemu_tb_exec(tb_ptr) \ | 470 | #define tcg_qemu_tb_exec(tb_ptr) \ |
| 471 | - ((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr) | 471 | + ((intptr_t REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr) |
| 472 | #else | 472 | #else |
| 473 | -#define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr) | 473 | +#define tcg_qemu_tb_exec(tb_ptr) ((intptr_t REGPARM (*)(void *))code_gen_prologue)(tb_ptr) |
| 474 | #endif | 474 | #endif |
tcg/x86_64/tcg-target.c
| @@ -62,12 +62,19 @@ static const int tcg_target_reg_alloc_order[] = { | @@ -62,12 +62,19 @@ static const int tcg_target_reg_alloc_order[] = { | ||
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | static const int tcg_target_call_iarg_regs[6] = { | 64 | static const int tcg_target_call_iarg_regs[6] = { |
| 65 | +#ifdef _WIN64 | ||
| 66 | + TCG_REG_RCX, | ||
| 67 | + TCG_REG_RDX, | ||
| 68 | + TCG_REG_R8, | ||
| 69 | + TCG_REG_R9, | ||
| 70 | +#else | ||
| 65 | TCG_REG_RDI, | 71 | TCG_REG_RDI, |
| 66 | TCG_REG_RSI, | 72 | TCG_REG_RSI, |
| 67 | TCG_REG_RDX, | 73 | TCG_REG_RDX, |
| 68 | TCG_REG_RCX, | 74 | TCG_REG_RCX, |
| 69 | TCG_REG_R8, | 75 | TCG_REG_R8, |
| 70 | TCG_REG_R9, | 76 | TCG_REG_R9, |
| 77 | +#endif | ||
| 71 | }; | 78 | }; |
| 72 | 79 | ||
| 73 | static const int tcg_target_call_oarg_regs[2] = { | 80 | static const int tcg_target_call_oarg_regs[2] = { |
| @@ -93,7 +100,7 @@ static void patch_reloc(uint8_t *code_ptr, int type, | @@ -93,7 +100,7 @@ static void patch_reloc(uint8_t *code_ptr, int type, | ||
| 93 | *(uint32_t *)code_ptr = value; | 100 | *(uint32_t *)code_ptr = value; |
| 94 | break; | 101 | break; |
| 95 | case R_386_PC32: | 102 | case R_386_PC32: |
| 96 | - value -= (long)code_ptr; | 103 | + value -= (intptr_t)code_ptr; |
| 97 | if (value != (int32_t)value) | 104 | if (value != (int32_t)value) |
| 98 | tcg_abort(); | 105 | tcg_abort(); |
| 99 | *(uint32_t *)code_ptr = value; | 106 | *(uint32_t *)code_ptr = value; |
| @@ -151,8 +158,8 @@ static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str) | @@ -151,8 +158,8 @@ static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str) | ||
| 151 | case 'L': /* qemu_ld/st constraint */ | 158 | case 'L': /* qemu_ld/st constraint */ |
| 152 | ct->ct |= TCG_CT_REG; | 159 | ct->ct |= TCG_CT_REG; |
| 153 | tcg_regset_set32(ct->u.regs, 0, 0xffff); | 160 | tcg_regset_set32(ct->u.regs, 0, 0xffff); |
| 154 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_RSI); | ||
| 155 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_RDI); | 161 | + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[0]); |
| 162 | + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[1]); | ||
| 156 | break; | 163 | break; |
| 157 | case 'e': | 164 | case 'e': |
| 158 | ct->ct |= TCG_CT_CONST_S32; | 165 | ct->ct |= TCG_CT_CONST_S32; |
| @@ -518,8 +525,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, | @@ -518,8 +525,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, | ||
| 518 | mem_index = *args; | 525 | mem_index = *args; |
| 519 | s_bits = opc & 3; | 526 | s_bits = opc & 3; |
| 520 | 527 | ||
| 521 | - r0 = TCG_REG_RDI; | ||
| 522 | - r1 = TCG_REG_RSI; | 528 | + r0 = tcg_target_call_iarg_regs[0]; |
| 529 | + r1 = tcg_target_call_iarg_regs[1]; | ||
| 523 | 530 | ||
| 524 | #if TARGET_LONG_BITS == 32 | 531 | #if TARGET_LONG_BITS == 32 |
| 525 | rexw = 0; | 532 | rexw = 0; |
| @@ -558,7 +565,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, | @@ -558,7 +565,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, | ||
| 558 | s->code_ptr++; | 565 | s->code_ptr++; |
| 559 | 566 | ||
| 560 | /* XXX: move that code at the end of the TB */ | 567 | /* XXX: move that code at the end of the TB */ |
| 561 | - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_RSI, mem_index); | 568 | + tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[1], mem_index); |
| 562 | tcg_out8(s, 0xe8); | 569 | tcg_out8(s, 0xe8); |
| 563 | tcg_out32(s, (tcg_target_long)qemu_ld_helpers[s_bits] - | 570 | tcg_out32(s, (tcg_target_long)qemu_ld_helpers[s_bits] - |
| 564 | (tcg_target_long)s->code_ptr - 4); | 571 | (tcg_target_long)s->code_ptr - 4); |
| @@ -715,8 +722,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, | @@ -715,8 +722,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, | ||
| 715 | 722 | ||
| 716 | s_bits = opc; | 723 | s_bits = opc; |
| 717 | 724 | ||
| 718 | - r0 = TCG_REG_RDI; | ||
| 719 | - r1 = TCG_REG_RSI; | 725 | + r0 = tcg_target_call_iarg_regs[0]; |
| 726 | + r1 = tcg_target_call_iarg_regs[1]; | ||
| 720 | 727 | ||
| 721 | #if TARGET_LONG_BITS == 32 | 728 | #if TARGET_LONG_BITS == 32 |
| 722 | rexw = 0; | 729 | rexw = 0; |
| @@ -758,22 +765,22 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, | @@ -758,22 +765,22 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, | ||
| 758 | switch(opc) { | 765 | switch(opc) { |
| 759 | case 0: | 766 | case 0: |
| 760 | /* movzbl */ | 767 | /* movzbl */ |
| 761 | - tcg_out_modrm(s, 0xb6 | P_EXT | P_REXB, TCG_REG_RSI, data_reg); | 768 | + tcg_out_modrm(s, 0xb6 | P_EXT | P_REXB, r1, data_reg); |
| 762 | break; | 769 | break; |
| 763 | case 1: | 770 | case 1: |
| 764 | /* movzwl */ | 771 | /* movzwl */ |
| 765 | - tcg_out_modrm(s, 0xb7 | P_EXT, TCG_REG_RSI, data_reg); | 772 | + tcg_out_modrm(s, 0xb7 | P_EXT, r1, data_reg); |
| 766 | break; | 773 | break; |
| 767 | case 2: | 774 | case 2: |
| 768 | /* movl */ | 775 | /* movl */ |
| 769 | - tcg_out_modrm(s, 0x8b, TCG_REG_RSI, data_reg); | 776 | + tcg_out_modrm(s, 0x8b, r1, data_reg); |
| 770 | break; | 777 | break; |
| 771 | default: | 778 | default: |
| 772 | case 3: | 779 | case 3: |
| 773 | - tcg_out_mov(s, TCG_REG_RSI, data_reg); | 780 | + tcg_out_mov(s, TCG_REG_RDX, data_reg); |
| 774 | break; | 781 | break; |
| 775 | } | 782 | } |
| 776 | - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_RDX, mem_index); | 783 | + tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[2], mem_index); |
| 777 | tcg_out8(s, 0xe8); | 784 | tcg_out8(s, 0xe8); |
| 778 | tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - | 785 | tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - |
| 779 | (tcg_target_long)s->code_ptr - 4); | 786 | (tcg_target_long)s->code_ptr - 4); |
| @@ -1211,6 +1218,10 @@ static int tcg_target_callee_save_regs[] = { | @@ -1211,6 +1218,10 @@ static int tcg_target_callee_save_regs[] = { | ||
| 1211 | /* TCG_REG_R14, */ /* currently used for the global env, so no | 1218 | /* TCG_REG_R14, */ /* currently used for the global env, so no |
| 1212 | need to save */ | 1219 | need to save */ |
| 1213 | TCG_REG_R15, | 1220 | TCG_REG_R15, |
| 1221 | +#ifdef _WIN64 | ||
| 1222 | + TCG_REG_RDI, | ||
| 1223 | + TCG_REG_RSI, | ||
| 1224 | +#endif | ||
| 1214 | }; | 1225 | }; |
| 1215 | 1226 | ||
| 1216 | static inline void tcg_out_push(TCGContext *s, int reg) | 1227 | static inline void tcg_out_push(TCGContext *s, int reg) |
| @@ -1242,7 +1253,7 @@ void tcg_target_qemu_prologue(TCGContext *s) | @@ -1242,7 +1253,7 @@ void tcg_target_qemu_prologue(TCGContext *s) | ||
| 1242 | stack_addend = frame_size - push_size; | 1253 | stack_addend = frame_size - push_size; |
| 1243 | tcg_out_addi(s, TCG_REG_RSP, -stack_addend); | 1254 | tcg_out_addi(s, TCG_REG_RSP, -stack_addend); |
| 1244 | 1255 | ||
| 1245 | - tcg_out_modrm(s, 0xff, 4, TCG_REG_RDI); /* jmp *%rdi */ | 1256 | + tcg_out_modrm(s, 0xff, 4, tcg_target_call_iarg_regs[0]); /* jmp *%rdi */ |
| 1246 | 1257 | ||
| 1247 | /* TB epilogue */ | 1258 | /* TB epilogue */ |
| 1248 | tb_ret_addr = s->code_ptr; | 1259 | tb_ret_addr = s->code_ptr; |
| @@ -1362,8 +1373,10 @@ void tcg_target_init(TCGContext *s) | @@ -1362,8 +1373,10 @@ void tcg_target_init(TCGContext *s) | ||
| 1362 | tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff); | 1373 | tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff); |
| 1363 | tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffff); | 1374 | tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffff); |
| 1364 | tcg_regset_set32(tcg_target_call_clobber_regs, 0, | 1375 | tcg_regset_set32(tcg_target_call_clobber_regs, 0, |
| 1365 | - (1 << TCG_REG_RDI) | | ||
| 1366 | - (1 << TCG_REG_RSI) | | 1376 | +#ifndef _WIN64 |
| 1377 | + (1 << TCG_REG_RDI) | | ||
| 1378 | + (1 << TCG_REG_RSI) | | ||
| 1379 | +#endif | ||
| 1367 | (1 << TCG_REG_RDX) | | 1380 | (1 << TCG_REG_RDX) | |
| 1368 | (1 << TCG_REG_RCX) | | 1381 | (1 << TCG_REG_RCX) | |
| 1369 | (1 << TCG_REG_R8) | | 1382 | (1 << TCG_REG_R8) | |
tcg/x86_64/tcg-target.h
| @@ -78,6 +78,6 @@ enum { | @@ -78,6 +78,6 @@ enum { | ||
| 78 | /* Note: must be synced with dyngen-exec.h */ | 78 | /* Note: must be synced with dyngen-exec.h */ |
| 79 | #define TCG_AREG0 TCG_REG_R14 | 79 | #define TCG_AREG0 TCG_REG_R14 |
| 80 | 80 | ||
| 81 | -static inline void flush_icache_range(unsigned long start, unsigned long stop) | 81 | +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) |
| 82 | { | 82 | { |
| 83 | } | 83 | } |
translate-all.c
| @@ -49,9 +49,9 @@ uint32_t gen_opc_hflags[OPC_BUF_SIZE]; | @@ -49,9 +49,9 @@ uint32_t gen_opc_hflags[OPC_BUF_SIZE]; | ||
| 49 | #endif | 49 | #endif |
| 50 | 50 | ||
| 51 | /* XXX: suppress that */ | 51 | /* XXX: suppress that */ |
| 52 | -unsigned long code_gen_max_block_size(void) | 52 | +uintptr_t code_gen_max_block_size(void) |
| 53 | { | 53 | { |
| 54 | - static unsigned long max; | 54 | + static uintptr_t max; |
| 55 | 55 | ||
| 56 | if (max == 0) { | 56 | if (max == 0) { |
| 57 | max = TCG_MAX_OP_SIZE; | 57 | max = TCG_MAX_OP_SIZE; |
| @@ -135,12 +135,12 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) | @@ -135,12 +135,12 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) | ||
| 135 | /* The cpu state corresponding to 'searched_pc' is restored. | 135 | /* The cpu state corresponding to 'searched_pc' is restored. |
| 136 | */ | 136 | */ |
| 137 | int cpu_restore_state(TranslationBlock *tb, | 137 | int cpu_restore_state(TranslationBlock *tb, |
| 138 | - CPUState *env, unsigned long searched_pc, | 138 | + CPUState *env, uintptr_t searched_pc, |
| 139 | void *puc) | 139 | void *puc) |
| 140 | { | 140 | { |
| 141 | TCGContext *s = &tcg_ctx; | 141 | TCGContext *s = &tcg_ctx; |
| 142 | int j; | 142 | int j; |
| 143 | - unsigned long tc_ptr; | 143 | + uintptr_t tc_ptr; |
| 144 | #ifdef CONFIG_PROFILER | 144 | #ifdef CONFIG_PROFILER |
| 145 | int64_t ti; | 145 | int64_t ti; |
| 146 | #endif | 146 | #endif |
| @@ -160,7 +160,7 @@ int cpu_restore_state(TranslationBlock *tb, | @@ -160,7 +160,7 @@ int cpu_restore_state(TranslationBlock *tb, | ||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | /* find opc index corresponding to search_pc */ | 162 | /* find opc index corresponding to search_pc */ |
| 163 | - tc_ptr = (unsigned long)tb->tc_ptr; | 163 | + tc_ptr = (uintptr_t)tb->tc_ptr; |
| 164 | if (searched_pc < tc_ptr) | 164 | if (searched_pc < tc_ptr) |
| 165 | return -1; | 165 | return -1; |
| 166 | 166 |
vl.c
| @@ -1455,7 +1455,7 @@ static int win32_start_timer(struct qemu_alarm_timer *t) | @@ -1455,7 +1455,7 @@ static int win32_start_timer(struct qemu_alarm_timer *t) | ||
| 1455 | data->timerId = timeSetEvent(1, // interval (ms) | 1455 | data->timerId = timeSetEvent(1, // interval (ms) |
| 1456 | data->period, // resolution | 1456 | data->period, // resolution |
| 1457 | host_alarm_handler, // function | 1457 | host_alarm_handler, // function |
| 1458 | - (DWORD)t, // parameter | 1458 | + (DWORD_PTR)t, // parameter |
| 1459 | flags); | 1459 | flags); |
| 1460 | 1460 | ||
| 1461 | if (!data->timerId) { | 1461 | if (!data->timerId) { |
| @@ -1492,7 +1492,7 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t) | @@ -1492,7 +1492,7 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t) | ||
| 1492 | data->timerId = timeSetEvent(1, | 1492 | data->timerId = timeSetEvent(1, |
| 1493 | data->period, | 1493 | data->period, |
| 1494 | host_alarm_handler, | 1494 | host_alarm_handler, |
| 1495 | - (DWORD)t, | 1495 | + (DWORD_PTR)t, |
| 1496 | TIME_ONESHOT | TIME_PERIODIC); | 1496 | TIME_ONESHOT | TIME_PERIODIC); |
| 1497 | 1497 | ||
| 1498 | if (!data->timerId) { | 1498 | if (!data->timerId) { |
| @@ -4607,17 +4607,38 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type) | @@ -4607,17 +4607,38 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type) | ||
| 4607 | 4607 | ||
| 4608 | int qemu_uuid_parse(const char *str, uint8_t *uuid) | 4608 | int qemu_uuid_parse(const char *str, uint8_t *uuid) |
| 4609 | { | 4609 | { |
| 4610 | - int ret; | 4610 | + int pos = 0; |
| 4611 | + uint8_t *uuid_ptr = uuid; | ||
| 4611 | 4612 | ||
| 4612 | - if(strlen(str) != 36) | 4613 | + if(strlen(str) != 36) { |
| 4613 | return -1; | 4614 | return -1; |
| 4615 | + } | ||
| 4614 | 4616 | ||
| 4615 | - ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3], | ||
| 4616 | - &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9], | ||
| 4617 | - &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14], &uuid[15]); | ||
| 4618 | - | ||
| 4619 | - if(ret != 16) | ||
| 4620 | - return -1; | 4617 | + while (pos < 36) { |
| 4618 | + if (pos == 8 || pos == 13 || pos == 18 || pos == 23) { | ||
| 4619 | + if (str[pos] != '-') { | ||
| 4620 | + return -1; | ||
| 4621 | + } | ||
| 4622 | + pos++; | ||
| 4623 | + } else { | ||
| 4624 | + if (str[pos] >= '0' && str[pos] <= '9') { | ||
| 4625 | + *uuid_ptr = (str[pos] - '0') << 4; | ||
| 4626 | + } else if (str[pos] >= 'a' && str[pos] <= 'f') { | ||
| 4627 | + *uuid_ptr = (str[pos] - 'a' + 0xa) << 4; | ||
| 4628 | + } else if (str[pos] >= 'A' && str[pos] <= 'F') { | ||
| 4629 | + *uuid_ptr = (str[pos] - 'A' + 0xa) << 4; | ||
| 4630 | + } | ||
| 4631 | + pos++; | ||
| 4632 | + if (str[pos] >= '0' && str[pos] <= '9') { | ||
| 4633 | + *uuid_ptr += str[pos] - '0'; | ||
| 4634 | + } else if (str[pos] >= 'a' && str[pos] <= 'f') { | ||
| 4635 | + *uuid_ptr += str[pos] - 'a' + 0xa; | ||
| 4636 | + } else if (str[pos] >= 'A' && str[pos] <= 'F') { | ||
| 4637 | + *uuid_ptr += str[pos] - 'A' + 0xa; | ||
| 4638 | + } | ||
| 4639 | + pos++; | ||
| 4640 | + } | ||
| 4641 | + } | ||
| 4621 | 4642 | ||
| 4622 | #ifdef TARGET_I386 | 4643 | #ifdef TARGET_I386 |
| 4623 | smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); | 4644 | smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); |
| @@ -4887,7 +4908,7 @@ int main(int argc, char **argv, char **envp) | @@ -4887,7 +4908,7 @@ int main(int argc, char **argv, char **envp) | ||
| 4887 | QEMU to run on a single CPU */ | 4908 | QEMU to run on a single CPU */ |
| 4888 | { | 4909 | { |
| 4889 | HANDLE h; | 4910 | HANDLE h; |
| 4890 | - DWORD mask, smask; | 4911 | + DWORD_PTR mask, smask; |
| 4891 | int i; | 4912 | int i; |
| 4892 | h = GetCurrentProcess(); | 4913 | h = GetCurrentProcess(); |
| 4893 | if (GetProcessAffinityMask(h, &mask, &smask)) { | 4914 | if (GetProcessAffinityMask(h, &mask, &smask)) { |