1292407Sbr/*-
2292407Sbr * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3292407Sbr * All rights reserved.
4292407Sbr *
5292407Sbr * Portions of this software were developed by SRI International and the
6292407Sbr * University of Cambridge Computer Laboratory under DARPA/AFRL contract
7292407Sbr * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
8292407Sbr *
9292407Sbr * Portions of this software were developed by the University of Cambridge
10292407Sbr * Computer Laboratory as part of the CTSRD Project, with support from the
11292407Sbr * UK Higher Education Innovation Fund (HEIF).
12292407Sbr *
13292407Sbr * Redistribution and use in source and binary forms, with or without
14292407Sbr * modification, are permitted provided that the following conditions
15292407Sbr * are met:
16292407Sbr * 1. Redistributions of source code must retain the above copyright
17292407Sbr *    notice, this list of conditions and the following disclaimer.
18292407Sbr * 2. Redistributions in binary form must reproduce the above copyright
19292407Sbr *    notice, this list of conditions and the following disclaimer in the
20292407Sbr *    documentation and/or other materials provided with the distribution.
21292407Sbr *
22292407Sbr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23292407Sbr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24292407Sbr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25292407Sbr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26292407Sbr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27292407Sbr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28292407Sbr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29292407Sbr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30292407Sbr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31292407Sbr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32292407Sbr * SUCH DAMAGE.
33292407Sbr *
34292407Sbr * $FreeBSD$
35292407Sbr */
36292407Sbr
37292407Sbr#ifndef _MACHINE_FRAME_H_
38292407Sbr#define	_MACHINE_FRAME_H_
39292407Sbr
40292407Sbr#ifndef LOCORE
41292407Sbr
42292407Sbr#include <sys/signal.h>
43292407Sbr#include <sys/ucontext.h>
44292407Sbr
45292407Sbr/*
46292407Sbr * NOTE: keep this structure in sync with struct reg and struct mcontext.
47292407Sbr */
48292407Sbrstruct trapframe {
49292407Sbr	uint64_t tf_ra;
50292407Sbr	uint64_t tf_sp;
51292407Sbr	uint64_t tf_gp;
52292407Sbr	uint64_t tf_tp;
53292407Sbr	uint64_t tf_t[7];
54292407Sbr	uint64_t tf_s[12];
55292407Sbr	uint64_t tf_a[8];
56292407Sbr	uint64_t tf_sepc;
57292407Sbr	uint64_t tf_sstatus;
58292407Sbr	uint64_t tf_sbadaddr;
59292407Sbr	uint64_t tf_scause;
60292407Sbr};
61292407Sbr
62300618Sbrstruct riscv_frame {
63300618Sbr	struct riscv_frame	*f_frame;
64300618Sbr	u_long			f_retaddr;
65300618Sbr};
66300618Sbr
67292407Sbr/*
68292407Sbr * Signal frame. Pushed onto user stack before calling sigcode.
69292407Sbr */
70292407Sbrstruct sigframe {
71292407Sbr	siginfo_t	sf_si;	/* actual saved siginfo */
72292407Sbr	ucontext_t	sf_uc;	/* actual saved ucontext */
73292407Sbr};
74292407Sbr
75292407Sbr#endif /* !LOCORE */
76292407Sbr
77292407Sbr#endif /* !_MACHINE_FRAME_H_ */
78