cpu.h revision 139790
166458Sdfr/* $FreeBSD: head/sys/ia64/include/cpu.h 139790 2005-01-06 22:18:23Z imp $ */ 266458Sdfr/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ 366458Sdfr 4139790Simp/*- 566458Sdfr * Copyright (c) 1988 University of Utah. 666458Sdfr * Copyright (c) 1982, 1990, 1993 766458Sdfr * The Regents of the University of California. All rights reserved. 866458Sdfr * 966458Sdfr * This code is derived from software contributed to Berkeley by 1066458Sdfr * the Systems Programming Group of the University of Utah Computer 1166458Sdfr * Science Department. 1266458Sdfr * 1366458Sdfr * Redistribution and use in source and binary forms, with or without 1466458Sdfr * modification, are permitted provided that the following conditions 1566458Sdfr * are met: 1666458Sdfr * 1. Redistributions of source code must retain the above copyright 1766458Sdfr * notice, this list of conditions and the following disclaimer. 1866458Sdfr * 2. Redistributions in binary form must reproduce the above copyright 1966458Sdfr * notice, this list of conditions and the following disclaimer in the 2066458Sdfr * documentation and/or other materials provided with the distribution. 2166458Sdfr * 4. Neither the name of the University nor the names of its contributors 2266458Sdfr * may be used to endorse or promote products derived from this software 2366458Sdfr * without specific prior written permission. 2466458Sdfr * 2566458Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2666458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2766458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2866458Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2966458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3066458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3166458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3266458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3366458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3466458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3566458Sdfr * SUCH DAMAGE. 3666458Sdfr * 3766458Sdfr * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 3866458Sdfr * 3966458Sdfr * @(#)cpu.h 8.4 (Berkeley) 1/5/94 4066458Sdfr */ 4166458Sdfr 4266458Sdfr#ifndef _MACHINE_CPU_H_ 4366458Sdfr#define _MACHINE_CPU_H_ 4466458Sdfr 4566458Sdfr#include <machine/frame.h> 4666458Sdfr 4766458Sdfr/* 48115084Smarcel * Arguments to hardclock and gatherstats encapsulate the previous machine 49115084Smarcel * state in an opaque clockframe. 5066458Sdfr */ 5166458Sdfrstruct clockframe { 52115084Smarcel struct trapframe cf_tf; 5366458Sdfr}; 54115084Smarcel#define CLKF_PC(cf) ((cf)->cf_tf.tf_special.iip) 55119159Smarcel#define CLKF_CPL(cf) ((cf)->cf_tf.tf_special.psr & IA64_PSR_CPL) 56120222Smarcel#define CLKF_USERMODE(cf) (CLKF_CPL(cf) != IA64_PSR_CPL_KERN) 57115084Smarcel 58115084Smarcel#define TRAPF_PC(tf) ((tf)->tf_special.iip) 59115913Smarcel#define TRAPF_CPL(tf) ((tf)->tf_special.psr & IA64_PSR_CPL) 60120222Smarcel#define TRAPF_USERMODE(tf) (TRAPF_CPL(tf) != IA64_PSR_CPL_KERN) 6172892Sjhb 6266458Sdfr/* 6366458Sdfr * CTL_MACHDEP definitions. 6466458Sdfr */ 65130764Sbde#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 66118414Smarcel#define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */ 67118414Smarcel#define CPU_DISRTCSET 3 /* int: disable resettodr() call */ 68118414Smarcel#define CPU_WALLCLOCK 4 /* int: indicates wall CMOS clock */ 69118414Smarcel#define CPU_MAXID 5 /* valid machdep IDs */ 7066458Sdfr 7166458Sdfr#define CTL_MACHDEP_NAMES { \ 7266458Sdfr { 0, 0 }, \ 7366458Sdfr { "console_device", CTLTYPE_STRUCT }, \ 7466458Sdfr { "adjkerntz", CTLTYPE_INT }, \ 7566458Sdfr { "disable_rtc_set", CTLTYPE_INT }, \ 7666458Sdfr { "wall_cmos_clock", CTLTYPE_INT }, \ 7766458Sdfr} 7866458Sdfr 7966458Sdfr#ifdef _KERNEL 8066458Sdfr 81134287Smarcel#ifdef GPROF 82134287Smarcelextern char btext[]; 83134287Smarcelextern char etext[]; 84134287Smarcel#endif 85134287Smarcel 8669003Smarkm/* 8769003Smarkm * Return contents of in-cpu fast counter as a sort of "bogo-time" 8869003Smarkm * for non-critical timing. 8969003Smarkm */ 90118990Smarcel#define get_cyclecount ia64_get_itc 9169003Smarkm 92119159Smarcel/* Used by signaling code. */ 93119159Smarcel#define cpu_getstack(td) ((td)->td_frame->tf_special.sp) 94133084Smux#define cpu_spinwait() /* nothing */ 95119159Smarcel 96118990Smarcelvoid cpu_halt(void); 97118990Smarcelvoid cpu_reset(void); 98118990Smarcelvoid fork_trampoline(void); /* MAGIC */ 99118990Smarcelvoid swi_vm(void *); 100118990Smarcel 10166458Sdfr#endif /* _KERNEL */ 10266458Sdfr 10366458Sdfr#endif /* _MACHINE_CPU_H_ */ 104