Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] i386: Use loaddebug macro consistently

This moves the macro loaddebug from asm-i386/suspend.h to
asm-i386/processor.h, which is the place that makes sense for it to be
defined, removes the extra copy of the same macro in
arch/i386/kernel/process.c, and makes arch/i386/kernel/signal.c use the
macro in place of its expansion.

This is a purely cosmetic cleanup for the normal i386 kernel. However, it
is handy for Xen to be able to just redefine the loaddebug macro once
instead of also changing the signal.c code.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Roland McGrath and committed by
Linus Torvalds
ecd02ddd b0a70b57

+9 -13
-7
arch/i386/kernel/process.c
··· 558 558 */ 559 559 tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; 560 560 } 561 - /* 562 - * This special macro can be used to load a debugging register 563 - */ 564 - #define loaddebug(thread,register) \ 565 - __asm__("movl %0,%%db" #register \ 566 - : /* no output */ \ 567 - :"r" (thread->debugreg[register])) 568 561 569 562 /* 570 563 * switch_to(x,yn) should switch tasks from x to y.
+1 -1
arch/i386/kernel/signal.c
··· 618 618 * inside the kernel. 619 619 */ 620 620 if (unlikely(current->thread.debugreg[7])) { 621 - __asm__("movl %0,%%db7" : : "r" (current->thread.debugreg[7])); 621 + loaddebug(&current->thread, 7); 622 622 } 623 623 624 624 /* Whee! Actually deliver the signal. */
+8
include/asm-i386/processor.h
··· 499 499 regs->esp = new_esp; \ 500 500 } while (0) 501 501 502 + /* 503 + * This special macro can be used to load a debugging register 504 + */ 505 + #define loaddebug(thread,register) \ 506 + __asm__("movl %0,%%db" #register \ 507 + : /* no output */ \ 508 + :"r" ((thread)->debugreg[register])) 509 + 502 510 /* Forward declaration, a strange C thing */ 503 511 struct task_struct; 504 512 struct mm_struct;
-5
include/asm-i386/suspend.h
··· 36 36 unsigned long return_address; 37 37 } __attribute__((packed)); 38 38 39 - #define loaddebug(thread,register) \ 40 - __asm__("movl %0,%%db" #register \ 41 - : /* no output */ \ 42 - :"r" ((thread)->debugreg[register])) 43 - 44 39 #ifdef CONFIG_ACPI_SLEEP 45 40 extern unsigned long saved_eip; 46 41 extern unsigned long saved_esp;