zach@vmware.com
2007-Apr-18 13:02 UTC
[PATCH 10/14] i386 / Move descriptor accessors into desc h
Move base / limit accessors into desc.h, where they properly belong. Patch-base: 2.6.13-rc5-mm1 Patch-keys: i386 desc cleanup Signed-off-by: Zachary Amsden <zach@vmware.com> Index: linux-2.6.13/include/asm-i386/system.h ==================================================================--- linux-2.6.13.orig/include/asm-i386/system.h 2005-08-09 20:17:26.000000000 -0700 +++ linux-2.6.13/include/asm-i386/system.h 2005-08-09 20:17:27.000000000 -0700 @@ -29,40 +29,6 @@ "2" (prev), "d" (next)); \ } while (0) -#define _set_base(desc,base) do { \ - unsigned long __tmp; \ - typecheck(struct desc_struct *, desc); \ - asm volatile("movw %w5,%2\n\t" \ - "rorl $16,%5\n\t" \ - "movb %b5,%3\n\t" \ - "movb %h5,%4" \ - :"=m"(*(desc)), \ - "=&q" (__tmp) \ - :"m" (*((char *)(desc)+2)), \ - "m" (*((char *)(desc)+4)), \ - "m" (*((char *)(desc)+7)), \ - "1" (base)); \ -} while(0) - -#define _set_limit(desc,limit) do { \ - unsigned long __tmp; \ - typecheck(struct desc_struct *, desc); \ - asm volatile("movw %w4,%2\n\t" \ - "rorl $16,%4\n\t" \ - "movb %3,%h4\n\t" \ - "andb $0xf0,%h4\n\t" \ - "orb %h4,%b4\n\t" \ - "movb %b4,%3" \ - :"=m"(*(desc)), \ - "=&q" (__tmp) \ - :"m" (*(desc)), \ - "m" (*((char *)(desc)+6)), \ - "1" (limit)); \ -} while(0) - -#define set_base(desc,base) _set_base((desc), (base)) -#define set_limit(desc,limit) _set_limit((desc), ((limit)-1)>>12) - /* * Load a segment. Fall back on loading the zero * segment if something goes wrong.. Index: linux-2.6.13/include/asm-i386/desc.h ==================================================================--- linux-2.6.13.orig/include/asm-i386/desc.h 2005-08-09 20:17:26.000000000 -0700 +++ linux-2.6.13/include/asm-i386/desc.h 2005-08-10 20:40:51.000000000 -0700 @@ -73,6 +73,40 @@ : "1" (addr), "r"(desc), "ir"(limit), "i"(type)); \ } while (0) +#define _set_base(desc,base) do { \ + unsigned long __tmp; \ + typecheck(struct desc_struct *, desc); \ + asm volatile("movw %w5,%2\n\t" \ + "rorl $16,%5\n\t" \ + "movb %b5,%3\n\t" \ + "movb %h5,%4" \ + :"=m"(*(desc)), \ + "=&q" (__tmp) \ + :"m" (*((char *)(desc)+2)), \ + "m" (*((char *)(desc)+4)), \ + "m" (*((char *)(desc)+7)), \ + "1" (base)); \ +} while(0) + +#define _set_limit(desc,limit) do { \ + unsigned long __tmp; \ + typecheck(struct desc_struct *, desc); \ + asm volatile("movw %w4,%2\n\t" \ + "rorl $16,%4\n\t" \ + "movb %3,%h4\n\t" \ + "andb $0xf0,%h4\n\t" \ + "orb %h4,%b4\n\t" \ + "movb %b4,%3" \ + :"=m"(*(desc)), \ + "=&q" (__tmp) \ + :"m" (*(desc)), \ + "m" (*((char *)(desc)+6)), \ + "1" (limit)); \ +} while(0) + +#define set_base(desc,base) _set_base((desc), (base)) +#define set_limit(desc,limit) _set_limit((desc), ((limit)-1)>>12) + #include <mach_desc.h> #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)