diff options
Diffstat (limited to 'arch/x86/ia32/ia32_signal.c')
-rw-r--r-- | arch/x86/ia32/ia32_signal.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 39356a756b28..f2da443f8c7b 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -154,7 +154,7 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
154 | } | 154 | } |
155 | seg = get_fs(); | 155 | seg = get_fs(); |
156 | set_fs(KERNEL_DS); | 156 | set_fs(KERNEL_DS); |
157 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->rsp); | 157 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp); |
158 | set_fs(seg); | 158 | set_fs(seg); |
159 | if (ret >= 0 && uoss_ptr) { | 159 | if (ret >= 0 && uoss_ptr) { |
160 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)) || | 160 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)) || |
@@ -195,7 +195,7 @@ struct rt_sigframe | |||
195 | #define COPY(x) { \ | 195 | #define COPY(x) { \ |
196 | unsigned int reg; \ | 196 | unsigned int reg; \ |
197 | err |= __get_user(reg, &sc->e ##x); \ | 197 | err |= __get_user(reg, &sc->e ##x); \ |
198 | regs->r ## x = reg; \ | 198 | regs->x = reg; \ |
199 | } | 199 | } |
200 | 200 | ||
201 | #define RELOAD_SEG(seg,mask) \ | 201 | #define RELOAD_SEG(seg,mask) \ |
@@ -220,7 +220,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
220 | #if DEBUG_SIG | 220 | #if DEBUG_SIG |
221 | printk(KERN_DEBUG "SIG restore_sigcontext: " | 221 | printk(KERN_DEBUG "SIG restore_sigcontext: " |
222 | "sc=%p err(%x) eip(%x) cs(%x) flg(%x)\n", | 222 | "sc=%p err(%x) eip(%x) cs(%x) flg(%x)\n", |
223 | sc, sc->err, sc->eip, sc->cs, sc->eflags); | 223 | sc, sc->err, sc->ip, sc->cs, sc->flags); |
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | /* | 226 | /* |
@@ -249,9 +249,9 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
249 | regs->ss |= 3; | 249 | regs->ss |= 3; |
250 | 250 | ||
251 | err |= __get_user(tmpflags, &sc->eflags); | 251 | err |= __get_user(tmpflags, &sc->eflags); |
252 | regs->eflags = (regs->eflags & ~0x40DD5) | (tmpflags & 0x40DD5); | 252 | regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5); |
253 | /* disable syscall checks */ | 253 | /* disable syscall checks */ |
254 | regs->orig_rax = -1; | 254 | regs->orig_ax = -1; |
255 | 255 | ||
256 | err |= __get_user(tmp, &sc->fpstate); | 256 | err |= __get_user(tmp, &sc->fpstate); |
257 | buf = compat_ptr(tmp); | 257 | buf = compat_ptr(tmp); |
@@ -279,9 +279,9 @@ badframe: | |||
279 | 279 | ||
280 | asmlinkage long sys32_sigreturn(struct pt_regs *regs) | 280 | asmlinkage long sys32_sigreturn(struct pt_regs *regs) |
281 | { | 281 | { |
282 | struct sigframe __user *frame = (struct sigframe __user *)(regs->rsp-8); | 282 | struct sigframe __user *frame = (struct sigframe __user *)(regs->sp-8); |
283 | sigset_t set; | 283 | sigset_t set; |
284 | unsigned int eax; | 284 | unsigned int ax; |
285 | 285 | ||
286 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 286 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
287 | goto badframe; | 287 | goto badframe; |
@@ -298,9 +298,9 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs) | |||
298 | recalc_sigpending(); | 298 | recalc_sigpending(); |
299 | spin_unlock_irq(¤t->sighand->siglock); | 299 | spin_unlock_irq(¤t->sighand->siglock); |
300 | 300 | ||
301 | if (ia32_restore_sigcontext(regs, &frame->sc, &eax)) | 301 | if (ia32_restore_sigcontext(regs, &frame->sc, &ax)) |
302 | goto badframe; | 302 | goto badframe; |
303 | return eax; | 303 | return ax; |
304 | 304 | ||
305 | badframe: | 305 | badframe: |
306 | signal_fault(regs, frame, "32bit sigreturn"); | 306 | signal_fault(regs, frame, "32bit sigreturn"); |
@@ -311,10 +311,10 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) | |||
311 | { | 311 | { |
312 | struct rt_sigframe __user *frame; | 312 | struct rt_sigframe __user *frame; |
313 | sigset_t set; | 313 | sigset_t set; |
314 | unsigned int eax; | 314 | unsigned int ax; |
315 | struct pt_regs tregs; | 315 | struct pt_regs tregs; |
316 | 316 | ||
317 | frame = (struct rt_sigframe __user *)(regs->rsp - 4); | 317 | frame = (struct rt_sigframe __user *)(regs->sp - 4); |
318 | 318 | ||
319 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 319 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
320 | goto badframe; | 320 | goto badframe; |
@@ -327,14 +327,14 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) | |||
327 | recalc_sigpending(); | 327 | recalc_sigpending(); |
328 | spin_unlock_irq(¤t->sighand->siglock); | 328 | spin_unlock_irq(¤t->sighand->siglock); |
329 | 329 | ||
330 | if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext, &eax)) | 330 | if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) |
331 | goto badframe; | 331 | goto badframe; |
332 | 332 | ||
333 | tregs = *regs; | 333 | tregs = *regs; |
334 | if (sys32_sigaltstack(&frame->uc.uc_stack, NULL, &tregs) == -EFAULT) | 334 | if (sys32_sigaltstack(&frame->uc.uc_stack, NULL, &tregs) == -EFAULT) |
335 | goto badframe; | 335 | goto badframe; |
336 | 336 | ||
337 | return eax; | 337 | return ax; |
338 | 338 | ||
339 | badframe: | 339 | badframe: |
340 | signal_fault(regs, frame, "32bit rt sigreturn"); | 340 | signal_fault(regs, frame, "32bit rt sigreturn"); |
@@ -361,21 +361,21 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
361 | __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); | 361 | __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); |
362 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); | 362 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); |
363 | 363 | ||
364 | err |= __put_user((u32)regs->rdi, &sc->edi); | 364 | err |= __put_user((u32)regs->di, &sc->edi); |
365 | err |= __put_user((u32)regs->rsi, &sc->esi); | 365 | err |= __put_user((u32)regs->si, &sc->esi); |
366 | err |= __put_user((u32)regs->rbp, &sc->ebp); | 366 | err |= __put_user((u32)regs->bp, &sc->ebp); |
367 | err |= __put_user((u32)regs->rsp, &sc->esp); | 367 | err |= __put_user((u32)regs->sp, &sc->esp); |
368 | err |= __put_user((u32)regs->rbx, &sc->ebx); | 368 | err |= __put_user((u32)regs->bx, &sc->ebx); |
369 | err |= __put_user((u32)regs->rdx, &sc->edx); | 369 | err |= __put_user((u32)regs->dx, &sc->edx); |
370 | err |= __put_user((u32)regs->rcx, &sc->ecx); | 370 | err |= __put_user((u32)regs->cx, &sc->ecx); |
371 | err |= __put_user((u32)regs->rax, &sc->eax); | 371 | err |= __put_user((u32)regs->ax, &sc->eax); |
372 | err |= __put_user((u32)regs->cs, &sc->cs); | 372 | err |= __put_user((u32)regs->cs, &sc->cs); |
373 | err |= __put_user((u32)regs->ss, &sc->ss); | 373 | err |= __put_user((u32)regs->ss, &sc->ss); |
374 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 374 | err |= __put_user(current->thread.trap_no, &sc->trapno); |
375 | err |= __put_user(current->thread.error_code, &sc->err); | 375 | err |= __put_user(current->thread.error_code, &sc->err); |
376 | err |= __put_user((u32)regs->rip, &sc->eip); | 376 | err |= __put_user((u32)regs->ip, &sc->eip); |
377 | err |= __put_user((u32)regs->eflags, &sc->eflags); | 377 | err |= __put_user((u32)regs->flags, &sc->eflags); |
378 | err |= __put_user((u32)regs->rsp, &sc->esp_at_signal); | 378 | err |= __put_user((u32)regs->sp, &sc->esp_at_signal); |
379 | 379 | ||
380 | tmp = save_i387_ia32(current, fpstate, regs, 0); | 380 | tmp = save_i387_ia32(current, fpstate, regs, 0); |
381 | if (tmp < 0) | 381 | if (tmp < 0) |
@@ -400,28 +400,28 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
400 | static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | 400 | static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
401 | size_t frame_size) | 401 | size_t frame_size) |
402 | { | 402 | { |
403 | unsigned long rsp; | 403 | unsigned long sp; |
404 | 404 | ||
405 | /* Default to using normal stack */ | 405 | /* Default to using normal stack */ |
406 | rsp = regs->rsp; | 406 | sp = regs->sp; |
407 | 407 | ||
408 | /* This is the X/Open sanctioned signal stack switching. */ | 408 | /* This is the X/Open sanctioned signal stack switching. */ |
409 | if (ka->sa.sa_flags & SA_ONSTACK) { | 409 | if (ka->sa.sa_flags & SA_ONSTACK) { |
410 | if (sas_ss_flags(rsp) == 0) | 410 | if (sas_ss_flags(sp) == 0) |
411 | rsp = current->sas_ss_sp + current->sas_ss_size; | 411 | sp = current->sas_ss_sp + current->sas_ss_size; |
412 | } | 412 | } |
413 | 413 | ||
414 | /* This is the legacy signal stack switching. */ | 414 | /* This is the legacy signal stack switching. */ |
415 | else if ((regs->ss & 0xffff) != __USER_DS && | 415 | else if ((regs->ss & 0xffff) != __USER_DS && |
416 | !(ka->sa.sa_flags & SA_RESTORER) && | 416 | !(ka->sa.sa_flags & SA_RESTORER) && |
417 | ka->sa.sa_restorer) | 417 | ka->sa.sa_restorer) |
418 | rsp = (unsigned long) ka->sa.sa_restorer; | 418 | sp = (unsigned long) ka->sa.sa_restorer; |
419 | 419 | ||
420 | rsp -= frame_size; | 420 | sp -= frame_size; |
421 | /* Align the stack pointer according to the i386 ABI, | 421 | /* Align the stack pointer according to the i386 ABI, |
422 | * i.e. so that on function entry ((sp + 4) & 15) == 0. */ | 422 | * i.e. so that on function entry ((sp + 4) & 15) == 0. */ |
423 | rsp = ((rsp + 4) & -16ul) - 4; | 423 | sp = ((sp + 4) & -16ul) - 4; |
424 | return (void __user *) rsp; | 424 | return (void __user *) sp; |
425 | } | 425 | } |
426 | 426 | ||
427 | int ia32_setup_frame(int sig, struct k_sigaction *ka, | 427 | int ia32_setup_frame(int sig, struct k_sigaction *ka, |
@@ -486,13 +486,13 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
486 | goto give_sigsegv; | 486 | goto give_sigsegv; |
487 | 487 | ||
488 | /* Set up registers for signal handler */ | 488 | /* Set up registers for signal handler */ |
489 | regs->rsp = (unsigned long) frame; | 489 | regs->sp = (unsigned long) frame; |
490 | regs->rip = (unsigned long) ka->sa.sa_handler; | 490 | regs->ip = (unsigned long) ka->sa.sa_handler; |
491 | 491 | ||
492 | /* Make -mregparm=3 work */ | 492 | /* Make -mregparm=3 work */ |
493 | regs->rax = sig; | 493 | regs->ax = sig; |
494 | regs->rdx = 0; | 494 | regs->dx = 0; |
495 | regs->rcx = 0; | 495 | regs->cx = 0; |
496 | 496 | ||
497 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); | 497 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); |
498 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); | 498 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); |
@@ -501,13 +501,13 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
501 | regs->ss = __USER32_DS; | 501 | regs->ss = __USER32_DS; |
502 | 502 | ||
503 | set_fs(USER_DS); | 503 | set_fs(USER_DS); |
504 | regs->eflags &= ~TF_MASK; | 504 | regs->flags &= ~TF_MASK; |
505 | if (test_thread_flag(TIF_SINGLESTEP)) | 505 | if (test_thread_flag(TIF_SINGLESTEP)) |
506 | ptrace_notify(SIGTRAP); | 506 | ptrace_notify(SIGTRAP); |
507 | 507 | ||
508 | #if DEBUG_SIG | 508 | #if DEBUG_SIG |
509 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", | 509 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", |
510 | current->comm, current->pid, frame, regs->rip, frame->pretcode); | 510 | current->comm, current->pid, frame, regs->ip, frame->pretcode); |
511 | #endif | 511 | #endif |
512 | 512 | ||
513 | return 0; | 513 | return 0; |
@@ -556,7 +556,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
556 | err |= __put_user(0, &frame->uc.uc_flags); | 556 | err |= __put_user(0, &frame->uc.uc_flags); |
557 | err |= __put_user(0, &frame->uc.uc_link); | 557 | err |= __put_user(0, &frame->uc.uc_link); |
558 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 558 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
559 | err |= __put_user(sas_ss_flags(regs->rsp), | 559 | err |= __put_user(sas_ss_flags(regs->sp), |
560 | &frame->uc.uc_stack.ss_flags); | 560 | &frame->uc.uc_stack.ss_flags); |
561 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | 561 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); |
562 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate, | 562 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate, |
@@ -581,18 +581,18 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
581 | goto give_sigsegv; | 581 | goto give_sigsegv; |
582 | 582 | ||
583 | /* Set up registers for signal handler */ | 583 | /* Set up registers for signal handler */ |
584 | regs->rsp = (unsigned long) frame; | 584 | regs->sp = (unsigned long) frame; |
585 | regs->rip = (unsigned long) ka->sa.sa_handler; | 585 | regs->ip = (unsigned long) ka->sa.sa_handler; |
586 | 586 | ||
587 | /* Make -mregparm=3 work */ | 587 | /* Make -mregparm=3 work */ |
588 | regs->rax = sig; | 588 | regs->ax = sig; |
589 | regs->rdx = (unsigned long) &frame->info; | 589 | regs->dx = (unsigned long) &frame->info; |
590 | regs->rcx = (unsigned long) &frame->uc; | 590 | regs->cx = (unsigned long) &frame->uc; |
591 | 591 | ||
592 | /* Make -mregparm=3 work */ | 592 | /* Make -mregparm=3 work */ |
593 | regs->rax = sig; | 593 | regs->ax = sig; |
594 | regs->rdx = (unsigned long) &frame->info; | 594 | regs->dx = (unsigned long) &frame->info; |
595 | regs->rcx = (unsigned long) &frame->uc; | 595 | regs->cx = (unsigned long) &frame->uc; |
596 | 596 | ||
597 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); | 597 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); |
598 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); | 598 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); |
@@ -601,13 +601,13 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
601 | regs->ss = __USER32_DS; | 601 | regs->ss = __USER32_DS; |
602 | 602 | ||
603 | set_fs(USER_DS); | 603 | set_fs(USER_DS); |
604 | regs->eflags &= ~TF_MASK; | 604 | regs->flags &= ~TF_MASK; |
605 | if (test_thread_flag(TIF_SINGLESTEP)) | 605 | if (test_thread_flag(TIF_SINGLESTEP)) |
606 | ptrace_notify(SIGTRAP); | 606 | ptrace_notify(SIGTRAP); |
607 | 607 | ||
608 | #if DEBUG_SIG | 608 | #if DEBUG_SIG |
609 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", | 609 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", |
610 | current->comm, current->pid, frame, regs->rip, frame->pretcode); | 610 | current->comm, current->pid, frame, regs->ip, frame->pretcode); |
611 | #endif | 611 | #endif |
612 | 612 | ||
613 | return 0; | 613 | return 0; |