4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / sys / news3400 / include / cpu.h
CommitLineData
af5295ff 1/*
6510e170
KM
2 * Copyright (c) 1992, 1993
3 * 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 *
6510e170 11 * @(#)cpu.h 8.1 (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
af5295ff
KM
34
35/*
6d429c8e
KB
36 * Arguments to hardclock and gatherstats encapsulate the previous
37 * machine state in an opaque clockframe.
af5295ff 38 */
6d429c8e
KB
39struct clockframe {
40 int pc; /* program counter at time of interrupt */
41 int sr; /* status register at time of interrupt */
42};
af5295ff 43
6d429c8e 44#define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV)
af5295ff 45#define CLKF_BASEPRI(framep) \
6d429c8e 46 ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
af5295ff 47#define CLKF_PC(framep) ((framep)->pc)
6d429c8e 48#define CLKF_INTR(framep) (0)
af5295ff
KM
49
50/*
51 * Preempt the current process if in interrupt from user mode,
52 * or after the current trap/syscall if in system mode.
53 */
54#define need_resched() { want_resched = 1; aston(); }
55
56/*
6d429c8e
KB
57 * Give a profiling tick to the current process when the user profiling
58 * buffer pages are invalid. On the PMAX, request an ast to send us
59 * through trap, marking the proc as needing a profiling tick.
af5295ff 60 */
6d429c8e 61#define need_proftick(p) { (p)->p_flag |= SOWEUPC; aston(); }
af5295ff
KM
62
63/*
64 * Notify the current process (p) that it has a signal pending,
65 * process as soon as possible.
66 */
67#define signotify(p) aston()
68
69#define aston() (astpending = 1)
70
71int astpending; /* need to trap before returning to user mode */
72int want_resched; /* resched() was called */
73
74/*
75 * CPU identification, from PRID register.
76 */
77union cpuprid {
78 int cpuprid;
79 struct {
80#if BYTE_ORDER == BIG_ENDIAN
81 u_int pad1:16; /* reserved */
82 u_int cp_imp:8; /* implementation identifier */
83 u_int cp_majrev:4; /* major revision identifier */
84 u_int cp_minrev:4; /* minor revision identifier */
85#else
86 u_int cp_minrev:4; /* minor revision identifier */
87 u_int cp_majrev:4; /* major revision identifier */
88 u_int cp_imp:8; /* implementation identifier */
89 u_int pad1:16; /* reserved */
90#endif
91 } cpu;
92};
93
94/*
95 * MIPS CPU types (cp_imp).
96 */
97#define MIPS_R2000 0x01
98#define MIPS_R3000 0x02
99#define MIPS_R6000 0x03
100#define MIPS_R4000 0x04
101#define MIPS_R6000A 0x06
102
103/*
104 * MIPS FPU types
105 */
106#define MIPS_R2010_FPU 0x02
107#define MIPS_R3010_FPU 0x03
108#define MIPS_R6010_FPU 0x04
109#define MIPS_R4000_FPU 0x05
110
111struct intr_tab {
112 void (*func)(); /* pointer to interrupt routine */
113 int unit; /* logical unit number */
114};
115
116#ifdef KERNEL
117union cpuprid cpu;
118union cpuprid fpu;
119u_int machDataCacheSize;
120u_int machInstCacheSize;
121extern struct intr_tab intr_tab[];
122#endif
123
124#endif /* _CPU_H_ */