156820Sralph /*- 263217Sbostic * Copyright (c) 1992, 1993 363217Sbostic * The Regents of the University of California. All rights reserved. 452131Smckusick * 552131Smckusick * This code is derived from software contributed to Berkeley by 656820Sralph * Ralph Campbell and Rick Macklem. 752131Smckusick * 852131Smckusick * %sccs.include.redist.c% 952131Smckusick * 10*69534Smckusick * @(#)cpu.h 8.5 (Berkeley) 05/17/95 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 */ 2656636Sralph #define COPY_SIGCODE /* copy sigcode above user stack in exec */ 2752131Smckusick 2865072Smckusick #define cpu_exec(p) (p->p_md.md_ss_addr = 0) /* init single step */ 2965072Smckusick #define cpu_wait(p) /* nothing */ 3065072Smckusick #define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap 3165425Smckusick #define cpu_set_init_frame(p, fp) /* nothing */ 32*69534Smckusick #define BACKTRACE(p) /* not implemented */ 3352131Smckusick 3452131Smckusick /* 3555752Sralph * Arguments to hardclock and gatherstats encapsulate the previous 3655752Sralph * machine state in an opaque clockframe. 3752131Smckusick */ 3855752Sralph struct clockframe { 3955752Sralph int pc; /* program counter at time of interrupt */ 4055752Sralph int sr; /* status register at time of interrupt */ 4155752Sralph }; 4252131Smckusick 4355752Sralph #define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV) 4452131Smckusick #define CLKF_BASEPRI(framep) \ 4555752Sralph ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0) 4652131Smckusick #define CLKF_PC(framep) ((framep)->pc) 4755752Sralph #define CLKF_INTR(framep) (0) 4852131Smckusick 4952131Smckusick /* 5052131Smckusick * Preempt the current process if in interrupt from user mode, 5152131Smckusick * or after the current trap/syscall if in system mode. 5252131Smckusick */ 5352131Smckusick #define need_resched() { want_resched = 1; aston(); } 5452131Smckusick 5552131Smckusick /* 5655752Sralph * Give a profiling tick to the current process when the user profiling 5755752Sralph * buffer pages are invalid. On the PMAX, request an ast to send us 5855752Sralph * through trap, marking the proc as needing a profiling tick. 5952131Smckusick */ 6064621Sbostic #define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } 6152131Smckusick 6252131Smckusick /* 6352131Smckusick * Notify the current process (p) that it has a signal pending, 6452131Smckusick * process as soon as possible. 6552131Smckusick */ 6652131Smckusick #define signotify(p) aston() 6752131Smckusick 6852131Smckusick #define aston() (astpending = 1) 6952131Smckusick 7052131Smckusick int astpending; /* need to trap before returning to user mode */ 7152131Smckusick int want_resched; /* resched() was called */ 7252131Smckusick 7352131Smckusick /* 7452131Smckusick * CPU identification, from PRID register. 7552131Smckusick */ 7652131Smckusick union cpuprid { 7752131Smckusick int cpuprid; 7852131Smckusick struct { 7952131Smckusick #if BYTE_ORDER == BIG_ENDIAN 8052131Smckusick u_int pad1:16; /* reserved */ 8152131Smckusick u_int cp_imp:8; /* implementation identifier */ 8252131Smckusick u_int cp_majrev:4; /* major revision identifier */ 8352131Smckusick u_int cp_minrev:4; /* minor revision identifier */ 8452131Smckusick #else 8552131Smckusick u_int cp_minrev:4; /* minor revision identifier */ 8652131Smckusick u_int cp_majrev:4; /* major revision identifier */ 8752131Smckusick u_int cp_imp:8; /* implementation identifier */ 8852131Smckusick u_int pad1:16; /* reserved */ 8952131Smckusick #endif 9052131Smckusick } cpu; 9152131Smckusick }; 9252131Smckusick 9352131Smckusick /* 9460305Sralph * CTL_MACHDEP definitions. 9560305Sralph */ 9660305Sralph #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 9760305Sralph #define CPU_MAXID 2 /* number of valid machdep ids */ 9860305Sralph 9960305Sralph #define CTL_MACHDEP_NAMES { \ 10060305Sralph { 0, 0 }, \ 10160305Sralph { "console_device", CTLTYPE_STRUCT }, \ 10260305Sralph } 10360305Sralph 10460305Sralph /* 10552131Smckusick * MIPS CPU types (cp_imp). 10652131Smckusick */ 10756820Sralph #define MIPS_R2000 0x01 10856820Sralph #define MIPS_R3000 0x02 10956820Sralph #define MIPS_R6000 0x03 11052744Sralph #define MIPS_R4000 0x04 11156820Sralph #define MIPS_R6000A 0x06 11252131Smckusick 11352131Smckusick /* 11452131Smckusick * MIPS FPU types 11552131Smckusick */ 11656820Sralph #define MIPS_R2010 0x02 11756820Sralph #define MIPS_R3010 0x03 11856820Sralph #define MIPS_R6010 0x04 11952744Sralph #define MIPS_R4010 0x05 12052131Smckusick 12152131Smckusick #ifdef KERNEL 12252131Smckusick union cpuprid cpu; 12352131Smckusick union cpuprid fpu; 12452131Smckusick u_int machDataCacheSize; 12552131Smckusick u_int machInstCacheSize; 12652744Sralph extern struct intr_tab intr_tab[]; 12752131Smckusick #endif 12852131Smckusick 12952131Smckusick /* 13052131Smckusick * Enable realtime clock (always enabled). 13152131Smckusick */ 13252131Smckusick #define enablertclock() 13352131Smckusick 13452131Smckusick #endif /* _CPU_H_ */ 135