1993-06-12 14:58:17 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* William Jolitz.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1993-10-08 20:51:00 +00:00
|
|
|
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1993-06-12 14:58:17 +00:00
|
|
|
*/
|
|
|
|
|
1993-11-07 17:43:17 +00:00
|
|
|
#ifndef _MACHINE_CPU_H_
|
1994-09-18 21:37:56 +00:00
|
|
|
#define _MACHINE_CPU_H_
|
1993-11-07 17:43:17 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Definitions unique to i386 cpu support.
|
|
|
|
*/
|
1997-08-09 00:04:06 +00:00
|
|
|
#include <machine/psl.h>
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <machine/frame.h>
|
|
|
|
#include <machine/segments.h>
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* definitions of cpu-dependent requirements
|
|
|
|
* referenced in generic code
|
|
|
|
*/
|
|
|
|
#undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */
|
|
|
|
|
|
|
|
#define cpu_exec(p) /* nothing */
|
2004-08-03 18:44:27 +00:00
|
|
|
#define cpu_swapin(p) /* nothing */
|
2003-05-01 01:05:25 +00:00
|
|
|
#define cpu_getstack(td) ((td)->td_frame->tf_rsp)
|
2004-08-03 18:44:27 +00:00
|
|
|
#define cpu_setstack(td, ap) ((td)->td_frame->tf_rsp = (ap))
|
|
|
|
#define cpu_spinwait() ia32_pause()
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2001-02-10 02:20:34 +00:00
|
|
|
#define TRAPF_USERMODE(framep) \
|
2003-05-01 01:05:25 +00:00
|
|
|
(ISPL((framep)->tf_cs) == SEL_UPL)
|
|
|
|
#define TRAPF_PC(framep) ((framep)->tf_rip)
|
2001-02-10 02:20:34 +00:00
|
|
|
|
1997-08-09 00:04:06 +00:00
|
|
|
#define CLKF_USERMODE(framep) \
|
2003-05-01 01:05:25 +00:00
|
|
|
(ISPL((framep)->cf_cs) == SEL_UPL)
|
|
|
|
#define CLKF_PC(framep) ((framep)->cf_rip)
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1994-05-25 09:21:21 +00:00
|
|
|
/*
|
|
|
|
* CTL_MACHDEP definitions.
|
|
|
|
*/
|
2004-06-20 03:52:50 +00:00
|
|
|
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
|
1996-04-05 03:36:31 +00:00
|
|
|
#define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */
|
1996-03-29 14:14:07 +00:00
|
|
|
#define CPU_DISRTCSET 3 /* int: disable resettodr() call */
|
1996-04-05 03:36:31 +00:00
|
|
|
#define CPU_WALLCLOCK 5 /* int: indicates wall CMOS clock */
|
|
|
|
#define CPU_MAXID 6 /* number of valid machdep ids */
|
1994-05-25 09:21:21 +00:00
|
|
|
|
1999-12-29 04:46:21 +00:00
|
|
|
#ifdef _KERNEL
|
1997-10-27 17:23:18 +00:00
|
|
|
extern char btext[];
|
|
|
|
extern char etext[];
|
1997-04-07 07:16:06 +00:00
|
|
|
|
2003-08-16 16:57:57 +00:00
|
|
|
void cpu_halt(void);
|
|
|
|
void cpu_reset(void);
|
2002-03-20 05:48:58 +00:00
|
|
|
void fork_trampoline(void);
|
2003-08-16 16:57:57 +00:00
|
|
|
void swi_vm(void *);
|
2000-11-21 19:55:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return contents of in-cpu fast counter as a sort of "bogo-time"
|
2003-02-05 08:55:10 +00:00
|
|
|
* for random-harvesting purposes.
|
2000-11-21 19:55:21 +00:00
|
|
|
*/
|
|
|
|
static __inline u_int64_t
|
|
|
|
get_cyclecount(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
return (rdtsc());
|
|
|
|
}
|
|
|
|
|
1993-10-08 20:51:00 +00:00
|
|
|
#endif
|
1994-09-18 21:37:56 +00:00
|
|
|
|
|
|
|
#endif /* !_MACHINE_CPU_H_ */
|