diff options
author | kmacy <kmacy@FreeBSD.org> | 2008-08-15 20:51:31 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2008-08-15 20:51:31 +0000 |
commit | 8c05b8ec899e2b20d5eb286770d302b94f0e4536 (patch) | |
tree | 01c30bdd7553d9c3ff945b2422e697cffe0f9b20 /sys/i386/include/cpufunc.h | |
parent | 6bfca819a4bf3b98d63e7f4aaed6fa5b0520008a (diff) | |
download | FreeBSD-src-8c05b8ec899e2b20d5eb286770d302b94f0e4536.zip FreeBSD-src-8c05b8ec899e2b20d5eb286770d302b94f0e4536.tar.gz |
Integrate support for xen in to i386 common code.
MFC after: 1 month
Diffstat (limited to 'sys/i386/include/cpufunc.h')
-rw-r--r-- | sys/i386/include/cpufunc.h | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index fc61eab..948bde1 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -42,6 +42,16 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#ifdef XEN +extern void xen_cli(void); +extern void xen_sti(void); +extern void xen_load_cr3(u_int data); +extern void xen_tlb_flush(void); +extern void xen_invlpg(u_int addr); +extern void xen_save_and_cli(u_int *eflags); +extern void xen_restore_flags(u_int eflags); +#endif + struct region_descriptor; #define readb(va) (*(volatile u_int8_t *) (va)) @@ -81,7 +91,11 @@ bsrl(u_int mask) static __inline void disable_intr(void) { - __asm __volatile("cli" : : : "memory"); +#ifdef XEN + xen_cli(); +#else + __asm __volatile("cli" : : : "memory"); +#endif } static __inline void @@ -103,7 +117,11 @@ cpuid_count(u_int ax, u_int cx, u_int *p) static __inline void enable_intr(void) { +#ifdef XEN + xen_sti(); +#else __asm __volatile("sti"); +#endif } static inline void @@ -412,8 +430,11 @@ rcr2(void) static __inline void load_cr3(u_int data) { - +#ifdef XEN + xen_load_cr3(data); +#else __asm __volatile("movl %0,%%cr3" : : "r" (data) : "memory"); +#endif } static __inline u_int @@ -446,8 +467,11 @@ rcr4(void) static __inline void invltlb(void) { - +#ifdef XEN + xen_tlb_flush(); +#else load_cr3(rcr3()); +#endif } /* @@ -458,7 +482,11 @@ static __inline void invlpg(u_int addr) { +#ifdef XEN + xen_invlpg(addr); +#else __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); +#endif } static __inline u_int @@ -662,17 +690,25 @@ load_dr7(u_int dr7) static __inline register_t intr_disable(void) { - register_t eflags; + register_t eflags = 0; +#ifdef XEN + xen_save_and_cli(&eflags); +#else eflags = read_eflags(); disable_intr(); +#endif return (eflags); } static __inline void intr_restore(register_t eflags) { +#ifdef XEN + xen_restore_flags(eflags); +#else write_eflags(eflags); +#endif } #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ |