📄 cpu.h
字号:
#define FPC_EXCEPTION_UNIMPL 0x00020000#define FPC_COND_BIT 0x00800000#define FPC_FLUSH_BIT 0x01000000#define FPC_MBZ_BITS 0xfe7c0000/* * Constants to determine if have a floating point instruction. */#define OPCODE_SHIFT 26#define OPCODE_C1 0x11/* * The low part of the TLB entry. */#define VMTLB_PF_NUM 0x3fffffc0#define VMTLB_ATTR_MASK 0x00000038#define VMTLB_MOD_BIT 0x00000004#define VMTLB_VALID_BIT 0x00000002#define VMTLB_GLOBAL_BIT 0x00000001#define VMTLB_PHYS_PAGE_SHIFT 6/* * The high part of the TLB entry. */#define VMTLB_VIRT_PAGE_NUM 0xffffe000#define VMTLB_PID 0x000000ff#define VMTLB_PID_SHIFT 0#define VMTLB_VIRT_PAGE_SHIFT 12/* * The number of TLB entries and the first one that write random hits. *//*#define VMNUM_TLB_ENTRIES 48 XXX We never use this... */#define VMWIRED_ENTRIES 8/* * The number of process id entries. */#define VMNUM_PIDS 256/* * TLB probe return codes. */#define VMTLB_NOT_FOUND 0#define VMTLB_FOUND 1#define VMTLB_FOUND_WITH_PATCH 2#define VMTLB_PROBE_ERROR 3/* * Exported definitions unique to mips cpu support. *//* * definitions of cpu-dependent requirements * referenced in generic code */#define COPY_SIGCODE /* copy sigcode above user stack in exec */#define cpu_wait(p) /* nothing */#define cpu_swapout(p) panic("cpu_swapout: can't get here");#ifndef _LOCORE/* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. */struct clockframe { int pc; /* program counter at time of interrupt */ int sr; /* status register at time of interrupt */ int cr; /* cause register at time of interrupt */};#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER)#define CLKF_BASEPRI(framep) ((~(framep)->sr & (INT_MASK|SR_INT_ENAB)) == 0)#define CLKF_PC(framep) ((framep)->pc)#define CLKF_INTR(framep) (0)/* * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. */#define need_resched() { want_resched = 1; aston(); }/* * Give a profiling tick to the current process when the user profiling * buffer pages are invalid. On the PICA, request an ast to send us * through trap, marking the proc as needing a profiling tick. */#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }/* * Notify the current process (p) that it has a signal pending, * process as soon as possible. */#define signotify(p) aston()#define aston() (astpending = 1)volatile int astpending; /* need to trap before returning to user mode */int want_resched; /* resched() was called *//* * CPU identification, from PRID register. */union cpuprid { int cpuprid; struct {#if BYTE_ORDER == BIG_ENDIAN u_int pad1:16; /* reserved */ u_int cp_imp:8; /* implementation identifier */ u_int cp_majrev:4; /* major revision identifier */ u_int cp_minrev:4; /* minor revision identifier */#else u_int cp_minrev:4; /* minor revision identifier */ u_int cp_majrev:4; /* major revision identifier */ u_int cp_imp:8; /* implementation identifier */ u_int pad1:16; /* reserved */#endif } cpu;};/* * CTL_MACHDEP definitions. */#define CPU_CONSDEV 1 /* dev_t: console terminal device */#define CPU_MAXID 2 /* number of valid machdep ids */#define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "console_device", CTLTYPE_STRUCT }, \}#endif /* !_LOCORE */#endif /* _KERNEL *//* * MIPS CPU types (cp_imp). */#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */#define MIPS_R4700 0x21 /* QED R4700 Orion ISA III */#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */#define MIPS_R5000 0x23 /* MIPS R5000 CPU ISA IV */#define MIPS_RM7000 0x27 /* QED RM7000 CPU ISA IV */#define MIPS_RM52X0 0x28 /* QED RM52X0 CPU ISA IV */#define MIPS_E9000 0x34 /* PMC-Sierra E9000 core (RM9k) ISA IV */#define MIPS_VR5400 0x54 /* NEC Vr5400 CPU ISA IV+ *//* * MIPS FPU types */#define MIPS_SOFT 0x00 /* Software emulation ISA I */#define MIPS_R2360 0x01 /* MIPS R2360 FPC ISA I */#define MIPS_R2010 0x02 /* MIPS R2010 FPC ISA I */#define MIPS_R3010 0x03 /* MIPS R3010 FPC ISA I */#define MIPS_R6010 0x04 /* MIPS R6010 FPC ISA II */#define MIPS_R4010 0x05 /* MIPS R4000/R4400 FPC ISA II */#define MIPS_R31LSI 0x06 /* LSI Logic derivate ISA I */#define MIPS_R10010 0x09 /* MIPS R10000/T5 FPU ISA IV */#define MIPS_R4210 0x0a /* MIPS R4200 FPC (ICE) ISA III */#define MIPS_UNKF1 0x0b /* unnanounced product cpu ISA III */#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */#define MIPS_R3SONY 0x21 /* Sony R3000 based FPU ISA I */#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based FPU ISA I */#define MIPS_R5010 0x23 /* MIPS R5000 based FPU ISA IV */#define MIPS_RM7000 0x27 /* QED RM7000 FPU ISA IV */#define MIPS_RM5230 0x28 /* QED RM52X0 based FPU ISA IV */#define MIPS_RM52XX 0x28 /* QED RM52X0 based FPU ISA IV */#define MIPS_VR5400 0x54 /* NEC Vr5400 FPU ISA IV+ */#if defined(_KERNEL) && !defined(_LOCORE)union cpuprid CpuProcessorId;u_int CpuPrimaryInstCacheSize;u_int CpuPrimaryInstCacheLSize;u_int CpuPrimaryInstSetSize;u_int CpuPrimaryDataCacheSize;u_int CpuPrimaryDataCacheLSize;u_int CpuPrimaryDataSetSize;u_int CpuCacheAliasMask;u_int CpuSecondaryCacheSize;u_int CpuTertiaryCacheSize;u_int CpuNWayCache;u_int CpuCacheType; /* R4K, R5K, RM7K */u_int CpuConfigRegister;u_int CpuStatusRegister;u_int CpuExternalCacheOn; /* R5K, RM7K */u_int CpuOnboardCacheOn; /* RM7K */extern struct intr_tab intr_tab[];struct tlb;struct user;void flushcache __P((void));void flushicache __P((void *, size_t));void flushdcache __P((void *, size_t));void syncicache __P((void *, size_t));void delay __P((int));int CPU_ConfigCache __P((void));void CPU_SetWIRED __P((int));void CPU_SetPID __P((int));u_int CPU_GetCOUNT __P((void));u_int CPU_GetCONFIG __P((void));void CPU_SetCOMPARE __P((u_int));int CPU_SetSR __P((u_int, u_int));void CPU_FlushCache __P((void));void CPU_FlushDCache __P((vm_offset_t, int));void CPU_HitFlushDCache __P((vm_offset_t, int));void CPU_IOFlushDCache __P((vm_offset_t, int, int));void CPU_HitInvalidateDCache __P((vm_offset_t, int));void CPU_FlushICache __P((vm_offset_t, int));void CPU_InvalidateICache __P((vm_offset_t, int));void CPU_TLBFlush __P((int));void CPU_TLBFlushAddr __P((vm_offset_t));void CPU_TLBWriteIndexed __P((int, struct tlb *));void CPU_TLBUpdate __P((vm_offset_t, unsigned));void CPU_TLBRead __P((int, struct tlb *));int CPU_Get_Sem (void *, int);void wbflush(void);void savectx(struct user *, int);int copykstack(struct user *);void switch_exit(void);void MipsSaveCurFPState(struct proc *);void a64_write32(u_int64_t, u_int32_t);u_int32_t a64_read32(u_int64_t);extern u_int32_t cpu_counter_interval; /* Number of counter ticks/tick */extern u_int32_t cpu_counter_last; /* Last compare value loaded */#else#ifndef _LOCOREvoid delay __P((int));#endif#endif /* _KERNEL */#endif /* !_MIPS_CPU_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -