summaryrefslogtreecommitdiff
path: root/sys/compat/linux/arch/aarch64/linux_machdep.h
blob: 2e2a71fc755ad52be8f8aadc28f2f198981588de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*	$NetBSD: linux_machdep.h,v 1.3 2021/11/30 01:52:06 ryo Exp $	*/

/*-
 * Copyright (c) 2021 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _AARCH64_LINUX_MACHDEP_H
#define _AARCH64_LINUX_MACHDEP_H

#include <aarch64/reg.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_signal.h>
#include <compat/linux/common/linux_siginfo.h>

/* from $LINUXSRC/arch/arm64/include/uapi/asm/sigcontext.h */
struct linux_aarch64_ctx {
	uint32_t magic;
	uint32_t size;
};

#define FPSIMD_MAGIC	0x46508001
struct fpsimd_context {
	struct linux_aarch64_ctx head;
	uint32_t fpsr;
	uint32_t fpcr;
	union fpelem vregs[32];
};

/* from $LINUXSRC/arch/arm64/include/uapi/asm/sigcontext.h */
struct linux_sigcontext {
	uint64_t fault_address;
	uint64_t regs[31];
	uint64_t sp;
	uint64_t pc;
	uint64_t pstate;
	uint8_t __reserved[4096] __attribute__((__aligned__(16)));
};

/* from $LINUXSRC/arch/arm64/include/uapi/asm/ucontext.h */
struct linux_ucontext {
	unsigned long luc_flags;
	struct linux_ucontext *luc_link;
	linux_stack_t luc_stack;
	linux_sigset_t luc_sigmask;
	uint8_t __reserved[1024 / 8 - sizeof(linux_sigset_t)];
	struct linux_sigcontext luc_mcontext;
};

/* from $LINUXSRC/arch/arm64/kernel/signal.c */
struct linux_rt_sigframe {
	struct linux_siginfo info;
	struct linux_ucontext uc;
};

/*
 * Not required for COMPAT_LINUX,
 * but required for COMPAT_LINUX32.
 */
struct linux_sys_open_args {
	syscallarg(const char *) path;
	syscallarg(int) flags;
	syscallarg(linux_umode_t) mode;
};
int linux_sys_open(struct lwp *, const struct linux_sys_open_args *, register_t *);

struct linux_sys_eventfd_args {
	syscallarg(unsigned int) initval;
};
int linux_sys_eventfd(struct lwp *, const struct linux_sys_eventfd_args *, register_t *);

struct linux_sys_llseek_args {
	syscallarg(int) fd;
	syscallarg(u_int32_t) ohigh;
	syscallarg(u_int32_t) olow;
	syscallarg(void *) res;
	syscallarg(int) whence;
};
int linux_sys_llseek(struct lwp *, const struct linux_sys_llseek_args *, register_t *);

struct linux_sys_unlink_args {
	syscallarg(const char *) path;
};
int linux_sys_unlink(struct lwp *, const struct linux_sys_unlink_args *, register_t *);

struct linux_sys_mknod_args {
	syscallarg(const char *) path;
	syscallarg(linux_umode_t) mode;
	syscallarg(unsigned) dev;
};
int linux_sys_mknod(struct lwp *, const struct linux_sys_mknod_args *, register_t *);

struct linux_sys_alarm_args {
	syscallarg(unsigned int) secs;
};
int linux_sys_alarm(struct lwp *, const struct linux_sys_alarm_args *, register_t *);

int linux_sys_pause(struct lwp *, const void *, register_t *);

#ifdef _KERNEL
__BEGIN_DECLS
void linux_syscall_intern(struct proc *);
__END_DECLS
#endif /* !_KERNEL */

#if BYTE_ORDER != BIG_ENDIAN
#define LINUX_UNAME_ARCH	"aarch64"
#else
#define LINUX_UNAME_ARCH	"aarch64_be"
#endif
#define LINUX_LARGEFILE64

#endif /* !_AARCH64_LINUX_MACHDEP_H */