Commit | Line | Data |
---|---|---|
af5295ff | 1 | /* |
6510e170 | 2 | * Copyright (c) 1992, 1993 |
6d974d6c | 3 | * The Regents of the University of California. All rights reserved. |
af5295ff KM |
4 | * |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Ralph Campbell and Kazumasa Utashiro of Software Research | |
7 | * Associates, Inc. | |
8 | * | |
9 | * %sccs.include.redist.c% | |
10 | * | |
660038a9 | 11 | * @(#)cpu.h 8.3 (Berkeley) %G% |
af5295ff KM |
12 | */ |
13 | ||
14 | #ifndef _CPU_H_ | |
15 | #define _CPU_H_ | |
16 | ||
5b7c2955 | 17 | #include <machine/machConst.h> |
af5295ff KM |
18 | |
19 | /* | |
20 | * Exported definitions unique to pmax/mips cpu support. | |
21 | */ | |
22 | ||
23 | /* | |
24 | * definitions of cpu-dependent requirements | |
25 | * referenced in generic code | |
26 | */ | |
182bb10a | 27 | #define COPY_SIGCODE /* copy sigcode above user stack in exec */ |
af5295ff | 28 | |
715a14be | 29 | #define cpu_exec(p) (p->p_md.md_ss_addr = 0) /* init single step */ |
0d5163d6 | 30 | #define cpu_swapin(p) /* nothing */ |
715a14be KM |
31 | #define cpu_wait(p) /* nothing */ |
32 | #define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap | |
33 | #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp | |
660038a9 | 34 | #define BACKTRACE(p) /* not implemented */ |
af5295ff KM |
35 | |
36 | /* | |
6d429c8e KB |
37 | * Arguments to hardclock and gatherstats encapsulate the previous |
38 | * machine state in an opaque clockframe. | |
af5295ff | 39 | */ |
6d429c8e KB |
40 | struct clockframe { |
41 | int pc; /* program counter at time of interrupt */ | |
42 | int sr; /* status register at time of interrupt */ | |
43 | }; | |
af5295ff | 44 | |
6d429c8e | 45 | #define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV) |
af5295ff | 46 | #define CLKF_BASEPRI(framep) \ |
6d429c8e | 47 | ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0) |
af5295ff | 48 | #define CLKF_PC(framep) ((framep)->pc) |
6d429c8e | 49 | #define CLKF_INTR(framep) (0) |
af5295ff KM |
50 | |
51 | /* | |
52 | * Preempt the current process if in interrupt from user mode, | |
53 | * or after the current trap/syscall if in system mode. | |
54 | */ | |
55 | #define need_resched() { want_resched = 1; aston(); } | |
56 | ||
57 | /* | |
6d429c8e KB |
58 | * Give a profiling tick to the current process when the user profiling |
59 | * buffer pages are invalid. On the PMAX, request an ast to send us | |
60 | * through trap, marking the proc as needing a profiling tick. | |
af5295ff | 61 | */ |
6d429c8e | 62 | #define need_proftick(p) { (p)->p_flag |= SOWEUPC; aston(); } |
af5295ff KM |
63 | |
64 | /* | |
65 | * Notify the current process (p) that it has a signal pending, | |
66 | * process as soon as possible. | |
67 | */ | |
68 | #define signotify(p) aston() | |
69 | ||
70 | #define aston() (astpending = 1) | |
71 | ||
72 | int astpending; /* need to trap before returning to user mode */ | |
73 | int want_resched; /* resched() was called */ | |
74 | ||
75 | /* | |
76 | * CPU identification, from PRID register. | |
77 | */ | |
78 | union cpuprid { | |
79 | int cpuprid; | |
80 | struct { | |
81 | #if BYTE_ORDER == BIG_ENDIAN | |
82 | u_int pad1:16; /* reserved */ | |
83 | u_int cp_imp:8; /* implementation identifier */ | |
84 | u_int cp_majrev:4; /* major revision identifier */ | |
85 | u_int cp_minrev:4; /* minor revision identifier */ | |
86 | #else | |
87 | u_int cp_minrev:4; /* minor revision identifier */ | |
88 | u_int cp_majrev:4; /* major revision identifier */ | |
89 | u_int cp_imp:8; /* implementation identifier */ | |
90 | u_int pad1:16; /* reserved */ | |
91 | #endif | |
92 | } cpu; | |
93 | }; | |
94 | ||
95 | /* | |
96 | * MIPS CPU types (cp_imp). | |
97 | */ | |
98 | #define MIPS_R2000 0x01 | |
99 | #define MIPS_R3000 0x02 | |
100 | #define MIPS_R6000 0x03 | |
101 | #define MIPS_R4000 0x04 | |
102 | #define MIPS_R6000A 0x06 | |
103 | ||
104 | /* | |
105 | * MIPS FPU types | |
106 | */ | |
107 | #define MIPS_R2010_FPU 0x02 | |
108 | #define MIPS_R3010_FPU 0x03 | |
109 | #define MIPS_R6010_FPU 0x04 | |
110 | #define MIPS_R4000_FPU 0x05 | |
111 | ||
112 | struct intr_tab { | |
113 | void (*func)(); /* pointer to interrupt routine */ | |
114 | int unit; /* logical unit number */ | |
115 | }; | |
116 | ||
117 | #ifdef KERNEL | |
118 | union cpuprid cpu; | |
119 | union cpuprid fpu; | |
120 | u_int machDataCacheSize; | |
121 | u_int machInstCacheSize; | |
122 | extern struct intr_tab intr_tab[]; | |
123 | #endif | |
124 | ||
125 | #endif /* _CPU_H_ */ |