|
|
1.1 ! root 1: /* ! 2: * include/asm-i386/processor.h ! 3: * ! 4: * Copyright (C) 1994 Linus Torvalds ! 5: */ ! 6: ! 7: #ifndef __ASM_I386_PROCESSOR_H ! 8: #define __ASM_I386_PROCESSOR_H ! 9: ! 10: #include <asm/vm86.h> ! 11: #include <asm/math_emu.h> ! 12: ! 13: /* ! 14: * System setup and hardware bug flags.. ! 15: * [Note we don't test the 386 multiply bug or popad bug] ! 16: */ ! 17: ! 18: extern char hard_math; ! 19: extern char x86; /* lower 4 bits */ ! 20: extern char x86_vendor_id[13]; ! 21: extern char x86_model; /* lower 4 bits */ ! 22: extern char x86_mask; /* lower 4 bits */ ! 23: extern int x86_capability; /* field of flags */ ! 24: extern int fdiv_bug; ! 25: extern char ignore_irq13; ! 26: extern char wp_works_ok; /* doesn't work on a 386 */ ! 27: extern char hlt_works_ok; /* problems on some 486Dx4's and old 386's */ ! 28: extern int have_cpuid; /* We have a CPUID */ ! 29: ! 30: extern unsigned long cpu_hz; /* CPU clock frequency from time.c */ ! 31: ! 32: /* ! 33: * Detection of CPU model (CPUID). ! 34: */ ! 35: extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) ! 36: { ! 37: __asm__("cpuid" ! 38: : "=a" (*eax), ! 39: "=b" (*ebx), ! 40: "=c" (*ecx), ! 41: "=d" (*edx) ! 42: : "a" (op) ! 43: : "cc"); ! 44: } ! 45: ! 46: /* ! 47: * Cyrix CPU register indexes (use special macros to access these) ! 48: */ ! 49: #define CX86_CCR2 0xc2 ! 50: #define CX86_CCR3 0xc3 ! 51: #define CX86_CCR4 0xe8 ! 52: #define CX86_CCR5 0xe9 ! 53: #define CX86_DIR0 0xfe ! 54: #define CX86_DIR1 0xff ! 55: ! 56: /* ! 57: * Cyrix CPU register access macros ! 58: */ ! 59: ! 60: extern inline unsigned char getCx86(unsigned char reg) ! 61: { ! 62: unsigned char data; ! 63: ! 64: __asm__ __volatile__("movb %1,%%al\n\t" ! 65: "outb %%al,$0x22\n\t" ! 66: "inb $0x23,%%al" : "=a" (data) : "q" (reg)); ! 67: return data; ! 68: } ! 69: ! 70: extern inline void setCx86(unsigned char reg, unsigned char data) ! 71: { ! 72: __asm__ __volatile__("outb %%al,$0x22\n\t" ! 73: "movb %1,%%al\n\t" ! 74: "outb %%al,$0x23" : : "a" (reg), "q" (data)); ! 75: } ! 76: ! 77: /* ! 78: * Bus types (default is ISA, but people can check others with these..) ! 79: * MCA_bus hardcoded to 0 for now. ! 80: */ ! 81: extern int EISA_bus; ! 82: #define MCA_bus 0 ! 83: #define MCA_bus__is_a_macro /* for versions in ksyms.c */ ! 84: ! 85: /* ! 86: * User space process size: 3GB. This is hardcoded into a few places, ! 87: * so don't change it unless you know what you are doing. ! 88: */ ! 89: #define TASK_SIZE (0xC0000000UL) ! 90: #define MAX_USER_ADDR TASK_SIZE ! 91: #define MMAP_SEARCH_START (TASK_SIZE/3) ! 92: ! 93: /* ! 94: * Size of io_bitmap in longwords: 32 is ports 0-0x3ff. ! 95: */ ! 96: #define IO_BITMAP_SIZE 32 ! 97: ! 98: struct i387_hard_struct { ! 99: long cwd; ! 100: long swd; ! 101: long twd; ! 102: long fip; ! 103: long fcs; ! 104: long foo; ! 105: long fos; ! 106: long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ ! 107: long status; /* software status information */ ! 108: }; ! 109: ! 110: struct i387_soft_struct { ! 111: long cwd; ! 112: long swd; ! 113: long twd; ! 114: long fip; ! 115: long fcs; ! 116: long foo; ! 117: long fos; ! 118: long top; ! 119: struct fpu_reg regs[8]; /* 8*16 bytes for each FP-reg = 128 bytes */ ! 120: unsigned char lookahead; ! 121: struct info *info; ! 122: unsigned long entry_eip; ! 123: }; ! 124: ! 125: union i387_union { ! 126: struct i387_hard_struct hard; ! 127: struct i387_soft_struct soft; ! 128: }; ! 129: ! 130: struct thread_struct { ! 131: unsigned short back_link,__blh; ! 132: unsigned long esp0; ! 133: unsigned short ss0,__ss0h; ! 134: unsigned long esp1; ! 135: unsigned short ss1,__ss1h; ! 136: unsigned long esp2; ! 137: unsigned short ss2,__ss2h; ! 138: unsigned long cr3; ! 139: unsigned long eip; ! 140: unsigned long eflags; ! 141: unsigned long eax,ecx,edx,ebx; ! 142: unsigned long esp; ! 143: unsigned long ebp; ! 144: unsigned long esi; ! 145: unsigned long edi; ! 146: unsigned short es, __esh; ! 147: unsigned short cs, __csh; ! 148: unsigned short ss, __ssh; ! 149: unsigned short ds, __dsh; ! 150: unsigned short fs, __fsh; ! 151: unsigned short gs, __gsh; ! 152: unsigned short ldt, __ldth; ! 153: unsigned short trace, bitmap; ! 154: unsigned long io_bitmap[IO_BITMAP_SIZE+1]; ! 155: unsigned long tr; ! 156: unsigned long cr2, trap_no, error_code; ! 157: /* floating point info */ ! 158: union i387_union i387; ! 159: /* virtual 86 mode info */ ! 160: struct vm86_struct * vm86_info; ! 161: unsigned long screen_bitmap; ! 162: unsigned long v86flags, v86mask, v86mode; ! 163: }; ! 164: ! 165: #define INIT_MMAP { &init_mm, 0, 0x40000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC } ! 166: ! 167: #define INIT_TSS { \ ! 168: 0,0, \ ! 169: sizeof(init_kernel_stack) + (long) &init_kernel_stack, \ ! 170: KERNEL_DS, 0, \ ! 171: 0,0,0,0,0,0, \ ! 172: (long) &swapper_pg_dir, \ ! 173: 0,0,0,0,0,0,0,0,0,0, \ ! 174: USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \ ! 175: _LDT(0),0, \ ! 176: 0, 0x8000, \ ! 177: {~0, }, /* ioperm */ \ ! 178: _TSS(0), 0, 0,0, \ ! 179: { { 0, }, }, /* 387 state */ \ ! 180: NULL, 0, 0, 0, 0 /* vm86_info */ \ ! 181: } ! 182: ! 183: #define alloc_kernel_stack() __get_free_page(GFP_KERNEL) ! 184: #define free_kernel_stack(page) free_page((page)) ! 185: ! 186: static inline void start_thread(struct pt_regs * regs, unsigned long eip, unsigned long esp) ! 187: { ! 188: regs->cs = USER_CS; ! 189: regs->ds = regs->es = regs->ss = regs->fs = regs->gs = USER_DS; ! 190: regs->eip = eip; ! 191: regs->esp = esp; ! 192: } ! 193: ! 194: /* ! 195: * Return saved PC of a blocked thread. ! 196: */ ! 197: extern inline unsigned long thread_saved_pc(struct thread_struct *t) ! 198: { ! 199: return ((unsigned long *)t->esp)[3]; ! 200: } ! 201: ! 202: #endif /* __ASM_I386_PROCESSOR_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.