xref: /original-bsd/sys/i386/include/cpu.h (revision cfa2a17a)
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.4 (Berkeley) 05/09/91
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 
37 /*
38  * Arguments to hardclock, softclock and gatherstats
39  * encapsulate the previous machine state in an opaque
40  * clockframe; for now, use generic intrframe.
41  */
42 typedef struct intrframe clockframe;
43 
44 #define	CLKF_USERMODE(framep)	(ISPL((framep)->if_cs) == SEL_UPL)
45 #define	CLKF_BASEPRI(framep)	((framep)->if_ppl == 0)
46 #define	CLKF_PC(framep)		((framep)->if_eip)
47 
48 #define	resettodr()	/* no todr to set */
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++; aston(); }
55 
56 /*
57  * Give a profiling tick to the current process from the softclock
58  * interrupt.  On tahoe, request an ast to send us through trap(),
59  * marking the proc as needing a profiling tick.
60  */
61 #define	profile_tick(p, framep)	{ (p)->p_flag |= SOWEUPC; aston(); }
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++)
70 
71 int	astpending;		/* need to trap before returning to user mode */
72 int	want_resched;		/* resched() was called */
73 
74 /*
75  * Kinds of processor
76  */
77 
78 #define	CPU_386SX	0
79 #define	CPU_386		1
80 #define	CPU_486SX	2
81 #define	CPU_486		3
82 #define	CPU_586		4
83