X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/bffa3430fbbaaad29bec0b5bee9c1f0bfc7fd068..34f6af4f61e0eec9c96113e07f140b609b4113c8:/lunaix-os/arch/x86/includes/sys/crx.h?ds=sidebyside diff --git a/lunaix-os/arch/x86/includes/sys/crx.h b/lunaix-os/arch/x86/includes/sys/crx.h deleted file mode 100644 index 4eb56e0..0000000 --- a/lunaix-os/arch/x86/includes/sys/crx.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __LUNAIX_CRX_H -#define __LUNAIX_CRX_H - -#define CR4_PSE36 ( 1UL << 4 ) -#define CR4_OSXMMEXCPT ( 1UL << 10 ) -#define CR4_OSFXSR ( 1UL << 9 ) -#define CR4_PCIDE ( 1UL << 17 ) -#define CR4_PGE ( 1UL << 7 ) -#define CR4_LA57 ( 1UL << 12 ) - -#define CR0_PG ( 1UL << 31 ) -#define CR0_WP ( 1UL << 16 ) -#define CR0_EM ( 1UL << 2 ) -#define CR0_MP ( 1UL << 1 ) - -#ifdef CONFIG_ARCH_X86_64 - -#define crx_addflag(crx, flag) \ - asm( \ - "movq %%" #crx ", %%rax\n" \ - "orq %0, %%rax\n" \ - "movq %%rax, %%" #crx "\n" \ - ::"r"(flag) \ - :"rax" \ - ); - -#define crx_rmflag(crx, flag) \ - asm( \ - "movq %%" #crx ", %%rax\n" \ - "andq %0, %%rax\n" \ - "movq %%rax, %%" #crx "\n" \ - ::"r"(~(flag)) \ - :"rax" \ - ); - -#else - -#define crx_addflag(crx, flag) \ - asm( \ - "movl %%" #crx ", %%eax\n" \ - "orl %0, %%eax\n" \ - "movl %%eax, %%" #crx "\n" \ - ::"r"(flag) \ - :"eax" \ - ); - -#define crx_rmflag(crx, flag) \ - asm( \ - "movl %%" #crx ", %%eax\n" \ - "andl %0, %%eax\n" \ - "movl %%eax, %%" #crx "\n" \ - ::"r"(~(flag)) \ - :"eax" \ - ); - -#endif - -static inline void -cr4_setfeature(unsigned long feature) -{ - crx_addflag(cr4, feature); -} - -static inline void -cr0_setfeature(unsigned long feature) -{ - crx_addflag(cr0, feature); -} - -static inline void -cr0_unsetfeature(unsigned long feature) -{ - crx_rmflag(cr0, feature); -} - -#endif /* __LUNAIX_CR4_H */