1 1.3 ryo /* $NetBSD: linux_machdep.h,v 1.3 2021/11/30 01:52:06 ryo Exp $ */ 2 1.1 ryo 3 1.1 ryo /*- 4 1.1 ryo * Copyright (c) 2021 The NetBSD Foundation, Inc. 5 1.1 ryo * All rights reserved. 6 1.1 ryo * 7 1.1 ryo * Redistribution and use in source and binary forms, with or without 8 1.1 ryo * modification, are permitted provided that the following conditions 9 1.1 ryo * are met: 10 1.1 ryo * 1. Redistributions of source code must retain the above copyright 11 1.1 ryo * notice, this list of conditions and the following disclaimer. 12 1.1 ryo * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 ryo * notice, this list of conditions and the following disclaimer in the 14 1.1 ryo * documentation and/or other materials provided with the distribution. 15 1.1 ryo * 16 1.1 ryo * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17 1.1 ryo * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 1.1 ryo * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 1.1 ryo * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20 1.1 ryo * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 1.1 ryo * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 1.1 ryo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 1.1 ryo * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 1.1 ryo * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 1.1 ryo * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 1.1 ryo * POSSIBILITY OF SUCH DAMAGE. 27 1.1 ryo */ 28 1.1 ryo 29 1.1 ryo #ifndef _AARCH64_LINUX_MACHDEP_H 30 1.1 ryo #define _AARCH64_LINUX_MACHDEP_H 31 1.1 ryo 32 1.1 ryo #include <aarch64/reg.h> 33 1.1 ryo #include <compat/linux/common/linux_types.h> 34 1.1 ryo #include <compat/linux/common/linux_signal.h> 35 1.1 ryo #include <compat/linux/common/linux_siginfo.h> 36 1.1 ryo 37 1.1 ryo /* from $LINUXSRC/arch/arm64/include/uapi/asm/sigcontext.h */ 38 1.1 ryo struct linux_aarch64_ctx { 39 1.1 ryo uint32_t magic; 40 1.1 ryo uint32_t size; 41 1.1 ryo }; 42 1.1 ryo 43 1.1 ryo #define FPSIMD_MAGIC 0x46508001 44 1.1 ryo struct fpsimd_context { 45 1.1 ryo struct linux_aarch64_ctx head; 46 1.1 ryo uint32_t fpsr; 47 1.1 ryo uint32_t fpcr; 48 1.1 ryo union fpelem vregs[32]; 49 1.1 ryo }; 50 1.1 ryo 51 1.1 ryo /* from $LINUXSRC/arch/arm64/include/uapi/asm/sigcontext.h */ 52 1.1 ryo struct linux_sigcontext { 53 1.1 ryo uint64_t fault_address; 54 1.1 ryo uint64_t regs[31]; 55 1.1 ryo uint64_t sp; 56 1.1 ryo uint64_t pc; 57 1.1 ryo uint64_t pstate; 58 1.1 ryo uint8_t __reserved[4096] __attribute__((__aligned__(16))); 59 1.1 ryo }; 60 1.1 ryo 61 1.1 ryo /* from $LINUXSRC/arch/arm64/include/uapi/asm/ucontext.h */ 62 1.1 ryo struct linux_ucontext { 63 1.1 ryo unsigned long luc_flags; 64 1.1 ryo struct linux_ucontext *luc_link; 65 1.1 ryo linux_stack_t luc_stack; 66 1.1 ryo linux_sigset_t luc_sigmask; 67 1.1 ryo uint8_t __reserved[1024 / 8 - sizeof(linux_sigset_t)]; 68 1.1 ryo struct linux_sigcontext luc_mcontext; 69 1.1 ryo }; 70 1.1 ryo 71 1.1 ryo /* from $LINUXSRC/arch/arm64/kernel/signal.c */ 72 1.1 ryo struct linux_rt_sigframe { 73 1.1 ryo struct linux_siginfo info; 74 1.1 ryo struct linux_ucontext uc; 75 1.1 ryo }; 76 1.1 ryo 77 1.2 ryo /* 78 1.2 ryo * Not required for COMPAT_LINUX, 79 1.2 ryo * but required for COMPAT_LINUX32. 80 1.2 ryo */ 81 1.2 ryo struct linux_sys_open_args { 82 1.2 ryo syscallarg(const char *) path; 83 1.2 ryo syscallarg(int) flags; 84 1.2 ryo syscallarg(linux_umode_t) mode; 85 1.2 ryo }; 86 1.2 ryo int linux_sys_open(struct lwp *, const struct linux_sys_open_args *, register_t *); 87 1.2 ryo 88 1.2 ryo struct linux_sys_eventfd_args { 89 1.2 ryo syscallarg(unsigned int) initval; 90 1.2 ryo }; 91 1.2 ryo int linux_sys_eventfd(struct lwp *, const struct linux_sys_eventfd_args *, register_t *); 92 1.2 ryo 93 1.2 ryo struct linux_sys_llseek_args { 94 1.2 ryo syscallarg(int) fd; 95 1.2 ryo syscallarg(u_int32_t) ohigh; 96 1.2 ryo syscallarg(u_int32_t) olow; 97 1.2 ryo syscallarg(void *) res; 98 1.2 ryo syscallarg(int) whence; 99 1.2 ryo }; 100 1.2 ryo int linux_sys_llseek(struct lwp *, const struct linux_sys_llseek_args *, register_t *); 101 1.2 ryo 102 1.2 ryo struct linux_sys_unlink_args { 103 1.2 ryo syscallarg(const char *) path; 104 1.2 ryo }; 105 1.2 ryo int linux_sys_unlink(struct lwp *, const struct linux_sys_unlink_args *, register_t *); 106 1.2 ryo 107 1.2 ryo struct linux_sys_mknod_args { 108 1.2 ryo syscallarg(const char *) path; 109 1.2 ryo syscallarg(linux_umode_t) mode; 110 1.2 ryo syscallarg(unsigned) dev; 111 1.2 ryo }; 112 1.2 ryo int linux_sys_mknod(struct lwp *, const struct linux_sys_mknod_args *, register_t *); 113 1.2 ryo 114 1.2 ryo struct linux_sys_alarm_args { 115 1.2 ryo syscallarg(unsigned int) secs; 116 1.2 ryo }; 117 1.2 ryo int linux_sys_alarm(struct lwp *, const struct linux_sys_alarm_args *, register_t *); 118 1.2 ryo 119 1.2 ryo int linux_sys_pause(struct lwp *, const void *, register_t *); 120 1.1 ryo 121 1.1 ryo #ifdef _KERNEL 122 1.1 ryo __BEGIN_DECLS 123 1.1 ryo void linux_syscall_intern(struct proc *); 124 1.1 ryo __END_DECLS 125 1.1 ryo #endif /* !_KERNEL */ 126 1.1 ryo 127 1.3 ryo #if BYTE_ORDER != BIG_ENDIAN 128 1.3 ryo #define LINUX_UNAME_ARCH "aarch64" 129 1.3 ryo #else 130 1.3 ryo #define LINUX_UNAME_ARCH "aarch64_be" 131 1.3 ryo #endif 132 1.3 ryo #define LINUX_LARGEFILE64 133 1.3 ryo 134 1.1 ryo #endif /* !_AARCH64_LINUX_MACHDEP_H */ 135