Commit 2b413144dcb22ff1852c46d3be7aa4bd9095723f
1 parent
3ebcc707
cosmetics
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@173 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
16 additions
and
13 deletions
exec-i386.c
@@ -324,10 +324,8 @@ void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector) | @@ -324,10 +324,8 @@ void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector) | ||
324 | the effective address of the memory exception. 'is_write' is 1 if a | 324 | the effective address of the memory exception. 'is_write' is 1 if a |
325 | write caused the exception and otherwise 0'. 'old_set' is the | 325 | write caused the exception and otherwise 0'. 'old_set' is the |
326 | signal set which should be restored */ | 326 | signal set which should be restored */ |
327 | -static inline int handle_cpu_signal(unsigned long pc, | ||
328 | - unsigned long address, | ||
329 | - int is_write, | ||
330 | - sigset_t *old_set) | 327 | +static inline int handle_cpu_signal(unsigned long pc, unsigned long address, |
328 | + int is_write, sigset_t *old_set) | ||
331 | { | 329 | { |
332 | #if defined(DEBUG_SIGNAL) | 330 | #if defined(DEBUG_SIGNAL) |
333 | printf("qemu: SIGSEGV pc=0x%08lx address=%08lx wr=%d oldset=0x%08lx\n", | 331 | printf("qemu: SIGSEGV pc=0x%08lx address=%08lx wr=%d oldset=0x%08lx\n", |
@@ -355,13 +353,13 @@ static inline int handle_cpu_signal(unsigned long pc, | @@ -355,13 +353,13 @@ static inline int handle_cpu_signal(unsigned long pc, | ||
355 | } | 353 | } |
356 | } | 354 | } |
357 | 355 | ||
356 | +#if defined(__i386__) | ||
357 | + | ||
358 | int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | 358 | int cpu_x86_signal_handler(int host_signum, struct siginfo *info, |
359 | void *puc) | 359 | void *puc) |
360 | { | 360 | { |
361 | -#if defined(__i386__) | ||
362 | struct ucontext *uc = puc; | 361 | struct ucontext *uc = puc; |
363 | unsigned long pc; | 362 | unsigned long pc; |
364 | - sigset_t *pold_set; | ||
365 | 363 | ||
366 | #ifndef REG_EIP | 364 | #ifndef REG_EIP |
367 | /* for glibc 2.1 */ | 365 | /* for glibc 2.1 */ |
@@ -370,20 +368,23 @@ int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | @@ -370,20 +368,23 @@ int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | ||
370 | #define REG_TRAPNO TRAPNO | 368 | #define REG_TRAPNO TRAPNO |
371 | #endif | 369 | #endif |
372 | pc = uc->uc_mcontext.gregs[REG_EIP]; | 370 | pc = uc->uc_mcontext.gregs[REG_EIP]; |
373 | - pold_set = &uc->uc_sigmask; | ||
374 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, | 371 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, |
375 | uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ? | 372 | uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ? |
376 | (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0, | 373 | (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0, |
377 | - pold_set); | 374 | + &uc->uc_sigmask); |
375 | +} | ||
376 | + | ||
378 | #elif defined(__powerpc) | 377 | #elif defined(__powerpc) |
378 | + | ||
379 | +int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | ||
380 | + void *puc) | ||
381 | +{ | ||
379 | struct ucontext *uc = puc; | 382 | struct ucontext *uc = puc; |
380 | struct pt_regs *regs = uc->uc_mcontext.regs; | 383 | struct pt_regs *regs = uc->uc_mcontext.regs; |
381 | unsigned long pc; | 384 | unsigned long pc; |
382 | - sigset_t *pold_set; | ||
383 | int is_write; | 385 | int is_write; |
384 | 386 | ||
385 | pc = regs->nip; | 387 | pc = regs->nip; |
386 | - pold_set = &uc->uc_sigmask; | ||
387 | is_write = 0; | 388 | is_write = 0; |
388 | #if 0 | 389 | #if 0 |
389 | /* ppc 4xx case */ | 390 | /* ppc 4xx case */ |
@@ -394,9 +395,11 @@ int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | @@ -394,9 +395,11 @@ int cpu_x86_signal_handler(int host_signum, struct siginfo *info, | ||
394 | is_write = 1; | 395 | is_write = 1; |
395 | #endif | 396 | #endif |
396 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, | 397 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, |
397 | - is_write, pold_set); | 398 | + is_write, &uc->uc_sigmask); |
399 | +} | ||
400 | + | ||
398 | #else | 401 | #else |
402 | + | ||
399 | #error CPU specific signal handler needed | 403 | #error CPU specific signal handler needed |
400 | - return 0; | 404 | + |
401 | #endif | 405 | #endif |
402 | -} |