xref: /freebsd/sys/arm64/include/frame.h (revision 8c9c3144ccfa3061879b8cec015ee7d1010e4766)
1147b9d04SAndrew Turner /*-
2147b9d04SAndrew Turner  * Copyright (c) 2014 Andrew Turner
3147b9d04SAndrew Turner  * Copyright (c) 2014 The FreeBSD Foundation
4147b9d04SAndrew Turner  * All rights reserved.
5147b9d04SAndrew Turner  *
6147b9d04SAndrew Turner  * This software was developed by Andrew Turner under
7147b9d04SAndrew Turner  * sponsorship from the FreeBSD Foundation.
8147b9d04SAndrew Turner  *
9147b9d04SAndrew Turner  * Redistribution and use in source and binary forms, with or without
10147b9d04SAndrew Turner  * modification, are permitted provided that the following conditions
11147b9d04SAndrew Turner  * are met:
12147b9d04SAndrew Turner  * 1. Redistributions of source code must retain the above copyright
13147b9d04SAndrew Turner  *    notice, this list of conditions and the following disclaimer.
14147b9d04SAndrew Turner  * 2. Redistributions in binary form must reproduce the above copyright
15147b9d04SAndrew Turner  *    notice, this list of conditions and the following disclaimer in the
16147b9d04SAndrew Turner  *    documentation and/or other materials provided with the distribution.
17147b9d04SAndrew Turner  *
18147b9d04SAndrew Turner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19147b9d04SAndrew Turner  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20147b9d04SAndrew Turner  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21147b9d04SAndrew Turner  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22147b9d04SAndrew Turner  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23147b9d04SAndrew Turner  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24147b9d04SAndrew Turner  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25147b9d04SAndrew Turner  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26147b9d04SAndrew Turner  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27147b9d04SAndrew Turner  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28147b9d04SAndrew Turner  * SUCH DAMAGE.
29147b9d04SAndrew Turner  *
30147b9d04SAndrew Turner  * $FreeBSD$
31147b9d04SAndrew Turner  */
32147b9d04SAndrew Turner 
33147b9d04SAndrew Turner #ifndef _MACHINE_FRAME_H_
34147b9d04SAndrew Turner #define	_MACHINE_FRAME_H_
35147b9d04SAndrew Turner 
36147b9d04SAndrew Turner #ifndef LOCORE
37147b9d04SAndrew Turner 
38147b9d04SAndrew Turner #include <sys/signal.h>
39147b9d04SAndrew Turner #include <sys/ucontext.h>
40147b9d04SAndrew Turner 
41147b9d04SAndrew Turner /*
42147b9d04SAndrew Turner  * NOTE: keep this structure in sync with struct reg and struct mcontext.
43147b9d04SAndrew Turner  */
44147b9d04SAndrew Turner struct trapframe {
45147b9d04SAndrew Turner 	uint64_t tf_sp;
46147b9d04SAndrew Turner 	uint64_t tf_lr;
47147b9d04SAndrew Turner 	uint64_t tf_elr;
48f17e4f07SAndrew Turner 	uint32_t tf_spsr;
49f17e4f07SAndrew Turner 	uint32_t tf_esr;
50147b9d04SAndrew Turner 	uint64_t tf_x[30];
51147b9d04SAndrew Turner };
52147b9d04SAndrew Turner 
531c7c13aaSWojciech Macek struct arm64_frame {
541c7c13aaSWojciech Macek 	struct arm64_frame	*f_frame;
551c7c13aaSWojciech Macek 	u_long			f_retaddr;
561c7c13aaSWojciech Macek };
571c7c13aaSWojciech Macek 
58147b9d04SAndrew Turner /*
599c871ab5SAndrew Turner  * Signal frame, pushed onto the user stack.
60147b9d04SAndrew Turner  */
61147b9d04SAndrew Turner struct sigframe {
62147b9d04SAndrew Turner 	siginfo_t       sf_si;          /* actual saved siginfo */
63147b9d04SAndrew Turner 	ucontext_t      sf_uc;          /* actual saved ucontext */
64147b9d04SAndrew Turner };
65147b9d04SAndrew Turner 
66147b9d04SAndrew Turner /*
679c871ab5SAndrew Turner  * There is no fixed frame layout, other than to be 16-byte aligned.
68147b9d04SAndrew Turner  */
69147b9d04SAndrew Turner struct frame {
70147b9d04SAndrew Turner 	int dummy;
71147b9d04SAndrew Turner };
72147b9d04SAndrew Turner 
73*8c9c3144SOlivier Houchard #ifdef COMPAT_FREEBSD32
74*8c9c3144SOlivier Houchard struct sigframe32 {
75*8c9c3144SOlivier Houchard 	struct siginfo32		sf_si;
76*8c9c3144SOlivier Houchard 	ucontext32_t			sf_uc;
77*8c9c3144SOlivier Houchard 	mcontext32_vfp_t		sf_vfp;
78*8c9c3144SOlivier Houchard };
79*8c9c3144SOlivier Houchard #endif /* COMPAT_FREEBSD32 */
80*8c9c3144SOlivier Houchard 
81147b9d04SAndrew Turner #endif /* !LOCORE */
82147b9d04SAndrew Turner 
83147b9d04SAndrew Turner #endif /* !_MACHINE_FRAME_H_ */
84