xref: /csrg-svn/sys/i386/include/cpu.h (revision 69531)
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*69531Smckusick  *	@(#)cpu.h	8.5 (Berkeley) 05/17/95
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  */
2365069Smckusick #undef	COPY_SIGCODE	/* don't copy sigcode above user stack in exec */
2449244Skarels 
2565069Smckusick #define	cpu_exec(p)			/* nothing */
2665498Smckusick #define	cpu_swapin(p)			/* nothing */
2765069Smckusick #define cpu_setstack(p, ap)		(p)->p_md.md_regs[SP] = ap
2865069Smckusick #define cpu_set_init_frame(p, fp)	(p)->p_md.md_regs = fp
29*69531Smckusick #define	BACKTRACE(p)			/* not implemented */
3049244Skarels 
3149244Skarels /*
3249244Skarels  * Arguments to hardclock, softclock and gatherstats
3349244Skarels  * encapsulate the previous machine state in an opaque
3449244Skarels  * clockframe; for now, use generic intrframe.
3549244Skarels  */
3663171Scgd struct clockframe {
3763171Scgd 	struct intrframe	cf_if;
3863171Scgd };
3949244Skarels 
4063171Scgd #define	CLKF_USERMODE(framep)	(ISPL((framep)->cf_if.if_cs) == SEL_UPL)
4163171Scgd #define	CLKF_BASEPRI(framep)	((framep)->cf_if.if_ppl == 0)
4263171Scgd #define	CLKF_PC(framep)		((framep)->cf_if.if_eip)
4349244Skarels 
4440453Sbill #define	resettodr()	/* no todr to set */
4540453Sbill 
4649244Skarels /*
4749244Skarels  * Preempt the current process if in interrupt from user mode,
4849244Skarels  * or after the current trap/syscall if in system mode.
4949244Skarels  */
5049244Skarels #define	need_resched()	{ want_resched++; aston(); }
5149244Skarels 
5249244Skarels /*
5349244Skarels  * Give a profiling tick to the current process from the softclock
5449244Skarels  * interrupt.  On tahoe, request an ast to send us through trap(),
5549244Skarels  * marking the proc as needing a profiling tick.
5649244Skarels  */
5764633Sbostic #define	profile_tick(p, framep)	{ (p)->p_flag |= P_OWEUPC; aston(); }
5849244Skarels 
5949244Skarels /*
6049244Skarels  * Notify the current process (p) that it has a signal pending,
6149244Skarels  * process as soon as possible.
6249244Skarels  */
6349244Skarels #define	signotify(p)	aston()
6449244Skarels 
6549244Skarels #define aston() (astpending++)
6649244Skarels 
6749244Skarels int	astpending;		/* need to trap before returning to user mode */
6849244Skarels int	want_resched;		/* resched() was called */
6949244Skarels 
7049244Skarels /*
7149244Skarels  * Kinds of processor
7249244Skarels  */
7349244Skarels 
7449244Skarels #define	CPU_386SX	0
7549244Skarels #define	CPU_386		1
7649244Skarels #define	CPU_486SX	2
7749244Skarels #define	CPU_486		3
7849244Skarels #define	CPU_586		4
7960205Smckusick 
8060205Smckusick /*
8160205Smckusick  * CTL_MACHDEP definitions.
8260205Smckusick  */
8360205Smckusick #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
8460205Smckusick #define	CPU_MAXID		2	/* number of valid machdep ids */
8560205Smckusick 
8660205Smckusick #define CTL_MACHDEP_NAMES { \
8760205Smckusick 	{ 0, 0 }, \
8860205Smckusick 	{ "console_device", CTLTYPE_STRUCT }, \
8960205Smckusick }
90