Commit 5a7b542bbd6d79a049b4a1ab5fe3e284fac46e9a

Authored by ths
1 parent fd677642

siginfo fix for Darwin/Mac OS X, by Pierre d'Herbemont.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2369 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
@@ -1280,9 +1280,10 @@ static void cpu_send_trap(unsigned long pc, int trap, @@ -1280,9 +1280,10 @@ static void cpu_send_trap(unsigned long pc, int trap,
1280 } 1280 }
1281 #endif 1281 #endif
1282 1282
1283 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1283 +int cpu_signal_handler(int host_signum, void *pinfo,
1284 void *puc) 1284 void *puc)
1285 { 1285 {
  1286 + siginfo_t *info = pinfo;
1286 struct ucontext *uc = puc; 1287 struct ucontext *uc = puc;
1287 unsigned long pc; 1288 unsigned long pc;
1288 int trapno; 1289 int trapno;
@@ -1310,9 +1311,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1310,9 +1311,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1310 1311
1311 #elif defined(__x86_64__) 1312 #elif defined(__x86_64__)
1312 1313
1313 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1314 +int cpu_signal_handler(int host_signum, void *pinfo,
1314 void *puc) 1315 void *puc)
1315 { 1316 {
  1317 + siginfo_t *info = pinfo;
1316 struct ucontext *uc = puc; 1318 struct ucontext *uc = puc;
1317 unsigned long pc; 1319 unsigned long pc;
1318 1320
@@ -1374,9 +1376,10 @@ typedef struct ucontext SIGCONTEXT; @@ -1374,9 +1376,10 @@ typedef struct ucontext SIGCONTEXT;
1374 # define TRAP_sig(context) EXCEPREG_sig(exception, context) /* number of powerpc exception taken */ 1376 # define TRAP_sig(context) EXCEPREG_sig(exception, context) /* number of powerpc exception taken */
1375 #endif /* __APPLE__ */ 1377 #endif /* __APPLE__ */
1376 1378
1377 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1379 +int cpu_signal_handler(int host_signum, void *pinfo,
1378 void *puc) 1380 void *puc)
1379 { 1381 {
  1382 + siginfo_t *info = pinfo;
1380 struct ucontext *uc = puc; 1383 struct ucontext *uc = puc;
1381 unsigned long pc; 1384 unsigned long pc;
1382 int is_write; 1385 int is_write;
@@ -1397,9 +1400,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1397,9 +1400,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1397 1400
1398 #elif defined(__alpha__) 1401 #elif defined(__alpha__)
1399 1402
1400 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1403 +int cpu_signal_handler(int host_signum, void *pinfo,
1401 void *puc) 1404 void *puc)
1402 { 1405 {
  1406 + siginfo_t *info = pinfo;
1403 struct ucontext *uc = puc; 1407 struct ucontext *uc = puc;
1404 uint32_t *pc = uc->uc_mcontext.sc_pc; 1408 uint32_t *pc = uc->uc_mcontext.sc_pc;
1405 uint32_t insn = *pc; 1409 uint32_t insn = *pc;
@@ -1426,9 +1430,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1426,9 +1430,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1426 } 1430 }
1427 #elif defined(__sparc__) 1431 #elif defined(__sparc__)
1428 1432
1429 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1433 +int cpu_signal_handler(int host_signum, void *pinfo,
1430 void *puc) 1434 void *puc)
1431 { 1435 {
  1436 + siginfo_t *info = pinfo;
1432 uint32_t *regs = (uint32_t *)(info + 1); 1437 uint32_t *regs = (uint32_t *)(info + 1);
1433 void *sigmask = (regs + 20); 1438 void *sigmask = (regs + 20);
1434 unsigned long pc; 1439 unsigned long pc;
@@ -1459,9 +1464,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1459,9 +1464,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1459 1464
1460 #elif defined(__arm__) 1465 #elif defined(__arm__)
1461 1466
1462 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1467 +int cpu_signal_handler(int host_signum, void *pinfo,
1463 void *puc) 1468 void *puc)
1464 { 1469 {
  1470 + siginfo_t *info = pinfo;
1465 struct ucontext *uc = puc; 1471 struct ucontext *uc = puc;
1466 unsigned long pc; 1472 unsigned long pc;
1467 int is_write; 1473 int is_write;
@@ -1476,9 +1482,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1476,9 +1482,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1476 1482
1477 #elif defined(__mc68000) 1483 #elif defined(__mc68000)
1478 1484
1479 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1485 +int cpu_signal_handler(int host_signum, void *pinfo,
1480 void *puc) 1486 void *puc)
1481 { 1487 {
  1488 + siginfo_t *info = pinfo;
1482 struct ucontext *uc = puc; 1489 struct ucontext *uc = puc;
1483 unsigned long pc; 1490 unsigned long pc;
1484 int is_write; 1491 int is_write;
@@ -1498,8 +1505,9 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, @@ -1498,8 +1505,9 @@ int cpu_signal_handler(int host_signum, struct siginfo *info,
1498 # define __ISR_VALID 1 1505 # define __ISR_VALID 1
1499 #endif 1506 #endif
1500 1507
1501 -int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc) 1508 +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
1502 { 1509 {
  1510 + siginfo_t *info = pinfo;
1503 struct ucontext *uc = puc; 1511 struct ucontext *uc = puc;
1504 unsigned long ip; 1512 unsigned long ip;
1505 int is_write = 0; 1513 int is_write = 0;
@@ -1526,9 +1534,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc) @@ -1526,9 +1534,10 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc)
1526 1534
1527 #elif defined(__s390__) 1535 #elif defined(__s390__)
1528 1536
1529 -int cpu_signal_handler(int host_signum, struct siginfo *info, 1537 +int cpu_signal_handler(int host_signum, void *pinfo,
1530 void *puc) 1538 void *puc)
1531 { 1539 {
  1540 + siginfo_t *info = pinfo;
1532 struct ucontext *uc = puc; 1541 struct ucontext *uc = puc;
1533 unsigned long pc; 1542 unsigned long pc;
1534 int is_write; 1543 int is_write;
target-arm/cpu.h
@@ -133,8 +133,7 @@ void switch_mode(CPUARMState *, int); @@ -133,8 +133,7 @@ void switch_mode(CPUARMState *, int);
133 /* you can call this signal handler from your SIGBUS and SIGSEGV 133 /* you can call this signal handler from your SIGBUS and SIGSEGV
134 signal handlers to inform the virtual CPU of exceptions. non zero 134 signal handlers to inform the virtual CPU of exceptions. non zero
135 is returned if the signal was handled by the virtual CPU. */ 135 is returned if the signal was handled by the virtual CPU. */
136 -struct siginfo;  
137 -int cpu_arm_signal_handler(int host_signum, struct siginfo *info, 136 +int cpu_arm_signal_handler(int host_signum, void *pinfo,
138 void *puc); 137 void *puc);
139 138
140 #define CPSR_M (0x1f) 139 #define CPSR_M (0x1f)
target-i386/cpu.h
@@ -628,8 +628,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32); @@ -628,8 +628,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32);
628 /* you can call this signal handler from your SIGBUS and SIGSEGV 628 /* you can call this signal handler from your SIGBUS and SIGSEGV
629 signal handlers to inform the virtual CPU of exceptions. non zero 629 signal handlers to inform the virtual CPU of exceptions. non zero
630 is returned if the signal was handled by the virtual CPU. */ 630 is returned if the signal was handled by the virtual CPU. */
631 -struct siginfo;  
632 -int cpu_x86_signal_handler(int host_signum, struct siginfo *info, 631 +int cpu_x86_signal_handler(int host_signum, void *pinfo,
633 void *puc); 632 void *puc);
634 void cpu_x86_set_a20(CPUX86State *env, int a20_state); 633 void cpu_x86_set_a20(CPUX86State *env, int a20_state);
635 634
target-m68k/cpu.h
@@ -97,8 +97,7 @@ void cpu_m68k_close(CPUM68KState *s); @@ -97,8 +97,7 @@ void cpu_m68k_close(CPUM68KState *s);
97 /* you can call this signal handler from your SIGBUS and SIGSEGV 97 /* you can call this signal handler from your SIGBUS and SIGSEGV
98 signal handlers to inform the virtual CPU of exceptions. non zero 98 signal handlers to inform the virtual CPU of exceptions. non zero
99 is returned if the signal was handled by the virtual CPU. */ 99 is returned if the signal was handled by the virtual CPU. */
100 -struct siginfo;  
101 -int cpu_m68k_signal_handler(int host_signum, struct siginfo *info, 100 +int cpu_m68k_signal_handler(int host_signum, void *pinfo,
102 void *puc); 101 void *puc);
103 void cpu_m68k_flush_flags(CPUM68KState *, int); 102 void cpu_m68k_flush_flags(CPUM68KState *, int);
104 103
target-ppc/cpu.h
@@ -575,8 +575,7 @@ void cpu_ppc_close(CPUPPCState *s); @@ -575,8 +575,7 @@ void cpu_ppc_close(CPUPPCState *s);
575 /* you can call this signal handler from your SIGBUS and SIGSEGV 575 /* you can call this signal handler from your SIGBUS and SIGSEGV
576 signal handlers to inform the virtual CPU of exceptions. non zero 576 signal handlers to inform the virtual CPU of exceptions. non zero
577 is returned if the signal was handled by the virtual CPU. */ 577 is returned if the signal was handled by the virtual CPU. */
578 -struct siginfo;  
579 -int cpu_ppc_signal_handler(int host_signum, struct siginfo *info, 578 +int cpu_ppc_signal_handler(int host_signum, void *pinfo,
580 void *puc); 579 void *puc);
581 580
582 void do_interrupt (CPUPPCState *env); 581 void do_interrupt (CPUPPCState *env);
target-sh4/cpu.h
@@ -121,9 +121,8 @@ typedef struct CPUSH4State { @@ -121,9 +121,8 @@ typedef struct CPUSH4State {
121 121
122 CPUSH4State *cpu_sh4_init(void); 122 CPUSH4State *cpu_sh4_init(void);
123 int cpu_sh4_exec(CPUSH4State * s); 123 int cpu_sh4_exec(CPUSH4State * s);
124 -struct siginfo;  
125 -int cpu_sh4_signal_handler(int hostsignum, struct siginfo *info,  
126 - void *puc); 124 +int cpu_sh4_signal_handler(int host_signum, void *pinfo,
  125 + void *puc);
127 126
128 #include "softfloat.h" 127 #include "softfloat.h"
129 128
target-sparc/cpu.h
@@ -275,8 +275,7 @@ void cpu_set_cwp(CPUSPARCState *env1, int new_cwp); @@ -275,8 +275,7 @@ void cpu_set_cwp(CPUSPARCState *env1, int new_cwp);
275 } while (0) 275 } while (0)
276 #endif 276 #endif
277 277
278 -struct siginfo;  
279 -int cpu_sparc_signal_handler(int hostsignum, struct siginfo *info, void *puc); 278 +int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
280 279
281 #include "cpu-all.h" 280 #include "cpu-all.h"
282 281