Commit 9bd54a4a6723d6b0ab25bb7a3e751d05a6a80d00

Authored by Filip Navara
1 parent ae00aafe

More unsigned long -> uintptr_t fixes.

cpu-exec.c
... ... @@ -781,7 +781,7 @@ void cpu_x86_frstor(CPUX86State *s, target_ulong ptr, int data32)
781 781 the effective address of the memory exception. 'is_write' is 1 if a
782 782 write caused the exception and otherwise 0'. 'old_set' is the
783 783 signal set which should be restored */
784   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  784 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
785 785 int is_write, sigset_t *old_set,
786 786 void *puc)
787 787 {
... ... @@ -831,7 +831,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
831 831 }
832 832  
833 833 #elif defined(TARGET_ARM)
834   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  834 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
835 835 int is_write, sigset_t *old_set,
836 836 void *puc)
837 837 {
... ... @@ -869,7 +869,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
869 869 return 1;
870 870 }
871 871 #elif defined(TARGET_SPARC)
872   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  872 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
873 873 int is_write, sigset_t *old_set,
874 874 void *puc)
875 875 {
... ... @@ -907,7 +907,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
907 907 return 1;
908 908 }
909 909 #elif defined (TARGET_PPC)
910   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  910 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
911 911 int is_write, sigset_t *old_set,
912 912 void *puc)
913 913 {
... ... @@ -957,7 +957,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
957 957 }
958 958  
959 959 #elif defined(TARGET_M68K)
960   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  960 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
961 961 int is_write, sigset_t *old_set,
962 962 void *puc)
963 963 {
... ... @@ -996,7 +996,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
996 996 }
997 997  
998 998 #elif defined (TARGET_MIPS)
999   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  999 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
1000 1000 int is_write, sigset_t *old_set,
1001 1001 void *puc)
1002 1002 {
... ... @@ -1046,7 +1046,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
1046 1046 }
1047 1047  
1048 1048 #elif defined (TARGET_MICROBLAZE)
1049   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  1049 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
1050 1050 int is_write, sigset_t *old_set,
1051 1051 void *puc)
1052 1052 {
... ... @@ -1096,7 +1096,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
1096 1096 }
1097 1097  
1098 1098 #elif defined (TARGET_SH4)
1099   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  1099 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
1100 1100 int is_write, sigset_t *old_set,
1101 1101 void *puc)
1102 1102 {
... ... @@ -1141,7 +1141,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
1141 1141 }
1142 1142  
1143 1143 #elif defined (TARGET_ALPHA)
1144   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  1144 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
1145 1145 int is_write, sigset_t *old_set,
1146 1146 void *puc)
1147 1147 {
... ... @@ -1185,7 +1185,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
1185 1185 return 1;
1186 1186 }
1187 1187 #elif defined (TARGET_CRIS)
1188   -static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
  1188 +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address,
1189 1189 int is_write, sigset_t *old_set,
1190 1190 void *puc)
1191 1191 {
... ... @@ -1234,7 +1234,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
1234 1234 #if defined(__APPLE__)
1235 1235 # include <sys/ucontext.h>
1236 1236  
1237   -# define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip))
  1237 +# define EIP_sig(context) (*((uintptr_t*)&(context)->uc_mcontext->ss.eip))
1238 1238 # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno)
1239 1239 # define ERROR_sig(context) ((context)->uc_mcontext->es.err)
1240 1240 # define MASK_sig(context) ((context)->uc_sigmask)
... ... @@ -1259,7 +1259,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1259 1259 #else
1260 1260 struct ucontext *uc = puc;
1261 1261 #endif
1262   - unsigned long pc;
  1262 + uintptr_t pc;
1263 1263 int trapno;
1264 1264  
1265 1265 #ifndef REG_EIP
... ... @@ -1270,7 +1270,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1270 1270 #endif
1271 1271 pc = EIP_sig(uc);
1272 1272 trapno = TRAP_sig(uc);
1273   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1273 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1274 1274 trapno == 0xe ?
1275 1275 (ERROR_sig(uc) >> 1) & 1 : 0,
1276 1276 &MASK_sig(uc), puc);
... ... @@ -1299,7 +1299,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1299 1299 void *puc)
1300 1300 {
1301 1301 siginfo_t *info = pinfo;
1302   - unsigned long pc;
  1302 + uintptr_t pc;
1303 1303 #ifdef __NetBSD__
1304 1304 ucontext_t *uc = puc;
1305 1305 #elif defined(__OpenBSD__)
... ... @@ -1309,7 +1309,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1309 1309 #endif
1310 1310  
1311 1311 pc = PC_sig(uc);
1312   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1312 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1313 1313 TRAP_sig(uc) == 0xe ?
1314 1314 (ERROR_sig(uc) >> 1) & 1 : 0,
1315 1315 &MASK_sig(uc), puc);
... ... @@ -1384,7 +1384,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1384 1384 if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000))
1385 1385 is_write = 1;
1386 1386 #endif
1387   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1387 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1388 1388 is_write, &uc->uc_sigmask, puc);
1389 1389 }
1390 1390  
... ... @@ -1415,7 +1415,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1415 1415 is_write = 1;
1416 1416 }
1417 1417  
1418   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1418 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1419 1419 is_write, &uc->uc_sigmask, puc);
1420 1420 }
1421 1421 #elif defined(__sparc__)
... ... @@ -1430,15 +1430,15 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1430 1430 uint32_t *regs = (uint32_t *)(info + 1);
1431 1431 void *sigmask = (regs + 20);
1432 1432 /* XXX: is there a standard glibc define ? */
1433   - unsigned long pc = regs[1];
  1433 + uintptr_t pc = regs[1];
1434 1434 #else
1435 1435 #ifdef __linux__
1436 1436 struct sigcontext *sc = puc;
1437   - unsigned long pc = sc->sigc_regs.tpc;
  1437 + uintptr_t pc = sc->sigc_regs.tpc;
1438 1438 void *sigmask = (void *)sc->sigc_mask;
1439 1439 #elif defined(__OpenBSD__)
1440 1440 struct sigcontext *uc = puc;
1441   - unsigned long pc = uc->sc_pc;
  1441 + uintptr_t pc = uc->sc_pc;
1442 1442 void *sigmask = (void *)(long)uc->sc_mask;
1443 1443 #endif
1444 1444 #endif
... ... @@ -1471,7 +1471,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1471 1471 break;
1472 1472 }
1473 1473 }
1474   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1474 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1475 1475 is_write, sigmask, NULL);
1476 1476 }
1477 1477  
... ... @@ -1482,7 +1482,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1482 1482 {
1483 1483 siginfo_t *info = pinfo;
1484 1484 struct ucontext *uc = puc;
1485   - unsigned long pc;
  1485 + uintptr_t pc;
1486 1486 int is_write;
1487 1487  
1488 1488 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
... ... @@ -1492,7 +1492,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1492 1492 #endif
1493 1493 /* XXX: compute is_write */
1494 1494 is_write = 0;
1495   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1495 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1496 1496 is_write,
1497 1497 &uc->uc_sigmask, puc);
1498 1498 }
... ... @@ -1504,13 +1504,13 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1504 1504 {
1505 1505 siginfo_t *info = pinfo;
1506 1506 struct ucontext *uc = puc;
1507   - unsigned long pc;
  1507 + uintptr_t pc;
1508 1508 int is_write;
1509 1509  
1510 1510 pc = uc->uc_mcontext.gregs[16];
1511 1511 /* XXX: compute is_write */
1512 1512 is_write = 0;
1513   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1513 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1514 1514 is_write,
1515 1515 &uc->uc_sigmask, puc);
1516 1516 }
... ... @@ -1526,7 +1526,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
1526 1526 {
1527 1527 siginfo_t *info = pinfo;
1528 1528 struct ucontext *uc = puc;
1529   - unsigned long ip;
  1529 + uintptr_t ip;
1530 1530 int is_write = 0;
1531 1531  
1532 1532 ip = uc->uc_mcontext.sc_ip;
... ... @@ -1544,7 +1544,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
1544 1544 default:
1545 1545 break;
1546 1546 }
1547   - return handle_cpu_signal(ip, (unsigned long)info->si_addr,
  1547 + return handle_cpu_signal(ip, (uintptr_t)info->si_addr,
1548 1548 is_write,
1549 1549 &uc->uc_sigmask, puc);
1550 1550 }
... ... @@ -1556,13 +1556,13 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1556 1556 {
1557 1557 siginfo_t *info = pinfo;
1558 1558 struct ucontext *uc = puc;
1559   - unsigned long pc;
  1559 + uintptr_t pc;
1560 1560 int is_write;
1561 1561  
1562 1562 pc = uc->uc_mcontext.psw.addr;
1563 1563 /* XXX: compute is_write */
1564 1564 is_write = 0;
1565   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1565 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1566 1566 is_write, &uc->uc_sigmask, puc);
1567 1567 }
1568 1568  
... ... @@ -1578,7 +1578,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1578 1578  
1579 1579 /* XXX: compute is_write */
1580 1580 is_write = 0;
1581   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1581 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1582 1582 is_write, &uc->uc_sigmask, puc);
1583 1583 }
1584 1584  
... ... @@ -1589,13 +1589,13 @@ int cpu_signal_handler(int host_signum, void *pinfo,
1589 1589 {
1590 1590 struct siginfo *info = pinfo;
1591 1591 struct ucontext *uc = puc;
1592   - unsigned long pc;
  1592 + uintptr_t pc;
1593 1593 int is_write;
1594 1594  
1595 1595 pc = uc->uc_mcontext.sc_iaoq[0];
1596 1596 /* FIXME: compute is_write */
1597 1597 is_write = 0;
1598   - return handle_cpu_signal(pc, (unsigned long)info->si_addr,
  1598 + return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
1599 1599 is_write,
1600 1600 &uc->uc_sigmask, puc);
1601 1601 }
... ...
target-mips/op_helper.c
... ... @@ -57,7 +57,7 @@ void helper_interrupt_restart (void)
57 57 static void do_restore_state (void *pc_ptr)
58 58 {
59 59 TranslationBlock *tb;
60   - unsigned long pc = (unsigned long) pc_ptr;
  60 + uintptr_t pc = (uintptr_t) pc_ptr;
61 61  
62 62 tb = tb_find_pc (pc);
63 63 if (tb) {
... ...
target-sparc/op_helper.c
... ... @@ -3612,7 +3612,7 @@ static void cpu_restore_state2(void *retaddr)
3612 3612  
3613 3613 if (retaddr) {
3614 3614 /* now we have a real cpu fault */
3615   - pc = (unsigned long)retaddr;
  3615 + pc = (uintptr_t)retaddr;
3616 3616 tb = tb_find_pc(pc);
3617 3617 if (tb) {
3618 3618 /* the PC is inside the translated code. It means that we have
... ...
targphys.h
... ... @@ -6,7 +6,7 @@
6 6 #ifdef TARGET_PHYS_ADDR_BITS
7 7 /* target_phys_addr_t is the type of a physical address (its size can
8 8 be different from 'target_ulong'). We have sizeof(target_phys_addr)
9   - = max(sizeof(unsigned long),
  9 + = max(sizeof(uintptr_t),
10 10 sizeof(size_of_target_physical_address)) because we must pass a
11 11 host pointer to memory operations in some cases */
12 12  
... ...