Commit 1455bf488f6c7751961d583df81d9f054dabe07d
1 parent
6f12a2a6
64 bit compilation fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3622 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
20 additions
and
17 deletions
linux-user/vm86.c
... | ... | @@ -39,22 +39,27 @@ static inline int is_revectored(int nr, struct target_revectored_struct *bitmap) |
39 | 39 | return (((uint8_t *)bitmap)[nr >> 3] >> (nr & 7)) & 1; |
40 | 40 | } |
41 | 41 | |
42 | -static inline void vm_putw(uint8_t *segptr, unsigned int reg16, unsigned int val) | |
42 | +static inline void vm_putw(uint32_t segptr, unsigned int reg16, unsigned int val) | |
43 | 43 | { |
44 | 44 | stw(segptr + (reg16 & 0xffff), val); |
45 | 45 | } |
46 | 46 | |
47 | -static inline void vm_putl(uint8_t *segptr, unsigned int reg16, unsigned int val) | |
47 | +static inline void vm_putl(uint32_t segptr, unsigned int reg16, unsigned int val) | |
48 | 48 | { |
49 | 49 | stl(segptr + (reg16 & 0xffff), val); |
50 | 50 | } |
51 | 51 | |
52 | -static inline unsigned int vm_getw(uint8_t *segptr, unsigned int reg16) | |
52 | +static inline unsigned int vm_getb(uint32_t segptr, unsigned int reg16) | |
53 | +{ | |
54 | + return ldub(segptr + (reg16 & 0xffff)); | |
55 | +} | |
56 | + | |
57 | +static inline unsigned int vm_getw(uint32_t segptr, unsigned int reg16) | |
53 | 58 | { |
54 | 59 | return lduw(segptr + (reg16 & 0xffff)); |
55 | 60 | } |
56 | 61 | |
57 | -static inline unsigned int vm_getl(uint8_t *segptr, unsigned int reg16) | |
62 | +static inline unsigned int vm_getl(uint32_t segptr, unsigned int reg16) | |
58 | 63 | { |
59 | 64 | return ldl(segptr + (reg16 & 0xffff)); |
60 | 65 | } |
... | ... | @@ -196,8 +201,7 @@ static inline unsigned int get_vflags(CPUX86State *env) |
196 | 201 | static void do_int(CPUX86State *env, int intno) |
197 | 202 | { |
198 | 203 | TaskState *ts = env->opaque; |
199 | - uint32_t *int_ptr, segoffs; | |
200 | - uint8_t *ssp; | |
204 | + uint32_t int_addr, segoffs, ssp; | |
201 | 205 | unsigned int sp; |
202 | 206 | |
203 | 207 | if (env->segs[R_CS].selector == TARGET_BIOSSEG) |
... | ... | @@ -207,8 +211,8 @@ static void do_int(CPUX86State *env, int intno) |
207 | 211 | if (intno == 0x21 && is_revectored((env->regs[R_EAX] >> 8) & 0xff, |
208 | 212 | &ts->vm86plus.int21_revectored)) |
209 | 213 | goto cannot_handle; |
210 | - int_ptr = (uint32_t *)(intno << 2); | |
211 | - segoffs = tswap32(*int_ptr); | |
214 | + int_addr = (intno << 2); | |
215 | + segoffs = ldl(int_addr); | |
212 | 216 | if ((segoffs >> 16) == TARGET_BIOSSEG) |
213 | 217 | goto cannot_handle; |
214 | 218 | #if defined(DEBUG_VM86) |
... | ... | @@ -216,7 +220,7 @@ static void do_int(CPUX86State *env, int intno) |
216 | 220 | intno, segoffs >> 16, segoffs & 0xffff); |
217 | 221 | #endif |
218 | 222 | /* save old state */ |
219 | - ssp = (uint8_t *)(env->segs[R_SS].selector << 4); | |
223 | + ssp = env->segs[R_SS].selector << 4; | |
220 | 224 | sp = env->regs[R_ESP] & 0xffff; |
221 | 225 | vm_putw(ssp, sp - 2, get_vflags(env)); |
222 | 226 | vm_putw(ssp, sp - 4, env->segs[R_CS].selector); |
... | ... | @@ -259,26 +263,25 @@ void handle_vm86_trap(CPUX86State *env, int trapno) |
259 | 263 | void handle_vm86_fault(CPUX86State *env) |
260 | 264 | { |
261 | 265 | TaskState *ts = env->opaque; |
262 | - uint8_t *csp, *pc, *ssp; | |
266 | + uint32_t csp, ssp; | |
263 | 267 | unsigned int ip, sp, newflags, newip, newcs, opcode, intno; |
264 | 268 | int data32, pref_done; |
265 | 269 | |
266 | - csp = (uint8_t *)(env->segs[R_CS].selector << 4); | |
270 | + csp = env->segs[R_CS].selector << 4; | |
267 | 271 | ip = env->eip & 0xffff; |
268 | - pc = csp + ip; | |
269 | 272 | |
270 | - ssp = (uint8_t *)(env->segs[R_SS].selector << 4); | |
273 | + ssp = env->segs[R_SS].selector << 4; | |
271 | 274 | sp = env->regs[R_ESP] & 0xffff; |
272 | 275 | |
273 | 276 | #if defined(DEBUG_VM86) |
274 | - fprintf(logfile, "VM86 exception %04x:%08x %02x %02x\n", | |
275 | - env->segs[R_CS].selector, env->eip, pc[0], pc[1]); | |
277 | + fprintf(logfile, "VM86 exception %04x:%08x\n", | |
278 | + env->segs[R_CS].selector, env->eip); | |
276 | 279 | #endif |
277 | 280 | |
278 | 281 | data32 = 0; |
279 | 282 | pref_done = 0; |
280 | 283 | do { |
281 | - opcode = csp[ip]; | |
284 | + opcode = vm_getb(csp, ip); | |
282 | 285 | ADD16(ip, 1); |
283 | 286 | switch (opcode) { |
284 | 287 | case 0x66: /* 32-bit data */ data32=1; break; |
... | ... | @@ -328,7 +331,7 @@ void handle_vm86_fault(CPUX86State *env) |
328 | 331 | VM86_FAULT_RETURN; |
329 | 332 | |
330 | 333 | case 0xcd: /* int */ |
331 | - intno = csp[ip]; | |
334 | + intno = vm_getb(csp, ip); | |
332 | 335 | ADD16(ip, 1); |
333 | 336 | env->eip = ip; |
334 | 337 | if (ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_active) { | ... | ... |