xref: /original-bsd/sys/i386/include/cpu.h (revision 89af8021)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * 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	5.6 (Berkeley) 10/11/92
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 /*
26  * function vs. inline configuration;
27  * these are defined to get generic functions
28  * rather than inline or machine-dependent implementations
29  */
30 #define	NEED_MINMAX		/* need {,i,l,ul}{min,max} functions */
31 #define	NEED_FFS		/* need ffs function */
32 #define	NEED_BCMP		/* need bcmp function */
33 #define	NEED_STRLEN		/* need strlen function */
34 
35 #define	cpu_exec(p)	/* nothing */
36 #define cpu_setstack(p, ap) \
37 	(p)->p_md.md_regs[SP] = ap
38 
39 /*
40  * Arguments to hardclock, softclock and gatherstats
41  * encapsulate the previous machine state in an opaque
42  * clockframe; for now, use generic intrframe.
43  */
44 typedef struct intrframe clockframe;
45 
46 #define	CLKF_USERMODE(framep)	(ISPL((framep)->if_cs) == SEL_UPL)
47 #define	CLKF_BASEPRI(framep)	((framep)->if_ppl == 0)
48 #define	CLKF_PC(framep)		((framep)->if_eip)
49 
50 #define	resettodr()	/* no todr to set */
51 
52 /*
53  * Preempt the current process if in interrupt from user mode,
54  * or after the current trap/syscall if in system mode.
55  */
56 #define	need_resched()	{ want_resched++; aston(); }
57 
58 /*
59  * Give a profiling tick to the current process from the softclock
60  * interrupt.  On tahoe, request an ast to send us through trap(),
61  * marking the proc as needing a profiling tick.
62  */
63 #define	profile_tick(p, framep)	{ (p)->p_flag |= SOWEUPC; aston(); }
64 
65 /*
66  * Notify the current process (p) that it has a signal pending,
67  * process as soon as possible.
68  */
69 #define	signotify(p)	aston()
70 
71 #define aston() (astpending++)
72 
73 int	astpending;		/* need to trap before returning to user mode */
74 int	want_resched;		/* resched() was called */
75 
76 /*
77  * Kinds of processor
78  */
79 
80 #define	CPU_386SX	0
81 #define	CPU_386		1
82 #define	CPU_486SX	2
83 #define	CPU_486		3
84 #define	CPU_586		4
85