diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-01-30 07:30:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:56 -0500 |
commit | 65ea5b0349903585bfed9720fa06f5edb4f1cd25 (patch) | |
tree | 6c252228c34416b7e2077f23475de34500c2ab8a /arch/x86/kernel/traps_64.c | |
parent | 53756d3722172815f52272b28c6d5d5e9639adde (diff) |
x86: rename the struct pt_regs members for 32/64-bit consistency
We have a lot of code which differs only by the naming of specific
members of structures that contain registers. In order to enable
additional unifications, this patch drops the e- or r- size prefix
from the register names in struct pt_regs, and drops the x- prefixes
for segment registers on the 32-bit side.
This patch also performs the equivalent renames in some additional
places that might be candidates for unification in the future.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/traps_64.c')
-rw-r--r-- | arch/x86/kernel/traps_64.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 610a64d6bdf0..f7fecf9d47c3 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -76,20 +76,20 @@ asmlinkage void spurious_interrupt_bug(void); | |||
76 | 76 | ||
77 | static inline void conditional_sti(struct pt_regs *regs) | 77 | static inline void conditional_sti(struct pt_regs *regs) |
78 | { | 78 | { |
79 | if (regs->eflags & X86_EFLAGS_IF) | 79 | if (regs->flags & X86_EFLAGS_IF) |
80 | local_irq_enable(); | 80 | local_irq_enable(); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline void preempt_conditional_sti(struct pt_regs *regs) | 83 | static inline void preempt_conditional_sti(struct pt_regs *regs) |
84 | { | 84 | { |
85 | preempt_disable(); | 85 | preempt_disable(); |
86 | if (regs->eflags & X86_EFLAGS_IF) | 86 | if (regs->flags & X86_EFLAGS_IF) |
87 | local_irq_enable(); | 87 | local_irq_enable(); |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline void preempt_conditional_cli(struct pt_regs *regs) | 90 | static inline void preempt_conditional_cli(struct pt_regs *regs) |
91 | { | 91 | { |
92 | if (regs->eflags & X86_EFLAGS_IF) | 92 | if (regs->flags & X86_EFLAGS_IF) |
93 | local_irq_disable(); | 93 | local_irq_disable(); |
94 | /* Make sure to not schedule here because we could be running | 94 | /* Make sure to not schedule here because we could be running |
95 | on an exception stack. */ | 95 | on an exception stack. */ |
@@ -353,7 +353,7 @@ show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | static void | 355 | static void |
356 | _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp) | 356 | _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp) |
357 | { | 357 | { |
358 | unsigned long *stack; | 358 | unsigned long *stack; |
359 | int i; | 359 | int i; |
@@ -364,14 +364,14 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp) | |||
364 | // debugging aid: "show_stack(NULL, NULL);" prints the | 364 | // debugging aid: "show_stack(NULL, NULL);" prints the |
365 | // back trace for this cpu. | 365 | // back trace for this cpu. |
366 | 366 | ||
367 | if (rsp == NULL) { | 367 | if (sp == NULL) { |
368 | if (tsk) | 368 | if (tsk) |
369 | rsp = (unsigned long *)tsk->thread.rsp; | 369 | sp = (unsigned long *)tsk->thread.rsp; |
370 | else | 370 | else |
371 | rsp = (unsigned long *)&rsp; | 371 | sp = (unsigned long *)&sp; |
372 | } | 372 | } |
373 | 373 | ||
374 | stack = rsp; | 374 | stack = sp; |
375 | for(i=0; i < kstack_depth_to_print; i++) { | 375 | for(i=0; i < kstack_depth_to_print; i++) { |
376 | if (stack >= irqstack && stack <= irqstack_end) { | 376 | if (stack >= irqstack && stack <= irqstack_end) { |
377 | if (stack == irqstack_end) { | 377 | if (stack == irqstack_end) { |
@@ -387,12 +387,12 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp) | |||
387 | printk(" %016lx", *stack++); | 387 | printk(" %016lx", *stack++); |
388 | touch_nmi_watchdog(); | 388 | touch_nmi_watchdog(); |
389 | } | 389 | } |
390 | show_trace(tsk, regs, rsp); | 390 | show_trace(tsk, regs, sp); |
391 | } | 391 | } |
392 | 392 | ||
393 | void show_stack(struct task_struct *tsk, unsigned long * rsp) | 393 | void show_stack(struct task_struct *tsk, unsigned long * sp) |
394 | { | 394 | { |
395 | _show_stack(tsk, NULL, rsp); | 395 | _show_stack(tsk, NULL, sp); |
396 | } | 396 | } |
397 | 397 | ||
398 | /* | 398 | /* |
@@ -416,11 +416,11 @@ void show_registers(struct pt_regs *regs) | |||
416 | { | 416 | { |
417 | int i; | 417 | int i; |
418 | int in_kernel = !user_mode(regs); | 418 | int in_kernel = !user_mode(regs); |
419 | unsigned long rsp; | 419 | unsigned long sp; |
420 | const int cpu = smp_processor_id(); | 420 | const int cpu = smp_processor_id(); |
421 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; | 421 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; |
422 | 422 | ||
423 | rsp = regs->rsp; | 423 | sp = regs->sp; |
424 | printk("CPU %d ", cpu); | 424 | printk("CPU %d ", cpu); |
425 | __show_regs(regs); | 425 | __show_regs(regs); |
426 | printk("Process %s (pid: %d, threadinfo %p, task %p)\n", | 426 | printk("Process %s (pid: %d, threadinfo %p, task %p)\n", |
@@ -432,15 +432,15 @@ void show_registers(struct pt_regs *regs) | |||
432 | */ | 432 | */ |
433 | if (in_kernel) { | 433 | if (in_kernel) { |
434 | printk("Stack: "); | 434 | printk("Stack: "); |
435 | _show_stack(NULL, regs, (unsigned long*)rsp); | 435 | _show_stack(NULL, regs, (unsigned long*)sp); |
436 | 436 | ||
437 | printk("\nCode: "); | 437 | printk("\nCode: "); |
438 | if (regs->rip < PAGE_OFFSET) | 438 | if (regs->ip < PAGE_OFFSET) |
439 | goto bad; | 439 | goto bad; |
440 | 440 | ||
441 | for (i=0; i<20; i++) { | 441 | for (i=0; i<20; i++) { |
442 | unsigned char c; | 442 | unsigned char c; |
443 | if (__get_user(c, &((unsigned char*)regs->rip)[i])) { | 443 | if (__get_user(c, &((unsigned char*)regs->ip)[i])) { |
444 | bad: | 444 | bad: |
445 | printk(" Bad RIP value."); | 445 | printk(" Bad RIP value."); |
446 | break; | 446 | break; |
@@ -451,11 +451,11 @@ bad: | |||
451 | printk("\n"); | 451 | printk("\n"); |
452 | } | 452 | } |
453 | 453 | ||
454 | int is_valid_bugaddr(unsigned long rip) | 454 | int is_valid_bugaddr(unsigned long ip) |
455 | { | 455 | { |
456 | unsigned short ud2; | 456 | unsigned short ud2; |
457 | 457 | ||
458 | if (__copy_from_user(&ud2, (const void __user *) rip, sizeof(ud2))) | 458 | if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2))) |
459 | return 0; | 459 | return 0; |
460 | 460 | ||
461 | return ud2 == 0x0b0f; | 461 | return ud2 == 0x0b0f; |
@@ -521,8 +521,8 @@ void __kprobes __die(const char * str, struct pt_regs * regs, long err) | |||
521 | add_taint(TAINT_DIE); | 521 | add_taint(TAINT_DIE); |
522 | /* Executive summary in case the oops scrolled away */ | 522 | /* Executive summary in case the oops scrolled away */ |
523 | printk(KERN_ALERT "RIP "); | 523 | printk(KERN_ALERT "RIP "); |
524 | printk_address(regs->rip); | 524 | printk_address(regs->ip); |
525 | printk(" RSP <%016lx>\n", regs->rsp); | 525 | printk(" RSP <%016lx>\n", regs->sp); |
526 | if (kexec_should_crash(current)) | 526 | if (kexec_should_crash(current)) |
527 | crash_kexec(regs); | 527 | crash_kexec(regs); |
528 | } | 528 | } |
@@ -532,7 +532,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
532 | unsigned long flags = oops_begin(); | 532 | unsigned long flags = oops_begin(); |
533 | 533 | ||
534 | if (!user_mode(regs)) | 534 | if (!user_mode(regs)) |
535 | report_bug(regs->rip, regs); | 535 | report_bug(regs->ip, regs); |
536 | 536 | ||
537 | __die(str, regs, err); | 537 | __die(str, regs, err); |
538 | oops_end(flags); | 538 | oops_end(flags); |
@@ -582,9 +582,9 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, | |||
582 | if (show_unhandled_signals && unhandled_signal(tsk, signr) && | 582 | if (show_unhandled_signals && unhandled_signal(tsk, signr) && |
583 | printk_ratelimit()) | 583 | printk_ratelimit()) |
584 | printk(KERN_INFO | 584 | printk(KERN_INFO |
585 | "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", | 585 | "%s[%d] trap %s ip:%lx sp:%lx error:%lx\n", |
586 | tsk->comm, tsk->pid, str, | 586 | tsk->comm, tsk->pid, str, |
587 | regs->rip, regs->rsp, error_code); | 587 | regs->ip, regs->sp, error_code); |
588 | 588 | ||
589 | if (info) | 589 | if (info) |
590 | force_sig_info(signr, info, tsk); | 590 | force_sig_info(signr, info, tsk); |
@@ -597,9 +597,9 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, | |||
597 | /* kernel trap */ | 597 | /* kernel trap */ |
598 | { | 598 | { |
599 | const struct exception_table_entry *fixup; | 599 | const struct exception_table_entry *fixup; |
600 | fixup = search_exception_tables(regs->rip); | 600 | fixup = search_exception_tables(regs->ip); |
601 | if (fixup) | 601 | if (fixup) |
602 | regs->rip = fixup->fixup; | 602 | regs->ip = fixup->fixup; |
603 | else { | 603 | else { |
604 | tsk->thread.error_code = error_code; | 604 | tsk->thread.error_code = error_code; |
605 | tsk->thread.trap_no = trapnr; | 605 | tsk->thread.trap_no = trapnr; |
@@ -635,10 +635,10 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ | |||
635 | do_trap(trapnr, signr, str, regs, error_code, &info); \ | 635 | do_trap(trapnr, signr, str, regs, error_code, &info); \ |
636 | } | 636 | } |
637 | 637 | ||
638 | DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip) | 638 | DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip) |
639 | DO_ERROR( 4, SIGSEGV, "overflow", overflow) | 639 | DO_ERROR( 4, SIGSEGV, "overflow", overflow) |
640 | DO_ERROR( 5, SIGSEGV, "bounds", bounds) | 640 | DO_ERROR( 5, SIGSEGV, "bounds", bounds) |
641 | DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->rip) | 641 | DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip) |
642 | DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) | 642 | DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) |
643 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) | 643 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) |
644 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | 644 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) |
@@ -688,9 +688,9 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, | |||
688 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 688 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && |
689 | printk_ratelimit()) | 689 | printk_ratelimit()) |
690 | printk(KERN_INFO | 690 | printk(KERN_INFO |
691 | "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", | 691 | "%s[%d] general protection ip:%lx sp:%lx error:%lx\n", |
692 | tsk->comm, tsk->pid, | 692 | tsk->comm, tsk->pid, |
693 | regs->rip, regs->rsp, error_code); | 693 | regs->ip, regs->sp, error_code); |
694 | 694 | ||
695 | force_sig(SIGSEGV, tsk); | 695 | force_sig(SIGSEGV, tsk); |
696 | return; | 696 | return; |
@@ -699,9 +699,9 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, | |||
699 | /* kernel gp */ | 699 | /* kernel gp */ |
700 | { | 700 | { |
701 | const struct exception_table_entry *fixup; | 701 | const struct exception_table_entry *fixup; |
702 | fixup = search_exception_tables(regs->rip); | 702 | fixup = search_exception_tables(regs->ip); |
703 | if (fixup) { | 703 | if (fixup) { |
704 | regs->rip = fixup->fixup; | 704 | regs->ip = fixup->fixup; |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | 707 | ||
@@ -824,15 +824,15 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) | |||
824 | { | 824 | { |
825 | struct pt_regs *regs = eregs; | 825 | struct pt_regs *regs = eregs; |
826 | /* Did already sync */ | 826 | /* Did already sync */ |
827 | if (eregs == (struct pt_regs *)eregs->rsp) | 827 | if (eregs == (struct pt_regs *)eregs->sp) |
828 | ; | 828 | ; |
829 | /* Exception from user space */ | 829 | /* Exception from user space */ |
830 | else if (user_mode(eregs)) | 830 | else if (user_mode(eregs)) |
831 | regs = task_pt_regs(current); | 831 | regs = task_pt_regs(current); |
832 | /* Exception from kernel and interrupts are enabled. Move to | 832 | /* Exception from kernel and interrupts are enabled. Move to |
833 | kernel process stack. */ | 833 | kernel process stack. */ |
834 | else if (eregs->eflags & X86_EFLAGS_IF) | 834 | else if (eregs->flags & X86_EFLAGS_IF) |
835 | regs = (struct pt_regs *)(eregs->rsp -= sizeof(struct pt_regs)); | 835 | regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); |
836 | if (eregs != regs) | 836 | if (eregs != regs) |
837 | *regs = *eregs; | 837 | *regs = *eregs; |
838 | return regs; | 838 | return regs; |
@@ -887,7 +887,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs, | |||
887 | info.si_signo = SIGTRAP; | 887 | info.si_signo = SIGTRAP; |
888 | info.si_errno = 0; | 888 | info.si_errno = 0; |
889 | info.si_code = TRAP_BRKPT; | 889 | info.si_code = TRAP_BRKPT; |
890 | info.si_addr = user_mode(regs) ? (void __user *)regs->rip : NULL; | 890 | info.si_addr = user_mode(regs) ? (void __user *)regs->ip : NULL; |
891 | force_sig_info(SIGTRAP, &info, tsk); | 891 | force_sig_info(SIGTRAP, &info, tsk); |
892 | 892 | ||
893 | clear_dr7: | 893 | clear_dr7: |
@@ -897,16 +897,16 @@ clear_dr7: | |||
897 | 897 | ||
898 | clear_TF_reenable: | 898 | clear_TF_reenable: |
899 | set_tsk_thread_flag(tsk, TIF_SINGLESTEP); | 899 | set_tsk_thread_flag(tsk, TIF_SINGLESTEP); |
900 | regs->eflags &= ~TF_MASK; | 900 | regs->flags &= ~TF_MASK; |
901 | preempt_conditional_cli(regs); | 901 | preempt_conditional_cli(regs); |
902 | } | 902 | } |
903 | 903 | ||
904 | static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) | 904 | static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) |
905 | { | 905 | { |
906 | const struct exception_table_entry *fixup; | 906 | const struct exception_table_entry *fixup; |
907 | fixup = search_exception_tables(regs->rip); | 907 | fixup = search_exception_tables(regs->ip); |
908 | if (fixup) { | 908 | if (fixup) { |
909 | regs->rip = fixup->fixup; | 909 | regs->ip = fixup->fixup; |
910 | return 1; | 910 | return 1; |
911 | } | 911 | } |
912 | notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE); | 912 | notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE); |
@@ -923,7 +923,7 @@ static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) | |||
923 | */ | 923 | */ |
924 | asmlinkage void do_coprocessor_error(struct pt_regs *regs) | 924 | asmlinkage void do_coprocessor_error(struct pt_regs *regs) |
925 | { | 925 | { |
926 | void __user *rip = (void __user *)(regs->rip); | 926 | void __user *ip = (void __user *)(regs->ip); |
927 | struct task_struct * task; | 927 | struct task_struct * task; |
928 | siginfo_t info; | 928 | siginfo_t info; |
929 | unsigned short cwd, swd; | 929 | unsigned short cwd, swd; |
@@ -943,7 +943,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs) | |||
943 | info.si_signo = SIGFPE; | 943 | info.si_signo = SIGFPE; |
944 | info.si_errno = 0; | 944 | info.si_errno = 0; |
945 | info.si_code = __SI_FAULT; | 945 | info.si_code = __SI_FAULT; |
946 | info.si_addr = rip; | 946 | info.si_addr = ip; |
947 | /* | 947 | /* |
948 | * (~cwd & swd) will mask out exceptions that are not set to unmasked | 948 | * (~cwd & swd) will mask out exceptions that are not set to unmasked |
949 | * status. 0x3f is the exception bits in these regs, 0x200 is the | 949 | * status. 0x3f is the exception bits in these regs, 0x200 is the |
@@ -992,7 +992,7 @@ asmlinkage void bad_intr(void) | |||
992 | 992 | ||
993 | asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) | 993 | asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) |
994 | { | 994 | { |
995 | void __user *rip = (void __user *)(regs->rip); | 995 | void __user *ip = (void __user *)(regs->ip); |
996 | struct task_struct * task; | 996 | struct task_struct * task; |
997 | siginfo_t info; | 997 | siginfo_t info; |
998 | unsigned short mxcsr; | 998 | unsigned short mxcsr; |
@@ -1012,7 +1012,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) | |||
1012 | info.si_signo = SIGFPE; | 1012 | info.si_signo = SIGFPE; |
1013 | info.si_errno = 0; | 1013 | info.si_errno = 0; |
1014 | info.si_code = __SI_FAULT; | 1014 | info.si_code = __SI_FAULT; |
1015 | info.si_addr = rip; | 1015 | info.si_addr = ip; |
1016 | /* | 1016 | /* |
1017 | * The SIMD FPU exceptions are handled a little differently, as there | 1017 | * The SIMD FPU exceptions are handled a little differently, as there |
1018 | * is only a single status/control register. Thus, to determine which | 1018 | * is only a single status/control register. Thus, to determine which |