X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-x86_64%2Fmach-xen%2Fasm%2Fsystem.h;h=3fdf16bdfd6d6f931954817de46932476d217168;hb=refs%2Fheads%2Fvserver;hp=7d8b8822029ebeec8e0b53cc5f1acef9bb054343;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/include/asm-x86_64/mach-xen/asm/system.h b/include/asm-x86_64/mach-xen/asm/system.h index 7d8b88220..3fdf16bdf 100644 --- a/include/asm-x86_64/mach-xen/asm/system.h +++ b/include/asm-x86_64/mach-xen/asm/system.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -22,12 +23,13 @@ #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" /* frame pointer must be last for get_wchan */ -#define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" -#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" +#define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" +#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" #define __EXTRA_CLOBBER \ ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" +/* Save restore flags to clear handle leaking NT */ #define switch_to(prev,next,last) \ asm volatile(SAVE_CONTEXT \ "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ @@ -50,8 +52,7 @@ [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ : "memory", "cc" __EXTRA_CLOBBER) - -extern void load_gs_index(unsigned); +extern void load_gs_index(unsigned); /* * Load a segment. Fall back on loading the zero @@ -90,11 +91,12 @@ static inline void write_cr0(unsigned long val) asm volatile("movq %0,%%cr0" :: "r" (val)); } -#define read_cr3() ({ \ - unsigned long __dummy; \ - asm("movq %%cr3,%0" : "=r" (__dummy)); \ - machine_to_phys(__dummy); \ -}) +static inline unsigned long read_cr3(void) +{ + unsigned long cr3; + asm("movq %%cr3,%0" : "=r" (cr3)); + return machine_to_phys(cr3); +} static inline unsigned long read_cr4(void) {