152131Smckusick /* 252131Smckusick * Copyright (c) 1992 Regents of the University of California. 352131Smckusick * All rights reserved. 452131Smckusick * 552131Smckusick * This code is derived from software contributed to Berkeley by 652131Smckusick * Ralph Campbell. 752131Smckusick * 852131Smckusick * %sccs.include.redist.c% 952131Smckusick * 10*56636Sralph * @(#)cpu.h 7.6 (Berkeley) 10/24/92 1152131Smckusick */ 1252131Smckusick 1352131Smckusick #ifndef _CPU_H_ 1452131Smckusick #define _CPU_H_ 1552131Smckusick 1656523Sbostic #include <machine/machConst.h> 1752131Smckusick 1852131Smckusick /* 1952131Smckusick * Exported definitions unique to pmax/mips cpu support. 2052131Smckusick */ 2152131Smckusick 2252131Smckusick /* 2352131Smckusick * definitions of cpu-dependent requirements 2452131Smckusick * referenced in generic code 2552131Smckusick */ 26*56636Sralph #define COPY_SIGCODE /* copy sigcode above user stack in exec */ 2752131Smckusick 2852744Sralph #define cpu_exec(p) (p->p_md.md_ss_addr = 0) /* init single step */ 2952131Smckusick #define cpu_wait(p) /* nothing */ 3052757Sralph #define cpu_setstack(p, ap) \ 3152757Sralph (p)->p_md.md_regs[SP] = ap 3252131Smckusick 3352131Smckusick /* 3455752Sralph * Arguments to hardclock and gatherstats encapsulate the previous 3555752Sralph * machine state in an opaque clockframe. 3652131Smckusick */ 3755752Sralph struct clockframe { 3855752Sralph int pc; /* program counter at time of interrupt */ 3955752Sralph int sr; /* status register at time of interrupt */ 4055752Sralph }; 4152131Smckusick 4255752Sralph #define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV) 4352131Smckusick #define CLKF_BASEPRI(framep) \ 4455752Sralph ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0) 4552131Smckusick #define CLKF_PC(framep) ((framep)->pc) 4655752Sralph #define CLKF_INTR(framep) (0) 4752131Smckusick 4852131Smckusick /* 4952131Smckusick * Preempt the current process if in interrupt from user mode, 5052131Smckusick * or after the current trap/syscall if in system mode. 5152131Smckusick */ 5252131Smckusick #define need_resched() { want_resched = 1; aston(); } 5352131Smckusick 5452131Smckusick /* 5555752Sralph * Give a profiling tick to the current process when the user profiling 5655752Sralph * buffer pages are invalid. On the PMAX, request an ast to send us 5755752Sralph * through trap, marking the proc as needing a profiling tick. 5852131Smckusick */ 5955752Sralph #define need_proftick(p) { (p)->p_flag |= SOWEUPC; aston(); } 6052131Smckusick 6152131Smckusick /* 6252131Smckusick * Notify the current process (p) that it has a signal pending, 6352131Smckusick * process as soon as possible. 6452131Smckusick */ 6552131Smckusick #define signotify(p) aston() 6652131Smckusick 6752131Smckusick #define aston() (astpending = 1) 6852131Smckusick 6952131Smckusick int astpending; /* need to trap before returning to user mode */ 7052131Smckusick int want_resched; /* resched() was called */ 7152131Smckusick 7252131Smckusick /* 7352131Smckusick * CPU identification, from PRID register. 7452131Smckusick */ 7552131Smckusick union cpuprid { 7652131Smckusick int cpuprid; 7752131Smckusick struct { 7852131Smckusick #if BYTE_ORDER == BIG_ENDIAN 7952131Smckusick u_int pad1:16; /* reserved */ 8052131Smckusick u_int cp_imp:8; /* implementation identifier */ 8152131Smckusick u_int cp_majrev:4; /* major revision identifier */ 8252131Smckusick u_int cp_minrev:4; /* minor revision identifier */ 8352131Smckusick #else 8452131Smckusick u_int cp_minrev:4; /* minor revision identifier */ 8552131Smckusick u_int cp_majrev:4; /* major revision identifier */ 8652131Smckusick u_int cp_imp:8; /* implementation identifier */ 8752131Smckusick u_int pad1:16; /* reserved */ 8852131Smckusick #endif 8952131Smckusick } cpu; 9052131Smckusick }; 9152131Smckusick 9252131Smckusick /* 9352131Smckusick * MIPS CPU types (cp_imp). 9452131Smckusick */ 9552744Sralph #define MIPS_R2000 0x02 9652744Sralph #define MIPS_R3000 0x03 9752744Sralph #define MIPS_R4000 0x04 9852131Smckusick 9952131Smckusick /* 10052131Smckusick * MIPS FPU types 10152131Smckusick */ 10252744Sralph #define MIPS_R2010 0x03 10352744Sralph #define MIPS_R3010 0x04 10452744Sralph #define MIPS_R4010 0x05 10552131Smckusick 10652744Sralph struct intr_tab { 10752744Sralph void (*func)(); /* pointer to interrupt routine */ 10852744Sralph int unit; /* logical unit number */ 10952744Sralph }; 11052744Sralph 11152131Smckusick #ifdef KERNEL 11252131Smckusick union cpuprid cpu; 11352131Smckusick union cpuprid fpu; 11452131Smckusick u_int machDataCacheSize; 11552131Smckusick u_int machInstCacheSize; 11652744Sralph extern struct intr_tab intr_tab[]; 11752131Smckusick #endif 11852131Smckusick 11952131Smckusick /* 12052131Smckusick * Enable realtime clock (always enabled). 12152131Smckusick */ 12252131Smckusick #define enablertclock() 12352131Smckusick 12452131Smckusick #endif /* _CPU_H_ */ 125