xref: /csrg-svn/sys/i386/include/cpu.h (revision 65069)
141059Swilliam /*-
263359Sbostic  * Copyright (c) 1990, 1993
363359Sbostic  *	The Regents of the University of California.  All rights reserved.
440453Sbill  *
541059Swilliam  * This code is derived from software contributed to Berkeley by
641059Swilliam  * William Jolitz.
741059Swilliam  *
846006Swilliam  * %sccs.include.redist.c%
941059Swilliam  *
10*65069Smckusick  *	@(#)cpu.h	8.3 (Berkeley) 12/10/93
1140453Sbill  */
1240453Sbill 
1349244Skarels /*
1449244Skarels  * Definitions unique to i386 cpu support.
1549244Skarels  */
1656512Sbostic #include <machine/frame.h>
1756512Sbostic #include <machine/segments.h>
1849244Skarels 
1949244Skarels /*
2049244Skarels  * definitions of cpu-dependent requirements
2149244Skarels  * referenced in generic code
2249244Skarels  */
23*65069Smckusick #undef	COPY_SIGCODE	/* don't copy sigcode above user stack in exec */
2449244Skarels 
25*65069Smckusick #define	cpu_exec(p)			/* nothing */
26*65069Smckusick #define cpu_setstack(p, ap)		(p)->p_md.md_regs[SP] = ap
27*65069Smckusick #define cpu_set_init_frame(p, fp)	(p)->p_md.md_regs = fp
2849244Skarels 
2949244Skarels /*
3049244Skarels  * Arguments to hardclock, softclock and gatherstats
3149244Skarels  * encapsulate the previous machine state in an opaque
3249244Skarels  * clockframe; for now, use generic intrframe.
3349244Skarels  */
3463171Scgd struct clockframe {
3563171Scgd 	struct intrframe	cf_if;
3663171Scgd };
3749244Skarels 
3863171Scgd #define	CLKF_USERMODE(framep)	(ISPL((framep)->cf_if.if_cs) == SEL_UPL)
3963171Scgd #define	CLKF_BASEPRI(framep)	((framep)->cf_if.if_ppl == 0)
4063171Scgd #define	CLKF_PC(framep)		((framep)->cf_if.if_eip)
4149244Skarels 
4240453Sbill #define	resettodr()	/* no todr to set */
4340453Sbill 
4449244Skarels /*
4549244Skarels  * Preempt the current process if in interrupt from user mode,
4649244Skarels  * or after the current trap/syscall if in system mode.
4749244Skarels  */
4849244Skarels #define	need_resched()	{ want_resched++; aston(); }
4949244Skarels 
5049244Skarels /*
5149244Skarels  * Give a profiling tick to the current process from the softclock
5249244Skarels  * interrupt.  On tahoe, request an ast to send us through trap(),
5349244Skarels  * marking the proc as needing a profiling tick.
5449244Skarels  */
5564633Sbostic #define	profile_tick(p, framep)	{ (p)->p_flag |= P_OWEUPC; aston(); }
5649244Skarels 
5749244Skarels /*
5849244Skarels  * Notify the current process (p) that it has a signal pending,
5949244Skarels  * process as soon as possible.
6049244Skarels  */
6149244Skarels #define	signotify(p)	aston()
6249244Skarels 
6349244Skarels #define aston() (astpending++)
6449244Skarels 
6549244Skarels int	astpending;		/* need to trap before returning to user mode */
6649244Skarels int	want_resched;		/* resched() was called */
6749244Skarels 
6849244Skarels /*
6949244Skarels  * Kinds of processor
7049244Skarels  */
7149244Skarels 
7249244Skarels #define	CPU_386SX	0
7349244Skarels #define	CPU_386		1
7449244Skarels #define	CPU_486SX	2
7549244Skarels #define	CPU_486		3
7649244Skarels #define	CPU_586		4
7760205Smckusick 
7860205Smckusick /*
7960205Smckusick  * CTL_MACHDEP definitions.
8060205Smckusick  */
8160205Smckusick #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
8260205Smckusick #define	CPU_MAXID		2	/* number of valid machdep ids */
8360205Smckusick 
8460205Smckusick #define CTL_MACHDEP_NAMES { \
8560205Smckusick 	{ 0, 0 }, \
8660205Smckusick 	{ "console_device", CTLTYPE_STRUCT }, \
8760205Smckusick }
88