1 /* 2 * Copyright (c) 1989, 1994 William F. Jolitz. 3 * 386BSD Copyright Restrictions Apply. All Other Rights Reserved. 4 * 5 * $Id: specialreg.h,v 1.1 94/10/19 17:40:11 bill Exp $ 6 * Assembly macros. 7 */ 8 9 /* 10 * 386 Special registers: 11 */ 12 13 #define CR0_PE 0x00000001 /* Protected mode Enable */ 14 #define CR0_MP 0x00000002 /* "Math" Present (e.g. npx), wait for it */ 15 #define CR0_EM 0x00000004 /* EMulate NPX, e.g. trap, don't execute code */ 16 #define CR0_TS 0x00000008 /* Process has done Task Switch, do NPX save */ 17 #define CR0_ET 0x00000010 /* 32 bit (if set) vs 16 bit (387 vs 287) */ 18 #define CR0_WP 0x00010000 /* (486) write protection enabled for all modes */ 19 #define CR0_AM 0x00040000 /* (486) allow alignment faults */ 20 #define CR0_CD 0x40000000 /* (486) lock cache contents */ 21 #define CR0_PG 0x80000000 /* Paging Enable */ 22 23 #define rcr(ri) ({ \ 24 register int rv; \ 25 \ 26 asm volatile ("movl %%cr" # ri ",%0 " : "=r" (rv)); \ 27 rv; \ 28 }) 29 30 #define lcr(ri, s) ({ \ 31 register int arg = (int) (s) ; \ 32 \ 33 asm volatile ("movl %0,%%cr" # ri : : "r" (arg)); \ 34 }) 35