166458Sdfr/* $FreeBSD$ */
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
47115084Smarcel#define	TRAPF_PC(tf)		((tf)->tf_special.iip)
48115913Smarcel#define	TRAPF_CPL(tf)		((tf)->tf_special.psr & IA64_PSR_CPL)
49120222Smarcel#define	TRAPF_USERMODE(tf)	(TRAPF_CPL(tf) != IA64_PSR_CPL_KERN)
5072892Sjhb
5166458Sdfr#ifdef _KERNEL
5266458Sdfr
53134287Smarcel#ifdef GPROF
54134287Smarcelextern char btext[];
55134287Smarcelextern char etext[];
56134287Smarcel#endif
57134287Smarcel
5869003Smarkm/*
5969003Smarkm * Return contents of in-cpu fast counter as a sort of "bogo-time"
6069003Smarkm * for non-critical timing.
6169003Smarkm */
62118990Smarcel#define	get_cyclecount		ia64_get_itc
6369003Smarkm
64119159Smarcel/* Used by signaling code. */
65119159Smarcel#define	cpu_getstack(td)	((td)->td_frame->tf_special.sp)
66133084Smux#define	cpu_spinwait()		/* nothing */
67119159Smarcel
68118990Smarcelvoid	cpu_halt(void);
69118990Smarcelvoid	cpu_reset(void);
70118990Smarcelvoid	fork_trampoline(void);				/* MAGIC */
71118990Smarcelvoid	swi_vm(void *);
72118990Smarcel
7366458Sdfr#endif /* _KERNEL */
7466458Sdfr
7566458Sdfr#endif /* _MACHINE_CPU_H_ */
76