xref: /original-bsd/sys/i386/include/cpu.h (revision f17085de)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * William Jolitz.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)cpu.h	8.5 (Berkeley) 05/17/95
11  */
12 
13 /*
14  * Definitions unique to i386 cpu support.
15  */
16 #include <machine/frame.h>
17 #include <machine/segments.h>
18 
19 /*
20  * definitions of cpu-dependent requirements
21  * referenced in generic code
22  */
23 #undef	COPY_SIGCODE	/* don't copy sigcode above user stack in exec */
24 
25 #define	cpu_exec(p)			/* nothing */
26 #define	cpu_swapin(p)			/* nothing */
27 #define cpu_setstack(p, ap)		(p)->p_md.md_regs[SP] = ap
28 #define cpu_set_init_frame(p, fp)	(p)->p_md.md_regs = fp
29 #define	BACKTRACE(p)			/* not implemented */
30 
31 /*
32  * Arguments to hardclock, softclock and gatherstats
33  * encapsulate the previous machine state in an opaque
34  * clockframe; for now, use generic intrframe.
35  */
36 struct clockframe {
37 	struct intrframe	cf_if;
38 };
39 
40 #define	CLKF_USERMODE(framep)	(ISPL((framep)->cf_if.if_cs) == SEL_UPL)
41 #define	CLKF_BASEPRI(framep)	((framep)->cf_if.if_ppl == 0)
42 #define	CLKF_PC(framep)		((framep)->cf_if.if_eip)
43 
44 #define	resettodr()	/* no todr to set */
45 
46 /*
47  * Preempt the current process if in interrupt from user mode,
48  * or after the current trap/syscall if in system mode.
49  */
50 #define	need_resched()	{ want_resched++; aston(); }
51 
52 /*
53  * Give a profiling tick to the current process from the softclock
54  * interrupt.  On tahoe, request an ast to send us through trap(),
55  * marking the proc as needing a profiling tick.
56  */
57 #define	profile_tick(p, framep)	{ (p)->p_flag |= P_OWEUPC; aston(); }
58 
59 /*
60  * Notify the current process (p) that it has a signal pending,
61  * process as soon as possible.
62  */
63 #define	signotify(p)	aston()
64 
65 #define aston() (astpending++)
66 
67 int	astpending;		/* need to trap before returning to user mode */
68 int	want_resched;		/* resched() was called */
69 
70 /*
71  * Kinds of processor
72  */
73 
74 #define	CPU_386SX	0
75 #define	CPU_386		1
76 #define	CPU_486SX	2
77 #define	CPU_486		3
78 #define	CPU_586		4
79 
80 /*
81  * CTL_MACHDEP definitions.
82  */
83 #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
84 #define	CPU_MAXID		2	/* number of valid machdep ids */
85 
86 #define CTL_MACHDEP_NAMES { \
87 	{ 0, 0 }, \
88 	{ "console_device", CTLTYPE_STRUCT }, \
89 }
90