aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_32.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-01-30 07:30:59 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:59 -0500
commit0f5340933f9bacb403f49baaf8073320e3984841 (patch)
treed142192f7194c75b8ea6e4eaff0e33fbcf860c6c /arch/x86/kernel/process_32.c
parentd277fb89dfb042deba04a8e765718cc8b3825e85 (diff)
x86: x86-32 thread_struct.debugreg
This replaces the debugreg[7] member of thread_struct with individual members debugreg0, etc. This saves two words for the dummies 4 and 5, and harmonizes the code between 32 and 64. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r--arch/x86/kernel/process_32.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 53406461074f..3744cf63682c 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -445,7 +445,12 @@ void flush_thread(void)
445{ 445{
446 struct task_struct *tsk = current; 446 struct task_struct *tsk = current;
447 447
448 memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8); 448 tsk->thread.debugreg0 = 0;
449 tsk->thread.debugreg1 = 0;
450 tsk->thread.debugreg2 = 0;
451 tsk->thread.debugreg3 = 0;
452 tsk->thread.debugreg6 = 0;
453 tsk->thread.debugreg7 = 0;
449 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); 454 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
450 clear_tsk_thread_flag(tsk, TIF_DEBUG); 455 clear_tsk_thread_flag(tsk, TIF_DEBUG);
451 /* 456 /*
@@ -522,7 +527,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
522 */ 527 */
523void dump_thread(struct pt_regs * regs, struct user * dump) 528void dump_thread(struct pt_regs * regs, struct user * dump)
524{ 529{
525 int i;
526 u16 gs; 530 u16 gs;
527 531
528/* changed the size calculations - should hopefully work better. lbt */ 532/* changed the size calculations - should hopefully work better. lbt */
@@ -533,8 +537,14 @@ void dump_thread(struct pt_regs * regs, struct user * dump)
533 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; 537 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
534 dump->u_dsize -= dump->u_tsize; 538 dump->u_dsize -= dump->u_tsize;
535 dump->u_ssize = 0; 539 dump->u_ssize = 0;
536 for (i = 0; i < 8; i++) 540 dump->u_debugreg[0] = current->thread.debugreg0;
537 dump->u_debugreg[i] = current->thread.debugreg[i]; 541 dump->u_debugreg[1] = current->thread.debugreg1;
542 dump->u_debugreg[2] = current->thread.debugreg2;
543 dump->u_debugreg[3] = current->thread.debugreg3;
544 dump->u_debugreg[4] = 0;
545 dump->u_debugreg[5] = 0;
546 dump->u_debugreg[6] = current->thread.debugreg6;
547 dump->u_debugreg[7] = current->thread.debugreg7;
538 548
539 if (dump->start_stack < TASK_SIZE) 549 if (dump->start_stack < TASK_SIZE)
540 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; 550 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
@@ -612,13 +622,13 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
612 wrmsr(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr, 0); 622 wrmsr(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr, 0);
613 623
614 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 624 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
615 set_debugreg(next->debugreg[0], 0); 625 set_debugreg(next->debugreg0, 0);
616 set_debugreg(next->debugreg[1], 1); 626 set_debugreg(next->debugreg1, 1);
617 set_debugreg(next->debugreg[2], 2); 627 set_debugreg(next->debugreg2, 2);
618 set_debugreg(next->debugreg[3], 3); 628 set_debugreg(next->debugreg3, 3);
619 /* no 4 and 5 */ 629 /* no 4 and 5 */
620 set_debugreg(next->debugreg[6], 6); 630 set_debugreg(next->debugreg6, 6);
621 set_debugreg(next->debugreg[7], 7); 631 set_debugreg(next->debugreg7, 7);
622 } 632 }
623 633
624#ifdef CONFIG_SECCOMP 634#ifdef CONFIG_SECCOMP
@@ -869,4 +879,3 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
869 unsigned long range_end = mm->brk + 0x02000000; 879 unsigned long range_end = mm->brk + 0x02000000;
870 return randomize_range(mm->brk, range_end, 0) ? : mm->brk; 880 return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
871} 881}
872