1178172Simp/* $OpenBSD: reg.h,v 1.1 1998/01/28 11:14:53 pefo Exp $ */ 2178172Simp 3178172Simp/*- 4178172Simp * Copyright (c) 1988 University of Utah. 5178172Simp * Copyright (c) 1992, 1993 6178172Simp * The Regents of the University of California. All rights reserved. 7178172Simp * 8178172Simp * This code is derived from software contributed to Berkeley by 9178172Simp * the Systems Programming Group of the University of Utah Computer 10178172Simp * Science Department and Ralph Campbell. 11178172Simp * 12178172Simp * Redistribution and use in source and binary forms, with or without 13178172Simp * modification, are permitted provided that the following conditions 14178172Simp * are met: 15178172Simp * 1. Redistributions of source code must retain the above copyright 16178172Simp * notice, this list of conditions and the following disclaimer. 17178172Simp * 2. Redistributions in binary form must reproduce the above copyright 18178172Simp * notice, this list of conditions and the following disclaimer in the 19178172Simp * documentation and/or other materials provided with the distribution. 20178172Simp * 4. Neither the name of the University nor the names of its contributors 21178172Simp * may be used to endorse or promote products derived from this software 22178172Simp * without specific prior written permission. 23178172Simp * 24178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34178172Simp * SUCH DAMAGE. 35178172Simp * 36178172Simp * from: Utah Hdr: reg.h 1.1 90/07/09 37178172Simp * @(#)reg.h 8.2 (Berkeley) 1/11/94 38178172Simp * JNPR: reg.h,v 1.6 2006/09/15 12:52:34 katta 39178172Simp * $FreeBSD$ 40178172Simp */ 41178172Simp 42178172Simp#ifndef _MACHINE_REG_H_ 43178172Simp#define _MACHINE_REG_H_ 44178172Simp 45232449Sjmallett#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) 46232449Sjmallett#include "opt_compat.h" 47232449Sjmallett#endif 48232449Sjmallett 49178172Simp/* 50178172Simp * Location of the users' stored registers relative to ZERO. 51178172Simp * must be visible to assembly code. 52178172Simp */ 53178172Simp#include <machine/regnum.h> 54178172Simp 55178172Simp/* 56178172Simp * Register set accessible via /proc/$pid/reg 57178172Simp */ 58178172Simpstruct reg { 59178172Simp register_t r_regs[NUMSAVEREGS]; /* numbered as above */ 60178172Simp}; 61178172Simp 62178172Simpstruct fpreg { 63178172Simp f_register_t r_regs[NUMFPREGS]; 64178172Simp}; 65178172Simp 66178172Simp/* 67178172Simp * Placeholder. 68178172Simp */ 69178172Simpstruct dbreg { 70178172Simp unsigned long junk; 71178172Simp}; 72178172Simp 73281266Sjhb#ifdef __LP64__ 74232449Sjmallett/* Must match struct trapframe */ 75232449Sjmallettstruct reg32 { 76232449Sjmallett uint32_t r_regs[NUMSAVEREGS]; 77232449Sjmallett}; 78232449Sjmallett 79232449Sjmallettstruct fpreg32 { 80232449Sjmallett int32_t r_regs[NUMFPREGS]; 81232449Sjmallett}; 82232449Sjmallett 83232449Sjmallettstruct dbreg32 { 84232449Sjmallett uint32_t junk; 85232449Sjmallett}; 86281266Sjhb 87281266Sjhb#define __HAVE_REG32 88232449Sjmallett#endif 89232449Sjmallett 90178172Simp#ifdef _KERNEL 91178172Simpint fill_fpregs(struct thread *, struct fpreg *); 92178172Simpint fill_regs(struct thread *, struct reg *); 93178172Simpint set_fpregs(struct thread *, struct fpreg *); 94178172Simpint set_regs(struct thread *, struct reg *); 95178172Simpint fill_dbregs(struct thread *, struct dbreg *); 96178172Simpint set_dbregs(struct thread *, struct dbreg *); 97178172Simp#endif 98178172Simp 99232449Sjmallett#ifdef COMPAT_FREEBSD32 100232449Sjmallettstruct image_params; 101232449Sjmallett 102232449Sjmallettint fill_regs32(struct thread *, struct reg32 *); 103232449Sjmallettint set_regs32(struct thread *, struct reg32 *); 104232449Sjmallettint fill_fpregs32(struct thread *, struct fpreg32 *); 105232449Sjmallettint set_fpregs32(struct thread *, struct fpreg32 *); 106232449Sjmallett 107232449Sjmallett#define fill_dbregs32(td, reg) 0 108232449Sjmallett#define set_dbregs32(td, reg) 0 109232449Sjmallett#endif 110232449Sjmallett 111178172Simp#endif /* !_MACHINE_REG_H_ */ 112