processor.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 661 行 · 第 1/2 页
H
661 行
long fos; long mxcsr; long mxcsr_mask; long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ long padding[56];} __attribute__ ((aligned (16)));struct i387_soft_struct { long cwd; long swd; long twd; long fip; long fcs; long foo; long fos; long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ unsigned char ftop, changed, lookahead, no_update, rm, alimit; struct info *info; unsigned long entry_eip;};union i387_union { struct i387_fsave_struct fsave; struct i387_fxsave_struct fxsave; struct i387_soft_struct soft;};typedef struct { unsigned long seg;} mm_segment_t;struct thread_struct;struct tss_struct { unsigned short back_link,__blh; unsigned long esp0; unsigned short ss0,__ss0h; unsigned long esp1; unsigned short ss1,__ss1h; /* ss1 is used to cache MSR_IA32_SYSENTER_CS */ unsigned long esp2; unsigned short ss2,__ss2h; unsigned long __cr3; unsigned long eip; unsigned long eflags; unsigned long eax,ecx,edx,ebx; unsigned long esp; unsigned long ebp; unsigned long esi; unsigned long edi; unsigned short es, __esh; unsigned short cs, __csh; unsigned short ss, __ssh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh; unsigned short ldt, __ldth; unsigned short trace, io_bitmap_base; /* * The extra 1 is there because the CPU will access an * additional byte beyond the end of the IO permission * bitmap. The extra byte must be all 1 bits, and must * be within the limit. */ unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; /* * Cache the current maximum and the last task that used the bitmap: */ unsigned long io_bitmap_max; struct thread_struct *io_bitmap_owner; /* * pads the TSS to be cacheline-aligned (size is 0x100) */ unsigned long __cacheline_filler[35]; /* * .. and then another 0x100 bytes for emergency kernel stack */ unsigned long stack[64];} __attribute__((packed));#define ARCH_MIN_TASKALIGN 16struct thread_struct {/* cached TLS descriptors. */ struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; unsigned long esp0; unsigned long sysenter_cs; unsigned long eip; unsigned long esp; unsigned long fs; unsigned long gs;/* Hardware debugging registers */ unsigned long debugreg[8]; /* %%db0-7 debug registers *//* fault info */ unsigned long cr2, trap_no, error_code;/* floating point info */ union i387_union i387;/* virtual 86 mode info */ struct vm86_struct __user * vm86_info; unsigned long screen_bitmap; unsigned long v86flags, v86mask, saved_esp0; unsigned int saved_fs, saved_gs;/* IO permissions */ unsigned long *io_bitmap_ptr;/* max allowed port in the bitmap, in bytes: */ unsigned long io_bitmap_max;};#define INIT_THREAD { \ .vm86_info = NULL, \ .sysenter_cs = __KERNEL_CS, \ .io_bitmap_ptr = NULL, \}/* * Note that the .io_bitmap member must be extra-big. This is because * the CPU will access an additional byte beyond the end of the IO * permission bitmap. The extra byte must be all 1 bits, and must * be within the limit. */#define INIT_TSS { \ .esp0 = sizeof(init_stack) + (long)&init_stack, \ .ss0 = __KERNEL_DS, \ .ss1 = __KERNEL_CS, \ .ldt = GDT_ENTRY_LDT, \ .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \}static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread){ tss->esp0 = thread->esp0; /* This can only happen when SEP is enabled, no need to test "SEP"arately */ if (unlikely(tss->ss1 != thread->sysenter_cs)) { tss->ss1 = thread->sysenter_cs; wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); }}#define start_thread(regs, new_eip, new_esp) do { \ __asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0)); \ set_fs(USER_DS); \ regs->xds = __USER_DS; \ regs->xes = __USER_DS; \ regs->xss = __USER_DS; \ regs->xcs = __USER_CS; \ regs->eip = new_eip; \ regs->esp = new_esp; \} while (0)/* Forward declaration, a strange C thing */struct task_struct;struct mm_struct;/* Free all resources held by a thread. */extern void release_thread(struct task_struct *);/* Prepare to copy thread state - unlazy all lazy status */extern void prepare_to_copy(struct task_struct *tsk);/* * create a kernel thread without removing it from tasklists */extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);extern unsigned long thread_saved_pc(struct task_struct *tsk);void show_trace(struct task_struct *task, unsigned long *stack);unsigned long get_wchan(struct task_struct *p);#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))#define KSTK_TOP(info) \({ \ unsigned long *__ptr = (unsigned long *)(info); \ (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \})#define task_pt_regs(task) \({ \ struct pt_regs *__regs__; \ __regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info); \ __regs__ - 1; \})#define KSTK_EIP(task) (task_pt_regs(task)->eip)#define KSTK_ESP(task) (task_pt_regs(task)->esp)struct microcode_header { unsigned int hdrver; unsigned int rev; unsigned int date; unsigned int sig; unsigned int cksum; unsigned int ldrver; unsigned int pf; unsigned int datasize; unsigned int totalsize; unsigned int reserved[3];};struct microcode { struct microcode_header hdr; unsigned int bits[0];};typedef struct microcode microcode_t;typedef struct microcode_header microcode_header_t;/* microcode format is extended from prescott processors */struct extended_signature { unsigned int sig; unsigned int pf; unsigned int cksum;};struct extended_sigtable { unsigned int count; unsigned int cksum; unsigned int reserved[3]; struct extended_signature sigs[0];};/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */#define MICROCODE_IOCFREE _IO('6',0)/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */static inline void rep_nop(void){ __asm__ __volatile__("rep;nop": : :"memory");}#define cpu_relax() rep_nop()/* generic versions from gas */#define GENERIC_NOP1 ".byte 0x90\n"#define GENERIC_NOP2 ".byte 0x89,0xf6\n"#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n"#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n"#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n"#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n"#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7/* Opteron nops */#define K8_NOP1 GENERIC_NOP1#define K8_NOP2 ".byte 0x66,0x90\n" #define K8_NOP3 ".byte 0x66,0x66,0x90\n" #define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n" #define K8_NOP5 K8_NOP3 K8_NOP2 #define K8_NOP6 K8_NOP3 K8_NOP3#define K8_NOP7 K8_NOP4 K8_NOP3#define K8_NOP8 K8_NOP4 K8_NOP4/* K7 nops *//* uses eax dependencies (arbitary choice) */#define K7_NOP1 GENERIC_NOP1#define K7_NOP2 ".byte 0x8b,0xc0\n" #define K7_NOP3 ".byte 0x8d,0x04,0x20\n"#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n"#define K7_NOP5 K7_NOP4 ASM_NOP1#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n"#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"#define K7_NOP8 K7_NOP7 ASM_NOP1#ifdef CONFIG_MK8#define ASM_NOP1 K8_NOP1#define ASM_NOP2 K8_NOP2#define ASM_NOP3 K8_NOP3#define ASM_NOP4 K8_NOP4#define ASM_NOP5 K8_NOP5#define ASM_NOP6 K8_NOP6#define ASM_NOP7 K8_NOP7#define ASM_NOP8 K8_NOP8#elif defined(CONFIG_MK7)#define ASM_NOP1 K7_NOP1#define ASM_NOP2 K7_NOP2#define ASM_NOP3 K7_NOP3#define ASM_NOP4 K7_NOP4#define ASM_NOP5 K7_NOP5#define ASM_NOP6 K7_NOP6#define ASM_NOP7 K7_NOP7#define ASM_NOP8 K7_NOP8#else#define ASM_NOP1 GENERIC_NOP1#define ASM_NOP2 GENERIC_NOP2#define ASM_NOP3 GENERIC_NOP3#define ASM_NOP4 GENERIC_NOP4#define ASM_NOP5 GENERIC_NOP5#define ASM_NOP6 GENERIC_NOP6#define ASM_NOP7 GENERIC_NOP7#define ASM_NOP8 GENERIC_NOP8#endif#define ASM_NOP_MAX 8/* Prefetch instructions for Pentium III and AMD Athlon *//* It's not worth to care about 3dnow! prefetches for the K6 because they are microcoded there and very slow. However we don't do prefetches for pre XP Athlons currently That should be fixed. */#define ARCH_HAS_PREFETCHextern inline void prefetch(const void *x){ alternative_input(ASM_NOP4, "prefetchnta (%1)", X86_FEATURE_XMM, "r" (x));}#define ARCH_HAS_PREFETCH#define ARCH_HAS_PREFETCHW#define ARCH_HAS_SPINLOCK_PREFETCH/* 3dnow! prefetch to get an exclusive cache line. Useful for spinlocks to avoid one state transition in the cache coherency protocol. */extern inline void prefetchw(const void *x){ alternative_input(ASM_NOP4, "prefetchw (%1)", X86_FEATURE_3DNOW, "r" (x));}#define spin_lock_prefetch(x) prefetchw(x)extern void select_idle_routine(const struct cpuinfo_x86 *c);#define cache_line_size() (boot_cpu_data.x86_cache_alignment)#endif /* __ASM_I386_PROCESSOR_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?