xref: /freebsd/sys/arm64/include/frame.h (revision 2ecbbcc7cabdc0147e54ffa90c90efcc33afadd8)
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;
48*2ecbbcc7SZachary Leaf 	uint64_t tf_spsr;
49*2ecbbcc7SZachary Leaf 	uint64_t tf_esr;
50*2ecbbcc7SZachary Leaf 	uint64_t pad; /* struct must be 16B aligned */
51147b9d04SAndrew Turner 	uint64_t tf_x[30];
52147b9d04SAndrew Turner };
53147b9d04SAndrew Turner 
541c7c13aaSWojciech Macek struct arm64_frame {
551c7c13aaSWojciech Macek 	struct arm64_frame	*f_frame;
561c7c13aaSWojciech Macek 	u_long			f_retaddr;
571c7c13aaSWojciech Macek };
581c7c13aaSWojciech Macek 
59147b9d04SAndrew Turner /*
609c871ab5SAndrew Turner  * Signal frame, pushed onto the user stack.
61147b9d04SAndrew Turner  */
62147b9d04SAndrew Turner struct sigframe {
63147b9d04SAndrew Turner 	siginfo_t       sf_si;          /* actual saved siginfo */
64147b9d04SAndrew Turner 	ucontext_t      sf_uc;          /* actual saved ucontext */
65147b9d04SAndrew Turner };
66147b9d04SAndrew Turner 
67147b9d04SAndrew Turner /*
689c871ab5SAndrew Turner  * There is no fixed frame layout, other than to be 16-byte aligned.
69147b9d04SAndrew Turner  */
70147b9d04SAndrew Turner struct frame {
71147b9d04SAndrew Turner 	int dummy;
72147b9d04SAndrew Turner };
73147b9d04SAndrew Turner 
748c9c3144SOlivier Houchard #ifdef COMPAT_FREEBSD32
758c9c3144SOlivier Houchard struct sigframe32 {
768c9c3144SOlivier Houchard 	struct siginfo32		sf_si;
778c9c3144SOlivier Houchard 	ucontext32_t			sf_uc;
788c9c3144SOlivier Houchard 	mcontext32_vfp_t		sf_vfp;
798c9c3144SOlivier Houchard };
808c9c3144SOlivier Houchard #endif /* COMPAT_FREEBSD32 */
818c9c3144SOlivier Houchard 
82147b9d04SAndrew Turner #endif /* !LOCORE */
83147b9d04SAndrew Turner 
84147b9d04SAndrew Turner #endif /* !_MACHINE_FRAME_H_ */
85