1139804Simp/*	$OpenBSD: reg.h,v 1.1 1998/01/28 11:14:53 pefo Exp $	*/
24Srgrimes
34Srgrimes/*-
44Srgrimes * Copyright (c) 1988 University of Utah.
54Srgrimes * Copyright (c) 1992, 1993
64Srgrimes *	The Regents of the University of California.  All rights reserved.
74Srgrimes *
84Srgrimes * This code is derived from software contributed to Berkeley by
94Srgrimes * the Systems Programming Group of the University of Utah Computer
104Srgrimes * Science Department and Ralph Campbell.
114Srgrimes *
124Srgrimes * Redistribution and use in source and binary forms, with or without
134Srgrimes * modification, are permitted provided that the following conditions
144Srgrimes * are met:
154Srgrimes * 1. Redistributions of source code must retain the above copyright
164Srgrimes *    notice, this list of conditions and the following disclaimer.
174Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
184Srgrimes *    notice, this list of conditions and the following disclaimer in the
194Srgrimes *    documentation and/or other materials provided with the distribution.
204Srgrimes * 4. Neither the name of the University nor the names of its contributors
214Srgrimes *    may be used to endorse or promote products derived from this software
224Srgrimes *    without specific prior written permission.
234Srgrimes *
244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
274Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34620Srgrimes * SUCH DAMAGE.
354Srgrimes *
364Srgrimes *	from: Utah Hdr: reg.h 1.1 90/07/09
37116182Sobrien *	@(#)reg.h	8.2 (Berkeley) 1/11/94
38116182Sobrien *	JNPR: reg.h,v 1.6 2006/09/15 12:52:34 katta
39116182Sobrien * $FreeBSD: releng/10.3/sys/mips/include/reg.h 283910 2015-06-02 14:54:53Z jhb $
4087649Sguido */
4187649Sguido
422056Swollman#ifndef _MACHINE_REG_H_
431549Srgrimes#define	_MACHINE_REG_H_
445764Sbde
4556525Sbde#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE)
4685448Sjlemon#include "opt_compat.h"
47131931Smarcel#endif
4812675Sjulian
4985373Sjlemon/*
50116663Siedowse * Location of the users' stored registers relative to ZERO.
5185373Sjlemon * must be visible to assembly code.
5269929Sobrien */
5385373Sjlemon#include <machine/regnum.h>
5418951Sjulian
5512701Sphk/*
562056Swollman * Register set accessible via /proc/$pid/reg
5734924Sbde */
5885373Sjlemonstruct reg {
594Srgrimes	register_t r_regs[NUMSAVEREGS];	/* numbered as above */
6087620Sguido};
6187620Sguido
6212701Sphkstruct fpreg {
634Srgrimes	f_register_t r_regs[NUMFPREGS];
6412675Sjulian};
6512675Sjulian
6612675Sjulian/*
6712675Sjulian * Placeholder.
6812675Sjulian */
6929368Speterstruct dbreg {
7072521Sjlemon	unsigned long junk;
7112675Sjulian};
72125810Sphk
73125810Sphk#ifdef __LP64__
74125810Sphk/* Must match struct trapframe */
75125810Sphkstruct reg32 {
76125810Sphk	uint32_t r_regs[NUMSAVEREGS];
7747625Sphk};
78126080Sphk
79111815Sphkstruct fpreg32 {
80111815Sphk	int32_t r_regs[NUMFPREGS];
81111815Sphk};
82111815Sphk
83111815Sphkstruct dbreg32 {
84111815Sphk	uint32_t junk;
85111815Sphk};
86112035Sphk
87126080Sphk#define __HAVE_REG32
88111815Sphk#endif
8938485Sbde
9012675Sjulian#ifdef _KERNEL
9185373Sjlemonint	fill_fpregs(struct thread *, struct fpreg *);
9285373Sjlemonint	fill_regs(struct thread *, struct reg *);
9385373Sjlemonint	set_fpregs(struct thread *, struct fpreg *);
9485373Sjlemonint	set_regs(struct thread *, struct reg *);
9585373Sjlemonint	fill_dbregs(struct thread *, struct dbreg *);
9685373Sjlemonint	set_dbregs(struct thread *, struct dbreg *);
9785373Sjlemon#endif
9885373Sjlemon
9985373Sjlemon#ifdef COMPAT_FREEBSD32
10085373Sjlemonstruct image_params;
10185373Sjlemon
10285373Sjlemonint	fill_regs32(struct thread *, struct reg32 *);
10385373Sjlemonint	set_regs32(struct thread *, struct reg32 *);
10485373Sjlemonint	fill_fpregs32(struct thread *, struct fpreg32 *);
10585373Sjlemonint	set_fpregs32(struct thread *, struct fpreg32 *);
10685373Sjlemon
107130640Sphk#define	fill_dbregs32(td, reg)	0
10841612Seivind#define	set_dbregs32(td, reg)	0
109130585Sphk#endif
11027982Sjulian
111125467Skan#endif /* !_MACHINE_REG_H_ */
112125467Skan