1178172Simp/* $OpenBSD: cpu.h,v 1.4 1998/09/15 10:50:12 pefo Exp $ */ 2178172Simp 3178172Simp/*- 4178172Simp * Copyright (c) 1992, 1993 5178172Simp * The Regents of the University of California. All rights reserved. 6178172Simp * 7178172Simp * This code is derived from software contributed to Berkeley by 8178172Simp * Ralph Campbell and Rick Macklem. 9178172Simp * 10178172Simp * Redistribution and use in source and binary forms, with or without 11178172Simp * modification, are permitted provided that the following conditions 12178172Simp * are met: 13178172Simp * 1. Redistributions of source code must retain the above copyright 14178172Simp * notice, this list of conditions and the following disclaimer. 15178172Simp * 2. Redistributions in binary form must reproduce the above copyright 16178172Simp * notice, this list of conditions and the following disclaimer in the 17178172Simp * documentation and/or other materials provided with the distribution. 18178172Simp * 4. Neither the name of the University nor the names of its contributors 19178172Simp * may be used to endorse or promote products derived from this software 20178172Simp * without specific prior written permission. 21178172Simp * 22178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32178172Simp * SUCH DAMAGE. 33178172Simp * 34178172Simp * Copyright (C) 1989 Digital Equipment Corporation. 35178172Simp * Permission to use, copy, modify, and distribute this software and 36178172Simp * its documentation for any purpose and without fee is hereby granted, 37178172Simp * provided that the above copyright notice appears in all copies. 38178172Simp * Digital Equipment Corporation makes no representations about the 39178172Simp * suitability of this software for any purpose. It is provided "as is" 40178172Simp * without express or implied warranty. 41178172Simp * 42178172Simp * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 43178172Simp * JNPR: cpu.h,v 1.9.2.2 2007/09/10 08:23:46 girish 44178172Simp * $FreeBSD: stable/11/sys/mips/include/cpu.h 340270 2018-11-08 22:42:55Z jhb $ 45178172Simp */ 46178172Simp 47178172Simp#ifndef _MACHINE_CPU_H_ 48178172Simp#define _MACHINE_CPU_H_ 49178172Simp 50178172Simp#include <machine/endian.h> 51178172Simp 52210039Simp/* BEGIN: these are going away */ 53210039Simp 54203697Sneel#define soft_int_mask(softintr) (1 << ((softintr) + 8)) 55203697Sneel#define hard_int_mask(hardintr) (1 << ((hardintr) + 10)) 56178172Simp 57210039Simp/* END: These are going away */ 58178172Simp 59178172Simp/* 60178172Simp * Exported definitions unique to mips cpu support. 61178172Simp */ 62178172Simp 63178172Simp#ifndef _LOCORE 64206717Sjmallett#include <machine/cpufunc.h> 65178172Simp#include <machine/frame.h> 66209243Sjchandra 67232630Sjmallett#define TRAPF_USERMODE(framep) (((framep)->sr & MIPS_SR_KSU_USER) != 0) 68178172Simp#define TRAPF_PC(framep) ((framep)->pc) 69178172Simp#define cpu_getstack(td) ((td)->td_frame->sp) 70210100Simp#define cpu_setstack(td, nsp) ((td)->td_frame->sp = (nsp)) 71210100Simp#define cpu_spinwait() /* nothing */ 72340270Sjhb#define cpu_lock_delay() DELAY(1) 73178172Simp 74178172Simp/* 75206717Sjmallett * A machine-independent interface to the CPU's counter. 76206717Sjmallett */ 77210158Simp#define get_cyclecount() mips_rd_count() 78253750Savg#endif /* !_LOCORE */ 79178172Simp 80253750Savg#if defined(_KERNEL) && !defined(_LOCORE) 81178172Simp 82178172Simpextern char btext[]; 83178172Simpextern char etext[]; 84178172Simp 85178172Simpvoid swi_vm(void *); 86178172Simpvoid cpu_halt(void); 87178172Simpvoid cpu_reset(void); 88178172Simp 89178172Simp#endif /* _KERNEL */ 90178172Simp#endif /* !_MACHINE_CPU_H_ */ 91