Import QEMU upstream snapshot d2e570c

Upstream: https://gitlab.com/qemu-project/qemu.git

Upstream-Commit: d2e570cc0f97b936902a5b1b86b73c0f5998b475
This commit is contained in:
Yaya48 committed 2026-08-31 02:15:30 +02:00
commit cf256aa081
11315 files changed
+3598369

No files matched your search

+325
View File
@@ -0,0 +1,325 @@
/*
* qemu user cpu loop
*
* Copyright (c) 2003-2008 Fabrice Bellard
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "user-internals.h"
#include "user/cpu_loop.h"
#include "signal-common.h"
#include "elf.h"
#include "internal.h"
#include "fpu_helper.h"
# ifdef TARGET_ABI_MIPSO32
# define MIPS_SYSCALL_NUMBER_UNUSED -1
static const int8_t mips_syscall_args[] = {
#include "syscall-args-o32.c.inc"
};
# endif /* O32 */
/* Break codes */
enum {
BRK_OVERFLOW = 6,
BRK_DIVZERO = 7
};
static void do_tr_or_bp(CPUMIPSState *env, unsigned int code, bool trap)
{
target_ulong pc = env->active_tc.PC;
switch (code) {
case BRK_OVERFLOW:
force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, pc);
break;
case BRK_DIVZERO:
force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, pc);
break;
default:
if (trap) {
force_sig(TARGET_SIGTRAP);
} else {
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, pc);
}
break;
}
}
void cpu_loop(CPUMIPSState *env)
{
CPUState *cs = env_cpu(env);
int trapnr, si_code;
unsigned int code;
abi_long ret;
# ifdef TARGET_ABI_MIPSO32
unsigned int syscall_num;
# endif
for(;;) {
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
qemu_process_cpu_events(cs);
switch(trapnr) {
case EXCP_SYSCALL:
env->active_tc.PC += 4;
# ifdef TARGET_ABI_MIPSO32
syscall_num = env->active_tc.gpr[2] - 4000;
if (syscall_num >= sizeof(mips_syscall_args)) {
/* syscall_num is larger that any defined for MIPS O32 */
ret = -TARGET_ENOSYS;
} else if (mips_syscall_args[syscall_num] ==
MIPS_SYSCALL_NUMBER_UNUSED) {
/* syscall_num belongs to the range not defined for MIPS O32 */
ret = -TARGET_ENOSYS;
} else {
/* syscall_num is valid */
int nb_args;
abi_ulong sp_reg;
abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
nb_args = mips_syscall_args[syscall_num];
sp_reg = env->active_tc.gpr[29];
switch (nb_args) {
/* these arguments are taken from the stack */
case 8:
if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
goto done_syscall;
}
/* fall through */
case 7:
if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
goto done_syscall;
}
/* fall through */
case 6:
if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
goto done_syscall;
}
/* fall through */
case 5:
if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
goto done_syscall;
}
/* fall through */
default:
break;
}
ret = do_syscall(env, env->active_tc.gpr[2],
env->active_tc.gpr[4],
env->active_tc.gpr[5],
env->active_tc.gpr[6],
env->active_tc.gpr[7],
arg5, arg6, arg7, arg8);
}
done_syscall:
# else
ret = do_syscall(env, env->active_tc.gpr[2],
env->active_tc.gpr[4], env->active_tc.gpr[5],
env->active_tc.gpr[6], env->active_tc.gpr[7],
env->active_tc.gpr[8], env->active_tc.gpr[9],
env->active_tc.gpr[10], env->active_tc.gpr[11]);
# endif /* O32 */
if (ret == -QEMU_ERESTARTSYS) {
env->active_tc.PC -= 4;
break;
}
if (ret == -QEMU_ESIGRETURN || ret == -QEMU_ESETPC) {
/*
* Returning from a successful sigreturn syscall or from
* control flow diversion in a plugin callback.
* Avoid clobbering register state.
*/
break;
}
if ((abi_ulong)ret >= (abi_ulong)-1133) {
env->active_tc.gpr[7] = 1; /* error flag */
ret = -ret;
} else {
env->active_tc.gpr[7] = 0; /* error flag */
}
env->active_tc.gpr[2] = ret;
break;
case EXCP_CpU:
case EXCP_RI:
case EXCP_DSPDIS:
force_sig(TARGET_SIGILL);
break;
case EXCP_AdEL:
case EXCP_AdES:
force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN,
env->CP0_BadVAddr);
break;
case EXCP_INTERRUPT:
/* just indicate that signals should be handled asap */
break;
case EXCP_DEBUG:
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT,
env->active_tc.PC);
break;
case EXCP_FPE:
si_code = TARGET_FPE_FLTUNK;
if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INVALID) {
si_code = TARGET_FPE_FLTINV;
} else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_DIV0) {
si_code = TARGET_FPE_FLTDIV;
} else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_OVERFLOW) {
si_code = TARGET_FPE_FLTOVF;
} else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_UNDERFLOW) {
si_code = TARGET_FPE_FLTUND;
} else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INEXACT) {
si_code = TARGET_FPE_FLTRES;
}
force_sig_fault(TARGET_SIGFPE, si_code, env->active_tc.PC);
break;
case EXCP_OVERFLOW:
force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->active_tc.PC);
break;
/* The code below was inspired by the MIPS Linux kernel trap
* handling code in arch/mips/kernel/traps.c.
*/
case EXCP_BREAK:
/*
* As described in the original Linux kernel code, the below
* checks on 'code' are to work around an old assembly bug.
*/
code = env->error_code;
if (code >= (1 << 10)) {
code >>= 10;
}
do_tr_or_bp(env, code, false);
break;
case EXCP_TRAP:
do_tr_or_bp(env, env->error_code, true);
break;
case EXCP_ATOMIC:
cpu_exec_step_atomic(cs);
break;
default:
EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr);
abort();
}
process_pending_signals(env);
}
}
void init_main_thread(CPUState *cs, struct image_info *info)
{
CPUArchState *env = cpu_env(cs);
struct mode_req {
bool single;
bool soft;
bool fr1;
bool frdefault;
bool fre;
};
static const struct mode_req fpu_reqs[] = {
[MIPS_ABI_FP_ANY] = { true, true, true, true, true },
[MIPS_ABI_FP_DOUBLE] = { false, false, false, true, true },
[MIPS_ABI_FP_SINGLE] = { true, false, false, false, false },
[MIPS_ABI_FP_SOFT] = { false, true, false, false, false },
[MIPS_ABI_FP_OLD_64] = { false, false, false, false, false },
[MIPS_ABI_FP_XX] = { false, false, true, true, true },
[MIPS_ABI_FP_64] = { false, false, true, false, false },
[MIPS_ABI_FP_64A] = { false, false, true, false, true }
};
/*
* Mode requirements when .MIPS.abiflags is not present in the ELF.
* Not present means that everything is acceptable except FR1.
*/
static struct mode_req none_req = { true, true, false, true, true };
struct mode_req prog_req;
struct mode_req interp_req;
target_ulong entry = info->entry;
env->active_tc.gpr[29] = info->start_stack;
env->active_tc.PC = entry & ~(target_ulong)1;
if (entry & 1) {
env->hflags |= MIPS_HFLAG_M16;
}
#ifdef TARGET_ABI_MIPSO32
# define MAX_FP_ABI MIPS_ABI_FP_64A
#else
# define MAX_FP_ABI MIPS_ABI_FP_SOFT
#endif
if ((info->fp_abi > MAX_FP_ABI && info->fp_abi != MIPS_ABI_FP_UNKNOWN)
|| (info->interp_fp_abi > MAX_FP_ABI &&
info->interp_fp_abi != MIPS_ABI_FP_UNKNOWN)) {
fprintf(stderr, "qemu: Unexpected FPU mode\n");
exit(1);
}
prog_req = (info->fp_abi == MIPS_ABI_FP_UNKNOWN) ? none_req
: fpu_reqs[info->fp_abi];
interp_req = (info->interp_fp_abi == MIPS_ABI_FP_UNKNOWN) ? none_req
: fpu_reqs[info->interp_fp_abi];
prog_req.single &= interp_req.single;
prog_req.soft &= interp_req.soft;
prog_req.fr1 &= interp_req.fr1;
prog_req.frdefault &= interp_req.frdefault;
prog_req.fre &= interp_req.fre;
bool cpu_has_mips_r2_r6 = env->insn_flags & ISA_MIPS_R2 ||
env->insn_flags & ISA_MIPS_R6;
if (prog_req.fre && !prog_req.frdefault && !prog_req.fr1) {
env->CP0_Config5 |= (1 << CP0C5_FRE);
if (env->active_fpu.fcr0 & (1 << FCR0_FREP)) {
env->hflags |= MIPS_HFLAG_FRE;
}
} else if ((prog_req.fr1 && prog_req.frdefault) ||
(prog_req.single && !prog_req.frdefault)) {
if ((env->active_fpu.fcr0 & (1 << FCR0_F64)
&& cpu_has_mips_r2_r6) || prog_req.fr1) {
env->CP0_Status |= (1 << CP0St_FR);
env->hflags |= MIPS_HFLAG_F64;
}
} else if (prog_req.fr1) {
env->CP0_Status |= (1 << CP0St_FR);
env->hflags |= MIPS_HFLAG_F64;
} else if (!prog_req.fre && !prog_req.frdefault &&
!prog_req.fr1 && !prog_req.single && !prog_req.soft) {
fprintf(stderr, "qemu: Can't find a matching FPU mode\n");
exit(1);
}
if (env->insn_flags & ISA_NANOMIPS32) {
return;
}
if (((info->elf_flags & EF_MIPS_NAN2008) != 0) !=
((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) != 0)) {
if ((env->active_fpu.fcr31_rw_bitmask &
(1 << FCR31_NAN2008)) == 0) {
fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n");
exit(1);
}
if ((info->elf_flags & EF_MIPS_NAN2008) != 0) {
env->active_fpu.fcr31 |= (1 << FCR31_NAN2008);
} else {
env->active_fpu.fcr31 &= ~(1 << FCR31_NAN2008);
}
restore_snan_bit_mode(env);
}
}
+158
View File
@@ -0,0 +1,158 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "qemu/osdep.h"
#include "qemu.h"
#include "loader.h"
#include "elf.h"
#include "target_elf.h"
const char *get_elf_cpu_model(uint32_t eflags)
{
#ifdef TARGET_MIPS64
switch (eflags & EF_MIPS_MACH) {
case EF_MIPS_MACH_OCTEON:
case EF_MIPS_MACH_OCTEON2:
case EF_MIPS_MACH_OCTEON3:
return "Octeon68XX";
case EF_MIPS_MACH_LS2E:
return "Loongson-2E";
case EF_MIPS_MACH_LS2F:
return "Loongson-2F";
case EF_MIPS_MACH_LS3A:
return "Loongson-3A1000";
default:
break;
}
switch (eflags & EF_MIPS_ARCH) {
case EF_MIPS_ARCH_64R6:
return "I6400";
case EF_MIPS_ARCH_64R2:
return "MIPS64R2-generic";
default:
break;
}
return "5KEf";
#else
if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) {
return "mips32r6-generic";
}
if ((eflags & EF_MIPS_ARCH_ASE) == EF_MIPS_ARCH_ASE_MICROMIPS) {
return "M14Kc";
}
if ((eflags & EF_MIPS_ARCH_ASE) == EF_MIPS_ARCH_ASE_M16) {
return "74Kf";
}
if (eflags & EF_MIPS_NAN2008) {
return "P5600";
}
return "24Kf";
#endif
}
/* See arch/mips/include/uapi/asm/hwcap.h. */
enum {
HWCAP_MIPS_R6 = (1 << 0),
HWCAP_MIPS_MSA = (1 << 1),
HWCAP_MIPS_CRC32 = (1 << 2),
HWCAP_MIPS_MIPS16 = (1 << 3),
HWCAP_MIPS_MDMX = (1 << 4),
HWCAP_MIPS_MIPS3D = (1 << 5),
HWCAP_MIPS_SMARTMIPS = (1 << 6),
HWCAP_MIPS_DSP = (1 << 7),
HWCAP_MIPS_DSP2 = (1 << 8),
HWCAP_MIPS_DSP3 = (1 << 9),
HWCAP_MIPS_MIPS16E2 = (1 << 10),
HWCAP_LOONGSON_MMI = (1 << 11),
HWCAP_LOONGSON_EXT = (1 << 12),
HWCAP_LOONGSON_EXT2 = (1 << 13),
HWCAP_LOONGSON_CPUCFG = (1 << 14),
};
#define GET_FEATURE_INSN(_flag, _hwcap) \
do { if (cpu->env.insn_flags & (_flag)) { hwcaps |= _hwcap; } } while (0)
#define GET_FEATURE_REG_SET(_reg, _mask, _hwcap) \
do { if (cpu->env._reg & (_mask)) { hwcaps |= _hwcap; } } while (0)
#define GET_FEATURE_REG_EQU(_reg, _start, _length, _val, _hwcap) \
do { \
if (extract32(cpu->env._reg, (_start), (_length)) == (_val)) { \
hwcaps |= _hwcap; \
} \
} while (0)
abi_ulong get_elf_hwcap(CPUState *cs)
{
MIPSCPU *cpu = MIPS_CPU(cs);
abi_ulong hwcaps = 0;
GET_FEATURE_REG_EQU(CP0_Config0, CP0C0_AR, CP0C0_AR_LENGTH,
2, HWCAP_MIPS_R6);
GET_FEATURE_REG_SET(CP0_Config3, 1 << CP0C3_MSAP, HWCAP_MIPS_MSA);
GET_FEATURE_INSN(ASE_LMMI, HWCAP_LOONGSON_MMI);
GET_FEATURE_INSN(ASE_LEXT, HWCAP_LOONGSON_EXT);
return hwcaps;
}
#undef GET_FEATURE_REG_EQU
#undef GET_FEATURE_REG_SET
#undef GET_FEATURE_INSN
#define MATCH_PLATFORM_INSN(_flags, _base_platform) \
do { if ((cpu->env.insn_flags & (_flags)) == _flags) \
{ return _base_platform; } } while (0)
const char *get_elf_base_platform(CPUState *cs)
{
MIPSCPU *cpu = MIPS_CPU(cs);
/* 64 bit ISAs goes first */
MATCH_PLATFORM_INSN(CPU_MIPS64R6, "mips64r6");
MATCH_PLATFORM_INSN(CPU_MIPS64R5, "mips64r5");
MATCH_PLATFORM_INSN(CPU_MIPS64R2, "mips64r2");
MATCH_PLATFORM_INSN(CPU_MIPS64R1, "mips64");
MATCH_PLATFORM_INSN(CPU_MIPS5, "mips5");
MATCH_PLATFORM_INSN(CPU_MIPS4, "mips4");
MATCH_PLATFORM_INSN(CPU_MIPS3, "mips3");
/* 32 bit ISAs */
MATCH_PLATFORM_INSN(CPU_MIPS32R6, "mips32r6");
MATCH_PLATFORM_INSN(CPU_MIPS32R5, "mips32r5");
MATCH_PLATFORM_INSN(CPU_MIPS32R2, "mips32r2");
MATCH_PLATFORM_INSN(CPU_MIPS32R1, "mips32");
MATCH_PLATFORM_INSN(CPU_MIPS2, "mips2");
/* Fallback */
return "mips";
}
#undef MATCH_PLATFORM_INSN
void elf_core_copy_fpregs(target_elf_fpregset_t *r, const CPUMIPSState *env)
{
for (int i = 0; i < 32; i++) {
r->fpr[i] = tswap64(env->active_fpu.fpr[i].d);
}
r->fcsr = tswap32(env->active_fpu.fcr31);
}
/* See linux kernel: arch/mips/kernel/process.c:elf_dump_regs. */
#ifndef TARGET_MIPS64
void elf_core_copy_regs(target_elf_gregset_t *r, const CPUMIPSState *env)
{
for (int i = 1; i < ARRAY_SIZE(env->active_tc.gpr); i++) {
r->pt.regs[i] = tswap32(env->active_tc.gpr[i]);
}
r->pt.regs[26] = 0;
r->pt.regs[27] = 0;
r->pt.lo = tswap32(env->active_tc.LO[0]);
r->pt.hi = tswap32(env->active_tc.HI[0]);
r->pt.cp0_epc = tswap32(env->active_tc.PC);
r->pt.cp0_badvaddr = tswap32(env->CP0_BadVAddr);
r->pt.cp0_status = tswap32(env->CP0_Status);
r->pt.cp0_cause = tswap32(env->CP0_Cause);
}
#endif
+6
View File
@@ -0,0 +1,6 @@
syscall_nr_generators += {
'mips': generator(sh,
arguments: [ meson.current_source_dir() / 'syscallhdr.sh', '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@',
'', '4000' ],
output: '@BASENAME@_nr.h')
}
+402
View File
@@ -0,0 +1,402 @@
/*
* Emulation of Linux signals
*
* Copyright (c) 2003 Fabrice Bellard
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "user-internals.h"
#include "signal-common.h"
#include "linux-user/trace.h"
# if defined(TARGET_ABI_MIPSO32)
struct target_sigcontext {
uint32_t sc_regmask; /* Unused */
uint32_t sc_status;
uint64_t sc_pc;
uint64_t sc_regs[32];
uint64_t sc_fpregs[32];
uint32_t sc_ownedfp; /* Unused */
uint32_t sc_fpc_csr;
uint32_t sc_fpc_eir; /* Unused */
uint32_t sc_used_math;
uint32_t sc_dsp; /* dsp status, was sc_ssflags */
uint32_t pad0;
uint64_t sc_mdhi;
uint64_t sc_mdlo;
target_ulong sc_hi1; /* Was sc_cause */
target_ulong sc_lo1; /* Was sc_badvaddr */
target_ulong sc_hi2; /* Was sc_sigset[4] */
target_ulong sc_lo2;
target_ulong sc_hi3;
target_ulong sc_lo3;
};
# else /* N32 || N64 */
struct target_sigcontext {
uint64_t sc_regs[32];
uint64_t sc_fpregs[32];
uint64_t sc_mdhi;
uint64_t sc_hi1;
uint64_t sc_hi2;
uint64_t sc_hi3;
uint64_t sc_mdlo;
uint64_t sc_lo1;
uint64_t sc_lo2;
uint64_t sc_lo3;
uint64_t sc_pc;
uint32_t sc_fpc_csr;
uint32_t sc_used_math;
uint32_t sc_dsp;
uint32_t sc_reserved;
};
# endif /* O32 */
struct sigframe {
uint32_t sf_ass[4]; /* argument save space for o32 */
uint32_t sf_code[2]; /* signal trampoline */
struct target_sigcontext sf_sc;
target_sigset_t sf_mask;
};
struct target_ucontext {
abi_ulong tuc_flags;
abi_ulong tuc_link;
target_stack_t tuc_stack;
struct target_sigcontext tuc_mcontext;
target_sigset_t tuc_sigmask;
};
struct target_rt_sigframe {
uint32_t rs_ass[4]; /* argument save space for o32 */
uint32_t rs_code[2]; /* signal trampoline */
struct target_siginfo rs_info;
struct target_ucontext rs_uc;
};
/* Install trampoline to jump back from signal handler */
static void install_sigtramp(uint32_t *tramp, unsigned int syscall)
{
/*
* Set up the return code ...
*
* li v0, __NR__foo_sigreturn
* syscall
*/
__put_user(0x24020000 + syscall, tramp + 0);
__put_user(0x0000000c , tramp + 1);
}
static inline void setup_sigcontext(CPUMIPSState *regs,
struct target_sigcontext *sc)
{
int i;
__put_user(exception_resume_pc(regs), &sc->sc_pc);
regs->hflags &= ~MIPS_HFLAG_BMASK;
__put_user(0, &sc->sc_regs[0]);
for (i = 1; i < 32; ++i) {
__put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
}
__put_user(regs->active_tc.HI[0], &sc->sc_mdhi);
__put_user(regs->active_tc.LO[0], &sc->sc_mdlo);
/* Rather than checking for dsp existence, always copy. The storage
would just be garbage otherwise. */
__put_user(regs->active_tc.HI[1], &sc->sc_hi1);
__put_user(regs->active_tc.HI[2], &sc->sc_hi2);
__put_user(regs->active_tc.HI[3], &sc->sc_hi3);
__put_user(regs->active_tc.LO[1], &sc->sc_lo1);
__put_user(regs->active_tc.LO[2], &sc->sc_lo2);
__put_user(regs->active_tc.LO[3], &sc->sc_lo3);
{
uint32_t dsp = cpu_rddsp(0x3ff, regs);
__put_user(dsp, &sc->sc_dsp);
}
__put_user(1, &sc->sc_used_math);
for (i = 0; i < 32; ++i) {
__put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
}
__put_user(regs->active_fpu.fcr31, &sc->sc_fpc_csr);
}
static inline void
restore_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc)
{
int i;
__get_user(regs->CP0_EPC, &sc->sc_pc);
__get_user(regs->active_tc.HI[0], &sc->sc_mdhi);
__get_user(regs->active_tc.LO[0], &sc->sc_mdlo);
for (i = 1; i < 32; ++i) {
__get_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
}
__get_user(regs->active_tc.HI[1], &sc->sc_hi1);
__get_user(regs->active_tc.HI[2], &sc->sc_hi2);
__get_user(regs->active_tc.HI[3], &sc->sc_hi3);
__get_user(regs->active_tc.LO[1], &sc->sc_lo1);
__get_user(regs->active_tc.LO[2], &sc->sc_lo2);
__get_user(regs->active_tc.LO[3], &sc->sc_lo3);
{
uint32_t dsp;
__get_user(dsp, &sc->sc_dsp);
cpu_wrdsp(dsp, 0x3ff, regs);
}
for (i = 0; i < 32; ++i) {
__get_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
}
{
uint32_t fcr31;
__get_user(fcr31, &sc->sc_fpc_csr);
regs->active_fpu.fcr31 = fcr31 & regs->active_fpu.fcr31_rw_bitmask;
cpu_mips_restore_fp_status(regs);
}
}
/*
* Determine which stack to use..
*/
static inline abi_ulong
get_sigframe(struct target_sigaction *ka, CPUMIPSState *regs, size_t frame_size)
{
unsigned long sp;
/*
* FPU emulator may have its own trampoline active just
* above the user stack, 16-bytes before the next lowest
* 16 byte boundary. Try to avoid trashing it.
*/
sp = target_sigsp(get_sp_from_cpustate(regs) - 32, ka);
return (sp - frame_size) & ~7;
}
static void mips_set_hflags_isa_mode_from_pc(CPUMIPSState *env)
{
if (env->insn_flags & (ASE_MIPS16 | ASE_MICROMIPS)) {
env->hflags &= ~MIPS_HFLAG_M16;
env->hflags |= (env->active_tc.PC & 1) << MIPS_HFLAG_M16_SHIFT;
env->active_tc.PC &= ~(target_ulong) 1;
}
}
# if defined(TARGET_ABI_MIPSO32)
/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
void setup_frame(int sig, struct target_sigaction * ka,
target_sigset_t *set, CPUMIPSState *regs)
{
struct sigframe *frame;
abi_ulong frame_addr;
int i;
frame_addr = get_sigframe(ka, regs, sizeof(*frame));
trace_user_setup_frame(regs, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
goto give_sigsegv;
}
setup_sigcontext(regs, &frame->sf_sc);
for(i = 0; i < TARGET_NSIG_WORDS; i++) {
__put_user(set->sig[i], &frame->sf_mask.sig[i]);
}
/*
* Arguments to signal handler:
*
* a0 = signal number
* a1 = 0 (should be cause)
* a2 = pointer to struct sigcontext
*
* $25 and PC point to the signal handler, $29 points to the
* struct sigframe.
*/
regs->active_tc.gpr[ 4] = sig;
regs->active_tc.gpr[ 5] = 0;
regs->active_tc.gpr[ 6] = frame_addr + offsetof(struct sigframe, sf_sc);
regs->active_tc.gpr[29] = frame_addr;
regs->active_tc.gpr[31] = default_sigreturn;
/* The original kernel code sets CP0_EPC to the handler
* since it returns to userland using eret
* we cannot do this here, and we must set PC directly */
regs->active_tc.PC = regs->active_tc.gpr[25] = ka->_sa_handler;
mips_set_hflags_isa_mode_from_pc(regs);
unlock_user_struct(frame, frame_addr, 1);
return;
give_sigsegv:
force_sigsegv(sig);
}
long do_sigreturn(CPUMIPSState *regs)
{
struct sigframe *frame;
abi_ulong frame_addr;
sigset_t blocked;
target_sigset_t target_set;
int i;
frame_addr = regs->active_tc.gpr[29];
trace_user_do_sigreturn(regs, frame_addr);
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))
goto badframe;
for(i = 0; i < TARGET_NSIG_WORDS; i++) {
__get_user(target_set.sig[i], &frame->sf_mask.sig[i]);
}
target_to_host_sigset_internal(&blocked, &target_set);
set_sigmask(&blocked);
restore_sigcontext(regs, &frame->sf_sc);
#if 0
/*
* Don't let your children do this ...
*/
__asm__ __volatile__(
"move\t$29, %0\n\t"
"j\tsyscall_exit"
:/* no outputs */
:"r" (&regs));
/* Unreached */
#endif
regs->active_tc.PC = regs->CP0_EPC;
mips_set_hflags_isa_mode_from_pc(regs);
/* I am not sure this is right, but it seems to work
* maybe a problem with nested signals ? */
regs->CP0_EPC = 0;
return -QEMU_ESIGRETURN;
badframe:
force_sig(TARGET_SIGSEGV);
return -QEMU_ESIGRETURN;
}
# endif /* O32 */
void setup_rt_frame(int sig, struct target_sigaction *ka,
target_siginfo_t *info,
target_sigset_t *set, CPUMIPSState *env)
{
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
int i;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
goto give_sigsegv;
}
frame->rs_info = *info;
__put_user(0, &frame->rs_uc.tuc_flags);
__put_user(0, &frame->rs_uc.tuc_link);
target_save_altstack(&frame->rs_uc.tuc_stack, env);
setup_sigcontext(env, &frame->rs_uc.tuc_mcontext);
for (i = 0; i < TARGET_NSIG_WORDS; i++) {
__put_user(set->sig[i], &frame->rs_uc.tuc_sigmask.sig[i]);
}
/*
* Arguments to signal handler:
*
* a0 = signal number
* a1 = pointer to siginfo_t
* a2 = pointer to ucontext_t
*
* $25 and PC point to the signal handler, $29 points to the
* struct sigframe.
*/
env->active_tc.gpr[ 4] = sig;
env->active_tc.gpr[ 5] = frame_addr
+ offsetof(struct target_rt_sigframe, rs_info);
env->active_tc.gpr[ 6] = frame_addr
+ offsetof(struct target_rt_sigframe, rs_uc);
env->active_tc.gpr[29] = frame_addr;
env->active_tc.gpr[31] = default_rt_sigreturn;
/*
* The original kernel code sets CP0_EPC to the handler
* since it returns to userland using eret
* we cannot do this here, and we must set PC directly
*/
env->active_tc.PC = env->active_tc.gpr[25] = ka->_sa_handler;
mips_set_hflags_isa_mode_from_pc(env);
unlock_user_struct(frame, frame_addr, 1);
return;
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sigsegv(sig);
}
long do_rt_sigreturn(CPUMIPSState *env)
{
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
sigset_t blocked;
frame_addr = env->active_tc.gpr[29];
trace_user_do_rt_sigreturn(env, frame_addr);
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
goto badframe;
}
target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask);
set_sigmask(&blocked);
restore_sigcontext(env, &frame->rs_uc.tuc_mcontext);
target_restore_altstack(&frame->rs_uc.tuc_stack, env);
env->active_tc.PC = env->CP0_EPC;
mips_set_hflags_isa_mode_from_pc(env);
/* I am not sure this is right, but it seems to work
* maybe a problem with nested signals ? */
env->CP0_EPC = 0;
return -QEMU_ESIGRETURN;
badframe:
force_sig(TARGET_SIGSEGV);
return -QEMU_ESIGRETURN;
}
void setup_sigtramp(abi_ulong sigtramp_page)
{
uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0);
assert(tramp != NULL);
#ifdef TARGET_ARCH_HAS_SETUP_FRAME
default_sigreturn = sigtramp_page;
install_sigtramp(tramp, TARGET_NR_sigreturn);
#endif
default_rt_sigreturn = sigtramp_page + 8;
install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn);
unlock_user(tramp, sigtramp_page, 2 * 8);
}
+119
View File
@@ -0,0 +1,119 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation, or (at your option) any
* later version. See the COPYING file in the top-level directory.
*/
#ifndef MIPS_SOCKBITS_H
#define MIPS_SOCKBITS_H
/* MIPS special values for constants */
/*
* For setsockopt(2)
*
* This defines are ABI conformant as far as Linux supports these ...
*/
#define TARGET_SOL_SOCKET 0xffff
#define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
#define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
#define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
SIGPIPE when they die. */
#define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
#define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
broadcast messages. */
#define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
* socket to transmit pending data.
*/
#define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band.
*/
#define TARGET_SO_REUSEPORT 0x0200
#define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
#define TARGET_SO_STYLE SO_TYPE /* Synonym */
#define TARGET_SO_ERROR 0x1007 /* get error status and clear */
#define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
#define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
#define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
#define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
#define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
#define TARGET_SO_ACCEPTCONN 0x1009
#define TARGET_SO_PROTOCOL 0x1028 /* protocol type */
#define TARGET_SO_DOMAIN 0x1029 /* domain/socket family */
/* linux-specific, might as well be the same as on i386 */
#define TARGET_SO_NO_CHECK 11
#define TARGET_SO_PRIORITY 12
#define TARGET_SO_BSDCOMPAT 14
#define TARGET_SO_PASSCRED 17
#define TARGET_SO_PEERCRED 18
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define TARGET_SO_SECURITY_AUTHENTICATION 22
#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
#define TARGET_SO_BINDTODEVICE 25
/* Socket filtering */
#define TARGET_SO_ATTACH_FILTER 26
#define TARGET_SO_DETACH_FILTER 27
#define TARGET_SO_PEERNAME 28
#define TARGET_SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
#define TARGET_SO_PEERSEC 30
#define TARGET_SO_SNDBUFFORCE 31
#define TARGET_SO_RCVBUFFORCE 33
#define TARGET_SO_PASSSEC 34
#define TARGET_SO_TIMESTAMP_NEW 63
#define TARGET_SO_TIMESTAMPNS_NEW 64
#define TARGET_SO_TIMESTAMPING_NEW 65
#define TARGET_SO_RCVTIMEO_NEW 66
#define TARGET_SO_SNDTIMEO_NEW 67
/** sock_type - Socket types
*
* Please notice that for binary compat reasons MIPS has to
* override the enum sock_type in include/linux/net.h, so
* we define ARCH_HAS_SOCKET_TYPES here.
*
* @SOCK_DGRAM - datagram (conn.less) socket
* @SOCK_STREAM - stream (connection) socket
* @SOCK_RAW - raw socket
* @SOCK_RDM - reliably-delivered message
* @SOCK_SEQPACKET - sequential packet socket
* @SOCK_DCCP - Datagram Congestion Control Protocol socket
* @SOCK_PACKET - linux specific way of getting packets at the dev level.
* For writing rarp and other similar things on the user
* level.
* @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
* @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
*/
#define TARGET_ARCH_HAS_SOCKET_TYPES 1
enum sock_type {
TARGET_SOCK_DGRAM = 1,
TARGET_SOCK_STREAM = 2,
TARGET_SOCK_RAW = 3,
TARGET_SOCK_RDM = 4,
TARGET_SOCK_SEQPACKET = 5,
TARGET_SOCK_DCCP = 6,
TARGET_SOCK_PACKET = 10,
};
#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
/* Flags for socket, socketpair, paccept */
#define TARGET_SOCK_CLOEXEC TARGET_O_CLOEXEC
#define TARGET_SOCK_NONBLOCK TARGET_O_NONBLOCK
#endif
+463
View File
@@ -0,0 +1,463 @@
[ 0] = 7, /* syscall */
[ 1] = 1, /* exit */
[ 2] = 0, /* fork */
[ 3] = 3, /* read */
[ 4] = 3, /* write */
[ 5] = 3, /* open */
[ 6] = 1, /* close */
[ 7] = 3, /* waitpid */
[ 8] = 2, /* creat */
[ 9] = 2, /* link */
[ 10] = 1, /* unlink */
[ 11] = 3, /* execve */
[ 12] = 1, /* chdir */
[ 13] = 1, /* time */
[ 14] = 3, /* mknod */
[ 15] = 2, /* chmod */
[ 16] = 3, /* lchown */
[ 17] = 0, /* break */
[ 18] = 2, /* oldstat */
[ 19] = 3, /* lseek */
[ 20] = 0, /* getpid */
[ 21] = 5, /* mount */
[ 22] = 1, /* umount */
[ 23] = 1, /* setuid */
[ 24] = 0, /* getuid */
[ 25] = 1, /* stime */
[ 26] = 4, /* ptrace */
[ 27] = 1, /* alarm */
[ 28] = 2, /* oldfstat */
[ 29] = 0, /* pause */
[ 30] = 2, /* utime */
[ 31] = 0, /* stty */
[ 32] = 0, /* gtty */
[ 33] = 2, /* access */
[ 34] = 1, /* nice */
[ 35] = 1, /* ftime */
[ 36] = 0, /* sync */
[ 37] = 2, /* kill */
[ 38] = 2, /* rename */
[ 39] = 2, /* mkdir */
[ 40] = 1, /* rmdir */
[ 41] = 1, /* dup */
[ 42] = 0, /* pipe */
[ 43] = 1, /* times */
[ 44] = 0, /* prof */
[ 45] = 1, /* brk */
[ 46] = 1, /* setgid */
[ 47] = 0, /* getgid */
[ 48] = 2, /* signal */
[ 49] = 0, /* geteuid */
[ 50] = 0, /* getegid */
[ 51] = 1, /* acct */
[ 52] = 2, /* umount2 */
[ 53] = 0, /* lock */
[ 54] = 3, /* ioctl */
[ 55] = 3, /* fcntl */
[ 56] = 0, /* mpx */
[ 57] = 2, /* setpgid */
[ 58] = 0, /* ulimit */
[ 59] = 1, /* oldolduname */
[ 60] = 1, /* umask */
[ 61] = 1, /* chroot */
[ 62] = 2, /* ustat */
[ 63] = 2, /* dup2 */
[ 64] = 0, /* getppid */
[ 65] = 0, /* getpgrp */
[ 66] = 0, /* setsid */
[ 67] = 3, /* sigaction */
[ 68] = 0, /* sgetmask */
[ 69] = 1, /* ssetmask */
[ 70] = 2, /* setreuid */
[ 71] = 2, /* setregid */
[ 72] = 1, /* sigsuspend */
[ 73] = 1, /* sigpending */
[ 74] = 2, /* sethostname */
[ 75] = 2, /* setrlimit */
[ 76] = 2, /* getrlimit */
[ 77] = 2, /* getrusage */
[ 78] = 2, /* gettimeofday */
[ 79] = 2, /* settimeofday */
[ 80] = 2, /* getgroups */
[ 81] = 2, /* setgroups */
[ 82] = 0, /* reserved82 */
[ 83] = 2, /* symlink */
[ 84] = 2, /* oldlstat */
[ 85] = 3, /* readlink */
[ 86] = 1, /* uselib */
[ 87] = 2, /* swapon */
[ 88] = 4, /* reboot */
[ 89] = 3, /* readdir */
[ 90] = 6, /* mmap */
[ 91] = 2, /* munmap */
[ 92] = 2, /* truncate */
[ 93] = 2, /* ftruncate */
[ 94] = 2, /* fchmod */
[ 95] = 3, /* fchown */
[ 96] = 2, /* getpriority */
[ 97] = 3, /* setpriority */
[ 98] = 0, /* profil */
[ 99] = 2, /* statfs */
[ 100] = 2, /* fstatfs */
[ 101] = 3, /* ioperm */
[ 102] = 2, /* socketcall */
[ 103] = 3, /* syslog */
[ 104] = 3, /* setitimer */
[ 105] = 2, /* getitimer */
[ 106] = 2, /* stat */
[ 107] = 2, /* lstat */
[ 108] = 2, /* fstat */
[ 109] = 1, /* olduname */
[ 110] = 1, /* iopl */
[ 111] = 0, /* vhangup */
[ 112] = 0, /* idle */
[ 113] = 5, /* vm86 */
[ 114] = 4, /* wait4 */
[ 115] = 1, /* swapoff */
[ 116] = 1, /* sysinfo */
[ 117] = 6, /* ipc */
[ 118] = 1, /* fsync */
[ 119] = 0, /* sigreturn */
[ 120] = 5, /* clone */
[ 121] = 2, /* setdomainname */
[ 122] = 1, /* uname */
[ 123] = 0, /* modify_ldt */
[ 124] = 1, /* adjtimex */
[ 125] = 3, /* mprotect */
[ 126] = 3, /* sigprocmask */
[ 127] = 2, /* create_module */
[ 128] = 3, /* init_module */
[ 129] = 2, /* delete_module */
[ 130] = 1, /* get_kernel_syms */
[ 131] = 4, /* quotactl */
[ 132] = 1, /* getpgid */
[ 133] = 1, /* fchdir */
[ 134] = 2, /* bdflush */
[ 135] = 3, /* sysfs */
[ 136] = 1, /* personality */
[ 137] = 0, /* afs_syscall */
[ 138] = 1, /* setfsuid */
[ 139] = 1, /* setfsgid */
[ 140] = 5, /* _llseek */
[ 141] = 3, /* getdents */
[ 142] = 5, /* _newselect */
[ 143] = 2, /* flock */
[ 144] = 3, /* msync */
[ 145] = 3, /* readv */
[ 146] = 3, /* writev */
[ 147] = 3, /* cacheflush */
[ 148] = 3, /* cachectl */
[ 149] = 4, /* sysmips */
[ 150] = 0, /* setup */
[ 151] = 1, /* getsid */
[ 152] = 1, /* fdatasync */
[ 153] = 1, /* _sysctl */
[ 154] = 2, /* mlock */
[ 155] = 2, /* munlock */
[ 156] = 1, /* mlockall */
[ 157] = 0, /* munlockall */
[ 158] = 2, /* sched_setparam */
[ 159] = 2, /* sched_getparam */
[ 160] = 3, /* sched_setscheduler */
[ 161] = 1, /* sched_getscheduler */
[ 162] = 0, /* sched_yield */
[ 163] = 1, /* sched_get_priority_max */
[ 164] = 1, /* sched_get_priority_min */
[ 165] = 2, /* sched_rr_get_interval */
[ 166] = 2, /* nanosleep */
[ 167] = 5, /* mremap */
[ 168] = 3, /* accept */
[ 169] = 3, /* bind */
[ 170] = 3, /* connect */
[ 171] = 3, /* getpeername */
[ 172] = 3, /* getsockname */
[ 173] = 5, /* getsockopt */
[ 174] = 2, /* listen */
[ 175] = 4, /* recv */
[ 176] = 6, /* recvfrom */
[ 177] = 3, /* recvmsg */
[ 178] = 4, /* send */
[ 179] = 3, /* sendmsg */
[ 180] = 6, /* sendto */
[ 181] = 5, /* setsockopt */
[ 182] = 2, /* shutdown */
[ 183] = 3, /* socket */
[ 184] = 4, /* socketpair */
[ 185] = 3, /* setresuid */
[ 186] = 3, /* getresuid */
[ 187] = 5, /* query_module */
[ 188] = 3, /* poll */
[ 189] = 3, /* nfsservctl */
[ 190] = 3, /* setresgid */
[ 191] = 3, /* getresgid */
[ 192] = 5, /* prctl */
[ 193] = 0, /* rt_sigreturn */
[ 194] = 4, /* rt_sigaction */
[ 195] = 4, /* rt_sigprocmask */
[ 196] = 2, /* rt_sigpending */
[ 197] = 4, /* rt_sigtimedwait */
[ 198] = 3, /* rt_sigqueueinfo */
[ 199] = 2, /* rt_sigsuspend */
[ 200] = 6, /* pread64 */
[ 201] = 6, /* pwrite64 */
[ 202] = 3, /* chown */
[ 203] = 2, /* getcwd */
[ 204] = 2, /* capget */
[ 205] = 2, /* capset */
[ 206] = 2, /* sigaltstack */
[ 207] = 4, /* sendfile */
[ 208] = 5, /* getpmsg */
[ 209] = 5, /* putpmsg */
[ 210] = 6, /* mmap2 */
[ 211] = 4, /* truncate64 */
[ 212] = 4, /* ftruncate64 */
[ 213] = 2, /* stat64 */
[ 214] = 2, /* lstat64 */
[ 215] = 2, /* fstat64 */
[ 216] = 2, /* pivot_root */
[ 217] = 3, /* mincore */
[ 218] = 3, /* madvise */
[ 219] = 3, /* getdents64 */
[ 220] = 3, /* fcntl64 */
[ 221] = 0, /* reserved221 */
[ 222] = 0, /* gettid */
[ 223] = 5, /* readahead */
[ 224] = 5, /* setxattr */
[ 225] = 5, /* lsetxattr */
[ 226] = 5, /* fsetxattr */
[ 227] = 4, /* getxattr */
[ 228] = 4, /* lgetxattr */
[ 229] = 4, /* fgetxattr */
[ 230] = 3, /* listxattr */
[ 231] = 3, /* llistxattr */
[ 232] = 3, /* flistxattr */
[ 233] = 2, /* removexattr */
[ 234] = 2, /* lremovexattr */
[ 235] = 2, /* fremovexattr */
[ 236] = 2, /* tkill */
[ 237] = 4, /* sendfile64 */
[ 238] = 6, /* futex */
[ 239] = 3, /* sched_setaffinity */
[ 240] = 3, /* sched_getaffinity */
[ 241] = 2, /* io_setup */
[ 242] = 1, /* io_destroy */
[ 243] = 5, /* io_getevents */
[ 244] = 3, /* io_submit */
[ 245] = 3, /* io_cancel */
[ 246] = 1, /* exit_group */
[ 247] = 4, /* lookup_dcookie */
[ 248] = 1, /* epoll_create */
[ 249] = 4, /* epoll_ctl */
[ 250] = 4, /* epoll_wait */
[ 251] = 5, /* remap_file_pages */
[ 252] = 1, /* set_tid_address */
[ 253] = 0, /* restart_syscall */
[ 254] = 7, /* fadvise64 */
[ 255] = 3, /* statfs64 */
[ 256] = 3, /* fstatfs64 */
[ 257] = 3, /* timer_create */
[ 258] = 4, /* timer_settime */
[ 259] = 2, /* timer_gettime */
[ 260] = 1, /* timer_getoverrun */
[ 261] = 1, /* timer_delete */
[ 262] = 2, /* clock_settime */
[ 263] = 2, /* clock_gettime */
[ 264] = 2, /* clock_getres */
[ 265] = 4, /* clock_nanosleep */
[ 266] = 3, /* tgkill */
[ 267] = 2, /* utimes */
[ 268] = 6, /* mbind */
[ 269] = 5, /* get_mempolicy */
[ 270] = 3, /* set_mempolicy */
[ 271] = 4, /* mq_open */
[ 272] = 1, /* mq_unlink */
[ 273] = 5, /* mq_timedsend */
[ 274] = 5, /* mq_timedreceive */
[ 275] = 2, /* mq_notify */
[ 276] = 3, /* mq_getsetattr */
[ 277] = 5, /* vserver */
[ 278] = 5, /* waitid */
[ 279] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 280] = 5, /* add_key */
[ 281] = 4, /* request_key */
[ 282] = 5, /* keyctl */
[ 283] = 1, /* set_thread_area */
[ 284] = 0, /* inotify_init */
[ 285] = 3, /* inotify_add_watch */
[ 286] = 2, /* inotify_rm_watch */
[ 287] = 4, /* migrate_pages */
[ 288] = 4, /* openat */
[ 289] = 3, /* mkdirat */
[ 290] = 4, /* mknodat */
[ 291] = 5, /* fchownat */
[ 292] = 3, /* futimesat */
[ 293] = 4, /* fstatat64 */
[ 294] = 3, /* unlinkat */
[ 295] = 4, /* renameat */
[ 296] = 5, /* linkat */
[ 297] = 3, /* symlinkat */
[ 298] = 4, /* readlinkat */
[ 299] = 3, /* fchmodat */
[ 300] = 3, /* faccessat */
[ 301] = 6, /* pselect6 */
[ 302] = 5, /* ppoll */
[ 303] = 1, /* unshare */
[ 304] = 6, /* splice */
[ 305] = 7, /* sync_file_range */
[ 306] = 4, /* tee */
[ 307] = 4, /* vmsplice */
[ 308] = 6, /* move_pages */
[ 309] = 2, /* set_robust_list */
[ 310] = 3, /* get_robust_list */
[ 311] = 4, /* kexec_load */
[ 312] = 3, /* getcpu */
[ 313] = 6, /* epoll_pwait */
[ 314] = 3, /* ioprio_set */
[ 315] = 2, /* ioprio_get */
[ 316] = 4, /* utimensat */
[ 317] = 3, /* signalfd */
[ 318] = 4, /* timerfd */
[ 319] = 1, /* eventfd */
[ 320] = 6, /* fallocate */
[ 321] = 2, /* timerfd_create */
[ 322] = 2, /* timerfd_gettime */
[ 323] = 4, /* timerfd_settime */
[ 324] = 4, /* signalfd4 */
[ 325] = 2, /* eventfd2 */
[ 326] = 1, /* epoll_create1 */
[ 327] = 3, /* dup3 */
[ 328] = 2, /* pipe2 */
[ 329] = 1, /* inotify_init1 */
[ 330] = 5, /* preadv */
[ 331] = 5, /* pwritev */
[ 332] = 4, /* rt_tgsigqueueinfo */
[ 333] = 5, /* perf_event_open */
[ 334] = 4, /* accept4 */
[ 335] = 5, /* recvmmsg */
[ 336] = 2, /* fanotify_init */
[ 337] = 6, /* fanotify_mark */
[ 338] = 4, /* prlimit64 */
[ 339] = 5, /* name_to_handle_at */
[ 340] = 3, /* open_by_handle_at */
[ 341] = 2, /* clock_adjtime */
[ 342] = 1, /* syncfs */
[ 343] = 4, /* sendmmsg */
[ 344] = 2, /* setns */
[ 345] = 6, /* process_vm_readv */
[ 346] = 6, /* process_vm_writev */
[ 347] = 5, /* kcmp */
[ 348] = 3, /* finit_module */
[ 349] = 3, /* sched_setattr */
[ 350] = 4, /* sched_getattr */
[ 351] = 5, /* renameat2 */
[ 352] = 3, /* seccomp */
[ 353] = 3, /* getrandom */
[ 354] = 2, /* memfd_create */
[ 355] = 3, /* bpf */
[ 356] = 5, /* execveat */
[ 357] = 1, /* userfaultfd */
[ 358] = 3, /* membarrier */
[ 359] = 3, /* mlock2 */
[ 360] = 6, /* copy_file_range */
[ 361] = 6, /* preadv2 */
[ 362] = 6, /* pwritev2 */
[ 363] = 4, /* pkey_mprotect */
[ 364] = 2, /* pkey_alloc */
[ 365] = 1, /* pkey_free */
[ 366] = 5, /* statx */
[ 367] = 4, /* rseq */
[ 368] = 6, /* io_pgetevents */
[ 369] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 370] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 371] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 372] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 373] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 374] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 375] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 376] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 377] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 378] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 379] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 380] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 381] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 382] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 383] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 384] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 385] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 386] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 387] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 388] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 389] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 390] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 391] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 392] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 393] = 3, /* semget */
[ 394] = 4, /* semctl */
[ 395] = 3, /* shmget */
[ 396] = 3, /* shmctl */
[ 397] = 3, /* shmat */
[ 398] = 1, /* shmdt */
[ 399] = 2, /* msgget */
[ 400] = 4, /* msgsnd */
[ 401] = 5, /* msgrcv */
[ 402] = 3, /* msgctl */
[ 403] = 2, /* clock_gettime64 */
[ 404] = 2, /* clock_settime64 */
[ 405] = 2, /* clock_adjtime64 */
[ 406] = 2, /* clock_getres_time64 */
[ 407] = 4, /* clock_nanosleep_time64 */
[ 408] = 2, /* timer_gettime64 */
[ 409] = 4, /* timer_settime64 */
[ 410] = 2, /* timerfd_gettime64 */
[ 411] = 4, /* timerfd_settime64 */
[ 412] = 4, /* utimensat_time64 */
[ 413] = 6, /* pselect6_time64 */
[ 414] = 5, /* ppoll_time64 */
[ 415] = MIPS_SYSCALL_NUMBER_UNUSED,
[ 416] = 6, /* io_pgetevents_time64 */
[ 417] = 5, /* recvmmsg_time64 */
[ 418] = 5, /* mq_timedsend_time64 */
[ 419] = 5, /* mq_timedreceive_time64 */
[ 420] = 4, /* semtimedop_time64 */
[ 421] = 4, /* rt_sigtimedwait_time64 */
[ 422] = 6, /* futex_time64 */
[ 423] = 2, /* sched_rr_get_interval_time64 */
[ 424] = 4, /* pidfd_send_signal */
[ 425] = 2, /* io_uring_setup */
[ 426] = 6, /* io_uring_enter */
[ 427] = 4, /* io_uring_register */
[ 428] = 3, /* open_tree */
[ 429] = 5, /* move_mount */
[ 430] = 2, /* fsopen */
[ 431] = 5, /* fsconfig */
[ 432] = 3, /* fsmount */
[ 433] = 3, /* fspick */
[ 434] = 2, /* pidfd_open */
[ 435] = 2, /* clone3 */
[ 436] = 3, /* close_range */
[ 437] = 4, /* openat2 */
[ 438] = 3, /* pidfd_getfd */
[ 439] = 4, /* faccessat2 */
[ 440] = 5, /* process_madvise */
[ 441] = 6, /* epoll_pwait2 */
[ 442] = 5, /* mount_setattr */
[ 443] = 4, /* quotactl_fd */
[ 444] = 3, /* landlock_create_ruleset */
[ 445] = 4, /* landlock_add_rule */
[ 446] = 2, /* landlock_restrict_self */
[ 447] = 1, /* memfd_secret */
[ 448] = 2, /* process_mrelease */
[ 449] = 5, /* futex_waitv */
[ 450] = 4, /* set_mempolicy_home_node */
[ 451] = 4, /* cachestat */
[ 452] = 4, /* fchmodat2 */
[ 453] = 3, /* map_shadow_stack */
[ 454] = 4, /* futex_wake */
[ 455] = 6, /* futex_wait */
[ 456] = 4, /* futex_requeue */
[ 457] = 4, /* statmount */
[ 458] = 4, /* listmount */
[ 459] = 4, /* lsm_get_self_attr */
[ 460] = 4, /* lsm_set_self_attr */
[ 461] = 3, /* lsm_list_modules */
[ 462] = 3, /* mseal */
+1
View File
@@ -0,0 +1 @@
#include "syscall_o32_nr.h"
+452
View File
@@ -0,0 +1,452 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
#
# system call numbers and entry vectors for mips
#
# The format is:
# <number> <abi> <name> <entry point> <compat entry point>
#
# The <abi> is always "o32" for this file.
#
0 o32 syscall sys_syscall sys32_syscall
1 o32 exit sys_exit
2 o32 fork __sys_fork
3 o32 read sys_read
4 o32 write sys_write
5 o32 open sys_open compat_sys_open
6 o32 close sys_close
7 o32 waitpid sys_waitpid
8 o32 creat sys_creat
9 o32 link sys_link
10 o32 unlink sys_unlink
11 o32 execve sys_execve compat_sys_execve
12 o32 chdir sys_chdir
13 o32 time sys_time32
14 o32 mknod sys_mknod
15 o32 chmod sys_chmod
16 o32 lchown sys_lchown
17 o32 break sys_ni_syscall
# 18 was sys_stat
18 o32 unused18 sys_ni_syscall
19 o32 lseek sys_lseek compat_sys_lseek
20 o32 getpid sys_getpid
21 o32 mount sys_mount
22 o32 umount sys_oldumount
23 o32 setuid sys_setuid
24 o32 getuid sys_getuid
25 o32 stime sys_stime32
26 o32 ptrace sys_ptrace compat_sys_ptrace
27 o32 alarm sys_alarm
# 28 was sys_fstat
28 o32 unused28 sys_ni_syscall
29 o32 pause sys_pause
30 o32 utime sys_utime32
31 o32 stty sys_ni_syscall
32 o32 gtty sys_ni_syscall
33 o32 access sys_access
34 o32 nice sys_nice
35 o32 ftime sys_ni_syscall
36 o32 sync sys_sync
37 o32 kill sys_kill
38 o32 rename sys_rename
39 o32 mkdir sys_mkdir
40 o32 rmdir sys_rmdir
41 o32 dup sys_dup
42 o32 pipe sysm_pipe
43 o32 times sys_times compat_sys_times
44 o32 prof sys_ni_syscall
45 o32 brk sys_brk
46 o32 setgid sys_setgid
47 o32 getgid sys_getgid
48 o32 signal sys_ni_syscall
49 o32 geteuid sys_geteuid
50 o32 getegid sys_getegid
51 o32 acct sys_acct
52 o32 umount2 sys_umount
53 o32 lock sys_ni_syscall
54 o32 ioctl sys_ioctl compat_sys_ioctl
55 o32 fcntl sys_fcntl compat_sys_fcntl
56 o32 mpx sys_ni_syscall
57 o32 setpgid sys_setpgid
58 o32 ulimit sys_ni_syscall
59 o32 unused59 sys_olduname
60 o32 umask sys_umask
61 o32 chroot sys_chroot
62 o32 ustat sys_ustat compat_sys_ustat
63 o32 dup2 sys_dup2
64 o32 getppid sys_getppid
65 o32 getpgrp sys_getpgrp
66 o32 setsid sys_setsid
67 o32 sigaction sys_sigaction sys_32_sigaction
68 o32 sgetmask sys_sgetmask
69 o32 ssetmask sys_ssetmask
70 o32 setreuid sys_setreuid
71 o32 setregid sys_setregid
72 o32 sigsuspend sys_sigsuspend sys32_sigsuspend
73 o32 sigpending sys_sigpending compat_sys_sigpending
74 o32 sethostname sys_sethostname
75 o32 setrlimit sys_setrlimit compat_sys_setrlimit
76 o32 getrlimit sys_getrlimit compat_sys_getrlimit
77 o32 getrusage sys_getrusage compat_sys_getrusage
78 o32 gettimeofday sys_gettimeofday compat_sys_gettimeofday
79 o32 settimeofday sys_settimeofday compat_sys_settimeofday
80 o32 getgroups sys_getgroups
81 o32 setgroups sys_setgroups
# 82 was old_select
82 o32 reserved82 sys_ni_syscall
83 o32 symlink sys_symlink
# 84 was sys_lstat
84 o32 unused84 sys_ni_syscall
85 o32 readlink sys_readlink
86 o32 uselib sys_uselib
87 o32 swapon sys_swapon
88 o32 reboot sys_reboot
89 o32 readdir sys_old_readdir compat_sys_old_readdir
90 o32 mmap sys_mips_mmap
91 o32 munmap sys_munmap
92 o32 truncate sys_truncate compat_sys_truncate
93 o32 ftruncate sys_ftruncate compat_sys_ftruncate
94 o32 fchmod sys_fchmod
95 o32 fchown sys_fchown
96 o32 getpriority sys_getpriority
97 o32 setpriority sys_setpriority
98 o32 profil sys_ni_syscall
99 o32 statfs sys_statfs compat_sys_statfs
100 o32 fstatfs sys_fstatfs compat_sys_fstatfs
101 o32 ioperm sys_ni_syscall
102 o32 socketcall sys_socketcall compat_sys_socketcall
103 o32 syslog sys_syslog
104 o32 setitimer sys_setitimer compat_sys_setitimer
105 o32 getitimer sys_getitimer compat_sys_getitimer
106 o32 stat sys_newstat compat_sys_newstat
107 o32 lstat sys_newlstat compat_sys_newlstat
108 o32 fstat sys_newfstat compat_sys_newfstat
109 o32 unused109 sys_uname
110 o32 iopl sys_ni_syscall
111 o32 vhangup sys_vhangup
112 o32 idle sys_ni_syscall
113 o32 vm86 sys_ni_syscall
114 o32 wait4 sys_wait4 compat_sys_wait4
115 o32 swapoff sys_swapoff
116 o32 sysinfo sys_sysinfo compat_sys_sysinfo
117 o32 ipc sys_ipc compat_sys_ipc
118 o32 fsync sys_fsync
119 o32 sigreturn sys_sigreturn sys32_sigreturn
120 o32 clone __sys_clone
121 o32 setdomainname sys_setdomainname
122 o32 uname sys_newuname
123 o32 modify_ldt sys_ni_syscall
124 o32 adjtimex sys_adjtimex_time32
125 o32 mprotect sys_mprotect
126 o32 sigprocmask sys_sigprocmask compat_sys_sigprocmask
127 o32 create_module sys_ni_syscall
128 o32 init_module sys_init_module
129 o32 delete_module sys_delete_module
130 o32 get_kernel_syms sys_ni_syscall
131 o32 quotactl sys_quotactl
132 o32 getpgid sys_getpgid
133 o32 fchdir sys_fchdir
134 o32 bdflush sys_ni_syscall
135 o32 sysfs sys_sysfs
136 o32 personality sys_personality sys_32_personality
137 o32 afs_syscall sys_ni_syscall
138 o32 setfsuid sys_setfsuid
139 o32 setfsgid sys_setfsgid
140 o32 _llseek sys_llseek sys_32_llseek
141 o32 getdents sys_getdents compat_sys_getdents
142 o32 _newselect sys_select compat_sys_select
143 o32 flock sys_flock
144 o32 msync sys_msync
145 o32 readv sys_readv
146 o32 writev sys_writev
147 o32 cacheflush sys_cacheflush
148 o32 cachectl sys_cachectl
149 o32 sysmips __sys_sysmips
150 o32 unused150 sys_ni_syscall
151 o32 getsid sys_getsid
152 o32 fdatasync sys_fdatasync
153 o32 _sysctl sys_ni_syscall
154 o32 mlock sys_mlock
155 o32 munlock sys_munlock
156 o32 mlockall sys_mlockall
157 o32 munlockall sys_munlockall
158 o32 sched_setparam sys_sched_setparam
159 o32 sched_getparam sys_sched_getparam
160 o32 sched_setscheduler sys_sched_setscheduler
161 o32 sched_getscheduler sys_sched_getscheduler
162 o32 sched_yield sys_sched_yield
163 o32 sched_get_priority_max sys_sched_get_priority_max
164 o32 sched_get_priority_min sys_sched_get_priority_min
165 o32 sched_rr_get_interval sys_sched_rr_get_interval_time32
166 o32 nanosleep sys_nanosleep_time32
167 o32 mremap sys_mremap
168 o32 accept sys_accept
169 o32 bind sys_bind
170 o32 connect sys_connect
171 o32 getpeername sys_getpeername
172 o32 getsockname sys_getsockname
173 o32 getsockopt sys_getsockopt sys_getsockopt
174 o32 listen sys_listen
175 o32 recv sys_recv compat_sys_recv
176 o32 recvfrom sys_recvfrom compat_sys_recvfrom
177 o32 recvmsg sys_recvmsg compat_sys_recvmsg
178 o32 send sys_send
179 o32 sendmsg sys_sendmsg compat_sys_sendmsg
180 o32 sendto sys_sendto
181 o32 setsockopt sys_setsockopt sys_setsockopt
182 o32 shutdown sys_shutdown
183 o32 socket sys_socket
184 o32 socketpair sys_socketpair
185 o32 setresuid sys_setresuid
186 o32 getresuid sys_getresuid
187 o32 query_module sys_ni_syscall
188 o32 poll sys_poll
189 o32 nfsservctl sys_ni_syscall
190 o32 setresgid sys_setresgid
191 o32 getresgid sys_getresgid
192 o32 prctl sys_prctl
193 o32 rt_sigreturn sys_rt_sigreturn sys32_rt_sigreturn
194 o32 rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction
195 o32 rt_sigprocmask sys_rt_sigprocmask compat_sys_rt_sigprocmask
196 o32 rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending
197 o32 rt_sigtimedwait sys_rt_sigtimedwait_time32 compat_sys_rt_sigtimedwait_time32
198 o32 rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo
199 o32 rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend
200 o32 pread64 sys_pread64 sys_32_pread
201 o32 pwrite64 sys_pwrite64 sys_32_pwrite
202 o32 chown sys_chown
203 o32 getcwd sys_getcwd
204 o32 capget sys_capget
205 o32 capset sys_capset
206 o32 sigaltstack sys_sigaltstack compat_sys_sigaltstack
207 o32 sendfile sys_sendfile compat_sys_sendfile
208 o32 getpmsg sys_ni_syscall
209 o32 putpmsg sys_ni_syscall
210 o32 mmap2 sys_mips_mmap2
211 o32 truncate64 sys_truncate64 sys_32_truncate64
212 o32 ftruncate64 sys_ftruncate64 sys_32_ftruncate64
213 o32 stat64 sys_stat64 sys_newstat
214 o32 lstat64 sys_lstat64 sys_newlstat
215 o32 fstat64 sys_fstat64 sys_newfstat
216 o32 pivot_root sys_pivot_root
217 o32 mincore sys_mincore
218 o32 madvise sys_madvise
219 o32 getdents64 sys_getdents64
220 o32 fcntl64 sys_fcntl64 compat_sys_fcntl64
221 o32 reserved221 sys_ni_syscall
222 o32 gettid sys_gettid
223 o32 readahead sys_readahead sys32_readahead
224 o32 setxattr sys_setxattr
225 o32 lsetxattr sys_lsetxattr
226 o32 fsetxattr sys_fsetxattr
227 o32 getxattr sys_getxattr
228 o32 lgetxattr sys_lgetxattr
229 o32 fgetxattr sys_fgetxattr
230 o32 listxattr sys_listxattr
231 o32 llistxattr sys_llistxattr
232 o32 flistxattr sys_flistxattr
233 o32 removexattr sys_removexattr
234 o32 lremovexattr sys_lremovexattr
235 o32 fremovexattr sys_fremovexattr
236 o32 tkill sys_tkill
237 o32 sendfile64 sys_sendfile64
238 o32 futex sys_futex_time32
239 o32 sched_setaffinity sys_sched_setaffinity compat_sys_sched_setaffinity
240 o32 sched_getaffinity sys_sched_getaffinity compat_sys_sched_getaffinity
241 o32 io_setup sys_io_setup compat_sys_io_setup
242 o32 io_destroy sys_io_destroy
243 o32 io_getevents sys_io_getevents_time32
244 o32 io_submit sys_io_submit compat_sys_io_submit
245 o32 io_cancel sys_io_cancel
246 o32 exit_group sys_exit_group
247 o32 lookup_dcookie sys_ni_syscall
248 o32 epoll_create sys_epoll_create
249 o32 epoll_ctl sys_epoll_ctl
250 o32 epoll_wait sys_epoll_wait
251 o32 remap_file_pages sys_remap_file_pages
252 o32 set_tid_address sys_set_tid_address
253 o32 restart_syscall sys_restart_syscall
254 o32 fadvise64 sys_fadvise64_64 sys32_fadvise64_64
255 o32 statfs64 sys_statfs64 compat_sys_statfs64
256 o32 fstatfs64 sys_fstatfs64 compat_sys_fstatfs64
257 o32 timer_create sys_timer_create compat_sys_timer_create
258 o32 timer_settime sys_timer_settime32
259 o32 timer_gettime sys_timer_gettime32
260 o32 timer_getoverrun sys_timer_getoverrun
261 o32 timer_delete sys_timer_delete
262 o32 clock_settime sys_clock_settime32
263 o32 clock_gettime sys_clock_gettime32
264 o32 clock_getres sys_clock_getres_time32
265 o32 clock_nanosleep sys_clock_nanosleep_time32
266 o32 tgkill sys_tgkill
267 o32 utimes sys_utimes_time32
268 o32 mbind sys_mbind
269 o32 get_mempolicy sys_get_mempolicy
270 o32 set_mempolicy sys_set_mempolicy
271 o32 mq_open sys_mq_open compat_sys_mq_open
272 o32 mq_unlink sys_mq_unlink
273 o32 mq_timedsend sys_mq_timedsend_time32
274 o32 mq_timedreceive sys_mq_timedreceive_time32
275 o32 mq_notify sys_mq_notify compat_sys_mq_notify
276 o32 mq_getsetattr sys_mq_getsetattr compat_sys_mq_getsetattr
277 o32 vserver sys_ni_syscall
278 o32 waitid sys_waitid compat_sys_waitid
# 279 was sys_setaltroot
280 o32 add_key sys_add_key
281 o32 request_key sys_request_key
282 o32 keyctl sys_keyctl compat_sys_keyctl
283 o32 set_thread_area sys_set_thread_area
284 o32 inotify_init sys_inotify_init
285 o32 inotify_add_watch sys_inotify_add_watch
286 o32 inotify_rm_watch sys_inotify_rm_watch
287 o32 migrate_pages sys_migrate_pages
288 o32 openat sys_openat compat_sys_openat
289 o32 mkdirat sys_mkdirat
290 o32 mknodat sys_mknodat
291 o32 fchownat sys_fchownat
292 o32 futimesat sys_futimesat_time32
293 o32 fstatat64 sys_fstatat64 sys_newfstatat
294 o32 unlinkat sys_unlinkat
295 o32 renameat sys_renameat
296 o32 linkat sys_linkat
297 o32 symlinkat sys_symlinkat
298 o32 readlinkat sys_readlinkat
299 o32 fchmodat sys_fchmodat
300 o32 faccessat sys_faccessat
301 o32 pselect6 sys_pselect6_time32 compat_sys_pselect6_time32
302 o32 ppoll sys_ppoll_time32 compat_sys_ppoll_time32
303 o32 unshare sys_unshare
304 o32 splice sys_splice
305 o32 sync_file_range sys_sync_file_range sys32_sync_file_range
306 o32 tee sys_tee
307 o32 vmsplice sys_vmsplice
308 o32 move_pages sys_move_pages
309 o32 set_robust_list sys_set_robust_list compat_sys_set_robust_list
310 o32 get_robust_list sys_get_robust_list compat_sys_get_robust_list
311 o32 kexec_load sys_kexec_load compat_sys_kexec_load
312 o32 getcpu sys_getcpu
313 o32 epoll_pwait sys_epoll_pwait compat_sys_epoll_pwait
314 o32 ioprio_set sys_ioprio_set
315 o32 ioprio_get sys_ioprio_get
316 o32 utimensat sys_utimensat_time32
317 o32 signalfd sys_signalfd compat_sys_signalfd
318 o32 timerfd sys_ni_syscall
319 o32 eventfd sys_eventfd
320 o32 fallocate sys_fallocate sys32_fallocate
321 o32 timerfd_create sys_timerfd_create
322 o32 timerfd_gettime sys_timerfd_gettime32
323 o32 timerfd_settime sys_timerfd_settime32
324 o32 signalfd4 sys_signalfd4 compat_sys_signalfd4
325 o32 eventfd2 sys_eventfd2
326 o32 epoll_create1 sys_epoll_create1
327 o32 dup3 sys_dup3
328 o32 pipe2 sys_pipe2
329 o32 inotify_init1 sys_inotify_init1
330 o32 preadv sys_preadv compat_sys_preadv
331 o32 pwritev sys_pwritev compat_sys_pwritev
332 o32 rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo
333 o32 perf_event_open sys_perf_event_open
334 o32 accept4 sys_accept4
335 o32 recvmmsg sys_recvmmsg_time32 compat_sys_recvmmsg_time32
336 o32 fanotify_init sys_fanotify_init
337 o32 fanotify_mark sys_fanotify_mark compat_sys_fanotify_mark
338 o32 prlimit64 sys_prlimit64
339 o32 name_to_handle_at sys_name_to_handle_at
340 o32 open_by_handle_at sys_open_by_handle_at compat_sys_open_by_handle_at
341 o32 clock_adjtime sys_clock_adjtime32
342 o32 syncfs sys_syncfs
343 o32 sendmmsg sys_sendmmsg compat_sys_sendmmsg
344 o32 setns sys_setns
345 o32 process_vm_readv sys_process_vm_readv
346 o32 process_vm_writev sys_process_vm_writev
347 o32 kcmp sys_kcmp
348 o32 finit_module sys_finit_module
349 o32 sched_setattr sys_sched_setattr
350 o32 sched_getattr sys_sched_getattr
351 o32 renameat2 sys_renameat2
352 o32 seccomp sys_seccomp
353 o32 getrandom sys_getrandom
354 o32 memfd_create sys_memfd_create
355 o32 bpf sys_bpf
356 o32 execveat sys_execveat compat_sys_execveat
357 o32 userfaultfd sys_userfaultfd
358 o32 membarrier sys_membarrier
359 o32 mlock2 sys_mlock2
360 o32 copy_file_range sys_copy_file_range
361 o32 preadv2 sys_preadv2 compat_sys_preadv2
362 o32 pwritev2 sys_pwritev2 compat_sys_pwritev2
363 o32 pkey_mprotect sys_pkey_mprotect
364 o32 pkey_alloc sys_pkey_alloc
365 o32 pkey_free sys_pkey_free
366 o32 statx sys_statx
367 o32 rseq sys_rseq
368 o32 io_pgetevents sys_io_pgetevents_time32 compat_sys_io_pgetevents
# room for arch specific calls
393 o32 semget sys_semget
394 o32 semctl sys_semctl compat_sys_semctl
395 o32 shmget sys_shmget
396 o32 shmctl sys_shmctl compat_sys_shmctl
397 o32 shmat sys_shmat compat_sys_shmat
398 o32 shmdt sys_shmdt
399 o32 msgget sys_msgget
400 o32 msgsnd sys_msgsnd compat_sys_msgsnd
401 o32 msgrcv sys_msgrcv compat_sys_msgrcv
402 o32 msgctl sys_msgctl compat_sys_msgctl
403 o32 clock_gettime64 sys_clock_gettime sys_clock_gettime
404 o32 clock_settime64 sys_clock_settime sys_clock_settime
405 o32 clock_adjtime64 sys_clock_adjtime sys_clock_adjtime
406 o32 clock_getres_time64 sys_clock_getres sys_clock_getres
407 o32 clock_nanosleep_time64 sys_clock_nanosleep sys_clock_nanosleep
408 o32 timer_gettime64 sys_timer_gettime sys_timer_gettime
409 o32 timer_settime64 sys_timer_settime sys_timer_settime
410 o32 timerfd_gettime64 sys_timerfd_gettime sys_timerfd_gettime
411 o32 timerfd_settime64 sys_timerfd_settime sys_timerfd_settime
412 o32 utimensat_time64 sys_utimensat sys_utimensat
413 o32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64
414 o32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64
416 o32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64
417 o32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64
418 o32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend
419 o32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive
420 o32 semtimedop_time64 sys_semtimedop sys_semtimedop
421 o32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64
422 o32 futex_time64 sys_futex sys_futex
423 o32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval
424 o32 pidfd_send_signal sys_pidfd_send_signal
425 o32 io_uring_setup sys_io_uring_setup
426 o32 io_uring_enter sys_io_uring_enter
427 o32 io_uring_register sys_io_uring_register
428 o32 open_tree sys_open_tree
429 o32 move_mount sys_move_mount
430 o32 fsopen sys_fsopen
431 o32 fsconfig sys_fsconfig
432 o32 fsmount sys_fsmount
433 o32 fspick sys_fspick
434 o32 pidfd_open sys_pidfd_open
435 o32 clone3 __sys_clone3
436 o32 close_range sys_close_range
437 o32 openat2 sys_openat2
438 o32 pidfd_getfd sys_pidfd_getfd
439 o32 faccessat2 sys_faccessat2
440 o32 process_madvise sys_process_madvise
441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 o32 mount_setattr sys_mount_setattr
443 o32 quotactl_fd sys_quotactl_fd
444 o32 landlock_create_ruleset sys_landlock_create_ruleset
445 o32 landlock_add_rule sys_landlock_add_rule
446 o32 landlock_restrict_self sys_landlock_restrict_self
# 447 reserved for memfd_secret
448 o32 process_mrelease sys_process_mrelease
449 o32 futex_waitv sys_futex_waitv
450 o32 set_mempolicy_home_node sys_set_mempolicy_home_node
451 o32 cachestat sys_cachestat
452 o32 fchmodat2 sys_fchmodat2
453 o32 map_shadow_stack sys_map_shadow_stack
454 o32 futex_wake sys_futex_wake
455 o32 futex_wait sys_futex_wait
456 o32 futex_requeue sys_futex_requeue
457 o32 statmount sys_statmount
458 o32 listmount sys_listmount
459 o32 lsm_get_self_attr sys_lsm_get_self_attr
460 o32 lsm_set_self_attr sys_lsm_set_self_attr
461 o32 lsm_list_modules sys_lsm_list_modules
462 o32 mseal sys_mseal
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
in="$1"
out="$2"
my_abis=`echo "($3)" | tr ',' '|'`
prefix="$4"
offset="$5"
fileguard=LINUX_USER_MIPS_`basename "$out" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
printf "#ifndef %s\n" "${fileguard}"
printf "#define %s\n" "${fileguard}"
printf "\n"
nxt=0
while read nr abi name entry compat ; do
if [ "$name" = "fadvise64" ] ; then
name="fadvise64_64"
fi
if [ -z "$offset" ]; then
printf "#define TARGET_NR_%s%s\t%s\n" \
"${prefix}" "${name}" "${nr}"
else
printf "#define TARGET_NR_%s%s\t(%s + %s)\n" \
"${prefix}" "${name}" "${offset}" "${nr}"
fi
nxt=$((nr+1))
done
printf "\n"
printf "#endif /* %s */" "${fileguard}"
printf "\n"
) > "$out"
+50
View File
@@ -0,0 +1,50 @@
/*
* MIPS specific CPU ABI and functions for linux-user
*
* Copyright (c) 2004-2005 Jocelyn Mayer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIPS_TARGET_CPU_H
#define MIPS_TARGET_CPU_H
static inline void cpu_clone_regs_child(CPUMIPSState *env, target_ulong newsp,
unsigned flags)
{
if (newsp) {
env->active_tc.gpr[29] = newsp;
}
env->active_tc.gpr[7] = 0;
env->active_tc.gpr[2] = 0;
}
static inline void cpu_clone_regs_parent(CPUMIPSState *env, unsigned flags)
{
}
static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)
{
TaskState *ts = get_task_state(env_cpu(env));
env->active_tc.CP0_UserLocal = newtls;
if (ts->info->use_k0_tls) {
env->active_tc.gpr[26] = newtls;
}
}
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
{
return state->active_tc.gpr[29];
}
#endif
+42
View File
@@ -0,0 +1,42 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation, or (at your option) any
* later version. See the COPYING file in the top-level directory.
*/
#ifndef MIPS_TARGET_ELF_H
#define MIPS_TARGET_ELF_H
#include "target_ptrace.h"
#define ELF_CLASS ELFCLASS32
#define ELF_MACHINE EM_MIPS
#define EXSTACK_DEFAULT true
#define HAVE_ELF_HWCAP 1
#define HAVE_ELF_BASE_PLATFORM 1
#define HAVE_ELF_CORE_DUMP 1
/* See linux kernel: arch/mips/include/asm/elf.h. */
typedef struct target_elf_gregset_t {
union {
abi_ulong reserved[45];
struct target_pt_regs pt;
};
} target_elf_gregset_t;
#define HAVE_ELF_CORE_FPREGS 1
/*
* Matches the kernel's elf_fpregset_t (ELF_NFPREG = 33):
* fpr[0..31] hold f0-f31; fcsr occupies the low 32 bits of slot 32.
* pad rounds the struct to 33 × 8 bytes = 264 bytes.
*/
typedef struct target_elf_fpregset_t {
uint64_t fpr[32];
uint32_t fcsr;
uint32_t pad;
} target_elf_fpregset_t;
#endif
+221
View File
@@ -0,0 +1,221 @@
#ifndef MIPS_TARGET_ERRNO_DEFS_H
#define MIPS_TARGET_ERRNO_DEFS_H
#include "../generic/target_errno_defs.h"
/*
* Generic target errno overridden with definitions taken
* from asm-mips/errno.h
*/
#undef TARGET_EWOULDBLOCK
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
#undef TARGET_ENOMSG
#define TARGET_ENOMSG 35 /* Identifier removed */
#undef TARGET_EIDRM
#define TARGET_EIDRM 36 /* Identifier removed */
#undef TARGET_ECHRNG
#define TARGET_ECHRNG 37 /* Channel number out of range */
#undef TARGET_EL2NSYNC
#define TARGET_EL2NSYNC 38 /* Level 2 not synchronized */
#undef TARGET_EL3HLT
#define TARGET_EL3HLT 39 /* Level 3 halted */
#undef TARGET_EL3RST
#define TARGET_EL3RST 40 /* Level 3 reset */
#undef TARGET_ELNRNG
#define TARGET_ELNRNG 41 /* Link number out of range */
#undef TARGET_EUNATCH
#define TARGET_EUNATCH 42 /* Protocol driver not attached */
#undef TARGET_ENOCSI
#define TARGET_ENOCSI 43 /* No CSI structure available */
#undef TARGET_EL2HLT
#define TARGET_EL2HLT 44 /* Level 2 halted */
#undef TARGET_EDEADLK
#define TARGET_EDEADLK 45 /* Resource deadlock would occur */
#undef TARGET_ENOLCK
#define TARGET_ENOLCK 46 /* No record locks available */
#undef TARGET_EBADE
#define TARGET_EBADE 50 /* Invalid exchange */
#undef TARGET_EBADR
#define TARGET_EBADR 51 /* Invalid request descriptor */
#undef TARGET_EXFULL
#define TARGET_EXFULL 52 /* TARGET_Exchange full */
#undef TARGET_ENOANO
#define TARGET_ENOANO 53 /* No anode */
#undef TARGET_EBADRQC
#define TARGET_EBADRQC 54 /* Invalid request code */
#undef TARGET_EBADSLT
#define TARGET_EBADSLT 55 /* Invalid slot */
#undef TARGET_EDEADLOCK
#define TARGET_EDEADLOCK 56 /* File locking deadlock error */
#undef TARGET_EBFONT
#define TARGET_EBFONT 59 /* Bad font file format */
#undef TARGET_ENOSTR
#define TARGET_ENOSTR 60 /* Device not a stream */
#undef TARGET_ENODATA
#define TARGET_ENODATA 61 /* No data available */
#undef TARGET_ETIME
#define TARGET_ETIME 62 /* Timer expired */
#undef TARGET_ENOSR
#define TARGET_ENOSR 63 /* Out of streams resources */
#undef TARGET_ENONET
#define TARGET_ENONET 64 /* Machine is not on the network */
#undef TARGET_ENOPKG
#define TARGET_ENOPKG 65 /* Package not installed */
#undef TARGET_EREMOTE
#define TARGET_EREMOTE 66 /* Object is remote */
#undef TARGET_ENOLINK
#define TARGET_ENOLINK 67 /* Link has been severed */
#undef TARGET_EADV
#define TARGET_EADV 68 /* Advertise error */
#undef TARGET_ESRMNT
#define TARGET_ESRMNT 69 /* Srmount error */
#undef TARGET_ECOMM
#define TARGET_ECOMM 70 /* Communication error on send */
#undef TARGET_EPROTO
#define TARGET_EPROTO 71 /* Protocol error */
#undef TARGET_EDOTDOT
#define TARGET_EDOTDOT 73 /* RFS specific error */
#undef TARGET_EMULTIHOP
#define TARGET_EMULTIHOP 74 /* Multihop attempted */
#undef TARGET_EBADMSG
#define TARGET_EBADMSG 77 /* Not a data message */
#undef TARGET_ENAMETOOLONG
#define TARGET_ENAMETOOLONG 78 /* File name too long */
#undef TARGET_EOVERFLOW
#define TARGET_EOVERFLOW 79 /* Value too large for defined data type */
#undef TARGET_ENOTUNIQ
#define TARGET_ENOTUNIQ 80 /* Name not unique on network */
#undef TARGET_EBADFD
#define TARGET_EBADFD 81 /* File descriptor in bad state */
#undef TARGET_EREMCHG
#define TARGET_EREMCHG 82 /* Remote address changed */
#undef TARGET_ELIBACC
#define TARGET_ELIBACC 83 /* Can not access a needed shared library */
#undef TARGET_ELIBBAD
#define TARGET_ELIBBAD 84 /* Accessing a corrupted shared library */
#undef TARGET_ELIBSCN
#define TARGET_ELIBSCN 85 /* .lib section in a.out corrupted */
#undef TARGET_ELIBMAX
#define TARGET_ELIBMAX 86 /* Attempting to link in too many shared libraries */
#undef TARGET_ELIBEXEC
#define TARGET_ELIBEXEC 87 /* Cannot exec a shared library directly */
#undef TARGET_EILSEQ
#define TARGET_EILSEQ 88 /* Illegal byte sequence */
#undef TARGET_ENOSYS
#define TARGET_ENOSYS 89 /* Function not implemented */
#undef TARGET_ELOOP
#define TARGET_ELOOP 90 /* Too many symbolic links encountered */
#undef TARGET_ERESTART
#define TARGET_ERESTART 91 /* Interrupted system call should be restarted */
#undef TARGET_ESTRPIPE
#define TARGET_ESTRPIPE 92 /* Streams pipe error */
#undef TARGET_ENOTEMPTY
#define TARGET_ENOTEMPTY 93 /* Directory not empty */
#undef TARGET_EUSERS
#define TARGET_EUSERS 94 /* Too many users */
#undef TARGET_ENOTSOCK
#define TARGET_ENOTSOCK 95 /* Socket operation on non-socket */
#undef TARGET_EDESTADDRREQ
#define TARGET_EDESTADDRREQ 96 /* Destination address required */
#undef TARGET_EMSGSIZE
#define TARGET_EMSGSIZE 97 /* Message too long */
#undef TARGET_EPROTOTYPE
#define TARGET_EPROTOTYPE 98 /* Protocol wrong type for socket */
#undef TARGET_ENOPROTOOPT
#define TARGET_ENOPROTOOPT 99 /* Protocol not available */
#undef TARGET_EPROTONOSUPPORT
#define TARGET_EPROTONOSUPPORT 120 /* Protocol not supported */
#undef TARGET_ESOCKTNOSUPPORT
#define TARGET_ESOCKTNOSUPPORT 121 /* Socket type not supported */
#undef TARGET_EOPNOTSUPP
#define TARGET_EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
#undef TARGET_EPFNOSUPPORT
#define TARGET_EPFNOSUPPORT 123 /* Protocol family not supported */
#undef TARGET_EAFNOSUPPORT
#define TARGET_EAFNOSUPPORT 124 /* Address family not supported by protocol */
#undef TARGET_EADDRINUSE
#define TARGET_EADDRINUSE 125 /* Address already in use */
#undef TARGET_EADDRNOTAVAIL
#define TARGET_EADDRNOTAVAIL 126 /* Cannot assign requested address */
#undef TARGET_ENETDOWN
#define TARGET_ENETDOWN 127 /* Network is down */
#undef TARGET_ENETUNREACH
#define TARGET_ENETUNREACH 128 /* Network is unreachable */
#undef TARGET_ENETRESET
#define TARGET_ENETRESET 129 /* Network dropped connection because of reset */
#undef TARGET_ECONNABORTED
#define TARGET_ECONNABORTED 130 /* Software caused connection abort */
#undef TARGET_ECONNRESET
#define TARGET_ECONNRESET 131 /* Connection reset by peer */
#undef TARGET_ENOBUFS
#define TARGET_ENOBUFS 132 /* No buffer space available */
#undef TARGET_EISCONN
#define TARGET_EISCONN 133 /* Transport endpoint is already connected */
#undef TARGET_ENOTCONN
#define TARGET_ENOTCONN 134 /* Transport endpoint is not connected */
#undef TARGET_EUCLEAN
#define TARGET_EUCLEAN 135 /* Structure needs cleaning */
#undef TARGET_ENOTNAM
#define TARGET_ENOTNAM 137 /* Not a XENIX named type file */
#undef TARGET_ENAVAIL
#define TARGET_ENAVAIL 138 /* No XENIX semaphores available */
#undef TARGET_EISNAM
#define TARGET_EISNAM 139 /* Is a named type file */
#undef TARGET_EREMOTEIO
#define TARGET_EREMOTEIO 140 /* Remote I/O error */
#undef TARGET_EINIT
#define TARGET_EINIT 141 /* Reserved */
#undef TARGET_EREMDEV
#define TARGET_EREMDEV 142 /* TARGET_Error 142 */
#undef TARGET_ESHUTDOWN
#define TARGET_ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
#undef TARGET_ETOOMANYREFS
#define TARGET_ETOOMANYREFS 144 /* Too many references: cannot splice */
#undef TARGET_ETIMEDOUT
#define TARGET_ETIMEDOUT 145 /* Connection timed out */
#undef TARGET_ECONNREFUSED
#define TARGET_ECONNREFUSED 146 /* Connection refused */
#undef TARGET_EHOSTDOWN
#define TARGET_EHOSTDOWN 147 /* Host is down */
#undef TARGET_EHOSTUNREACH
#define TARGET_EHOSTUNREACH 148 /* No route to host */
#undef TARGET_EALREADY
#define TARGET_EALREADY 149 /* Operation already in progress */
#undef TARGET_EINPROGRESS
#define TARGET_EINPROGRESS 150 /* Operation now in progress */
#undef TARGET_ESTALE
#define TARGET_ESTALE 151 /* Stale NFS file handle */
#undef TARGET_ECANCELED
#define TARGET_ECANCELED 158 /* AIO operation canceled */
/*
* These error are Linux extensions.
*/
#undef TARGET_ENOMEDIUM
#define TARGET_ENOMEDIUM 159 /* No medium found */
#undef TARGET_EMEDIUMTYPE
#define TARGET_EMEDIUMTYPE 160 /* Wrong medium type */
#undef TARGET_ENOKEY
#define TARGET_ENOKEY 161 /* Required key not available */
#undef TARGET_EKEYEXPIRED
#define TARGET_EKEYEXPIRED 162 /* Key has expired */
#undef TARGET_EKEYREVOKED
#define TARGET_EKEYREVOKED 163 /* Key has been revoked */
#undef TARGET_EKEYREJECTED
#define TARGET_EKEYREJECTED 164 /* Key was rejected by service */
/* for robust mutexes */
#undef TARGET_EOWNERDEAD
#define TARGET_EOWNERDEAD 165 /* Owner died */
#undef TARGET_ENOTRECOVERABLE
#define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */
#undef TARGET_ERFKILL
#define TARGET_ERFKILL 167
#undef TARGET_EHWPOISON
#define TARGET_EHWPOISON 168
#undef TARGET_EDQUOT
#define TARGET_EDQUOT 1133 /* Quota exceeded */
#endif
+51
View File
@@ -0,0 +1,51 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation, or (at your option) any
* later version. See the COPYING file in the top-level directory.
*/
#ifndef MIPS_TARGET_FCNTL_H
#define MIPS_TARGET_FCNTL_H
#define TARGET_O_APPEND 0x0008
#define TARGET_O_DSYNC 0x0010
#define TARGET_O_NONBLOCK 0x0080
#define TARGET_O_CREAT 0x0100 /* not fcntl */
#define TARGET_O_TRUNC 0x0200 /* not fcntl */
#define TARGET_O_EXCL 0x0400 /* not fcntl */
#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
#define TARGET___O_SYNC 0x4000
#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
#define TARGET_F_GETLK 14
#define TARGET_F_SETLK 6
#define TARGET_F_SETLKW 7
#define TARGET_F_SETOWN 24 /* for sockets. */
#define TARGET_F_GETOWN 23 /* for sockets. */
#if (TARGET_ABI_BITS == 32)
struct target_flock {
short l_type;
short l_whence;
abi_long l_start;
abi_long l_len;
abi_long l_sysid;
int l_pid;
abi_long pad[4];
};
#define TARGET_HAVE_ARCH_STRUCT_FLOCK
#endif
#define TARGET_F_GETLK64 33 /* using 'struct flock64' */
#define TARGET_F_SETLK64 34
#define TARGET_F_SETLKW64 35
#include "../generic/fcntl.h"
#endif
+29
View File
@@ -0,0 +1,29 @@
#ifndef MIPS_TARGET_MMAN_H
#define MIPS_TARGET_MMAN_H
#define TARGET_PROT_SEM 0x10
#define TARGET_MAP_NORESERVE 0x0400
#define TARGET_MAP_ANONYMOUS 0x0800
#define TARGET_MAP_GROWSDOWN 0x1000
#define TARGET_MAP_DENYWRITE 0x2000
#define TARGET_MAP_EXECUTABLE 0x4000
#define TARGET_MAP_LOCKED 0x8000
#define TARGET_MAP_POPULATE 0x10000
#define TARGET_MAP_NONBLOCK 0x20000
#define TARGET_MAP_STACK 0x40000
#define TARGET_MAP_HUGETLB 0x80000
/*
* arch/mips/include/asm/processor.h:
* TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
*/
#define TASK_UNMAPPED_BASE \
TARGET_PAGE_ALIGN((1ull << TARGET_VIRT_ADDR_SPACE_BITS) / 3)
/* arch/mips/include/asm/elf.h */
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE * 2)
#include "../generic/target_mman.h"
#endif
+88
View File
@@ -0,0 +1,88 @@
/*
* MIPS specific prctl functions for linux-user
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef MIPS_TARGET_PRCTL_H
#define MIPS_TARGET_PRCTL_H
static abi_long do_prctl_get_fp_mode(CPUArchState *env)
{
abi_long ret = 0;
if (env->CP0_Status & (1 << CP0St_FR)) {
ret |= PR_FP_MODE_FR;
}
if (env->CP0_Config5 & (1 << CP0C5_FRE)) {
ret |= PR_FP_MODE_FRE;
}
return ret;
}
#define do_prctl_get_fp_mode do_prctl_get_fp_mode
static abi_long do_prctl_set_fp_mode(CPUArchState *env, abi_long arg2)
{
bool old_fr = env->CP0_Status & (1 << CP0St_FR);
bool old_fre = env->CP0_Config5 & (1 << CP0C5_FRE);
bool new_fr = arg2 & PR_FP_MODE_FR;
bool new_fre = arg2 & PR_FP_MODE_FRE;
const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE;
/* If nothing to change, return right away, successfully. */
if (old_fr == new_fr && old_fre == new_fre) {
return 0;
}
/* Check the value is valid */
if (arg2 & ~known_bits) {
return -TARGET_EOPNOTSUPP;
}
/* Setting FRE without FR is not supported. */
if (new_fre && !new_fr) {
return -TARGET_EOPNOTSUPP;
}
if (new_fr && !(env->active_fpu.fcr0 & (1 << FCR0_F64))) {
/* FR1 is not supported */
return -TARGET_EOPNOTSUPP;
}
if (!new_fr && (env->active_fpu.fcr0 & (1 << FCR0_F64))
&& !(env->CP0_Status_rw_bitmask & (1 << CP0St_FR))) {
/* cannot set FR=0 */
return -TARGET_EOPNOTSUPP;
}
if (new_fre && !(env->active_fpu.fcr0 & (1 << FCR0_FREP))) {
/* Cannot set FRE=1 */
return -TARGET_EOPNOTSUPP;
}
int i;
fpr_t *fpr = env->active_fpu.fpr;
for (i = 0; i < 32 ; i += 2) {
if (!old_fr && new_fr) {
fpr[i].w[!FP_ENDIAN_IDX] = fpr[i + 1].w[FP_ENDIAN_IDX];
} else if (old_fr && !new_fr) {
fpr[i + 1].w[FP_ENDIAN_IDX] = fpr[i].w[!FP_ENDIAN_IDX];
}
}
if (new_fr) {
env->CP0_Status |= (1 << CP0St_FR);
env->hflags |= MIPS_HFLAG_F64;
} else {
env->CP0_Status &= ~(1 << CP0St_FR);
env->hflags &= ~MIPS_HFLAG_F64;
}
if (new_fre) {
env->CP0_Config5 |= (1 << CP0C5_FRE);
if (env->active_fpu.fcr0 & (1 << FCR0_FREP)) {
env->hflags |= MIPS_HFLAG_FRE;
}
} else {
env->CP0_Config5 &= ~(1 << CP0C5_FRE);
env->hflags &= ~MIPS_HFLAG_FRE;
}
return 0;
}
#define do_prctl_set_fp_mode do_prctl_set_fp_mode
#endif /* MIPS_TARGET_PRCTL_H */
+1
View File
@@ -0,0 +1 @@
/* No target-specific /proc support */
+17
View File
@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef MIPS_TARGET_PTRACE_H
#define MIPS_TARGET_PTRACE_H
struct target_pt_regs {
abi_ulong pad0[6];
abi_ulong regs[32];
abi_ulong lo;
abi_ulong hi;
abi_ulong cp0_epc;
abi_ulong cp0_badvaddr;
abi_ulong cp0_status;
abi_ulong cp0_cause;
};
#endif /* MIPS_TARGET_PTRACE_H */
+24
View File
@@ -0,0 +1,24 @@
#ifndef MIPS_TARGET_RESOURCE_H
#define MIPS_TARGET_RESOURCE_H
#include "../generic/target_resource.h"
#undef TARGET_RLIM_INFINITY
#define TARGET_RLIM_INFINITY 0x7fffffffUL
#undef TARGET_RLIMIT_NOFILE
#define TARGET_RLIMIT_NOFILE 5
#undef TARGET_RLIMIT_AS
#define TARGET_RLIMIT_AS 6
#undef TARGET_RLIMIT_RSS
#define TARGET_RLIMIT_RSS 7
#undef TARGET_RLIMIT_NPROC
#define TARGET_RLIMIT_NPROC 8
#undef TARGET_RLIMIT_MEMLOCK
#define TARGET_RLIMIT_MEMLOCK 9
#endif
+81
View File
@@ -0,0 +1,81 @@
#ifndef MIPS_TARGET_SIGNAL_H
#define MIPS_TARGET_SIGNAL_H
#define TARGET_SIGHUP 1 /* Hangup (POSIX). */
#define TARGET_SIGINT 2 /* Interrupt (ANSI). */
#define TARGET_SIGQUIT 3 /* Quit (POSIX). */
#define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
#define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
#define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
#define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
#define TARGET_SIGEMT 7
#define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
#define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
#define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
#define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
#define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
#define TARGET_SIGSYS 12
#define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
#define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
#define TARGET_SIGTERM 15 /* Termination (ANSI). */
#define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
#define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
#define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
#define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
#define TARGET_SIGPWR 19 /* Power failure restart (System V). */
#define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
#define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
#define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
#define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
#define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
#define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
#define TARGET_SIGCONT 25 /* Continue (POSIX). */
#define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
#define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
#define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
#define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
#define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
#define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
#define TARGET_SIGRTMIN 32
#define TARGET_SIG_BLOCK 1 /* for blocking signals */
#define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
#define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
abi_ulong ss_sp;
abi_ulong ss_size;
abi_int ss_flags;
} target_stack_t;
/*
* sigaltstack controls
*/
#define TARGET_SS_ONSTACK 1
#define TARGET_SS_DISABLE 2
#define TARGET_SA_NOCLDSTOP 0x00000001
#define TARGET_SA_NOCLDWAIT 0x00010000
#define TARGET_SA_SIGINFO 0x00000008
#define TARGET_SA_ONSTACK 0x08000000
#define TARGET_SA_NODEFER 0x40000000
#define TARGET_SA_RESTART 0x10000000
#define TARGET_SA_RESETHAND 0x80000000
#define TARGET_MINSIGSTKSZ 2048
#if defined(TARGET_ABI_MIPSO32)
/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif
#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
/* bit-flags */
#define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */
/* mask for all SS_xxx flags */
#define TARGET_SS_FLAG_BITS TARGET_SS_AUTODISARM
#endif /* MIPS_TARGET_SIGNAL_H */
+64
View File
@@ -0,0 +1,64 @@
/*
* MIPS specific structures for linux-user
*
* Copyright (c) 2013 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIPS_TARGET_STRUCTS_H
#define MIPS_TARGET_STRUCTS_H
struct target_ipc_perm {
abi_int __key; /* Key. */
abi_uint uid; /* Owner's user ID. */
abi_uint gid; /* Owner's group ID. */
abi_uint cuid; /* Creator's user ID. */
abi_uint cgid; /* Creator's group ID. */
abi_uint mode; /* Read/write permission. */
abi_ushort __seq; /* Sequence number. */
abi_ushort __pad1;
abi_ulong __unused1;
abi_ulong __unused2;
};
struct target_shmid_ds {
struct target_ipc_perm shm_perm; /* operation permission struct */
abi_long shm_segsz; /* size of segment in bytes */
abi_ulong shm_atime; /* time of last shmat() */
abi_ulong shm_dtime; /* time of last shmdt() */
abi_ulong shm_ctime; /* time of last change by shmctl() */
abi_int shm_cpid; /* pid of creator */
abi_int shm_lpid; /* pid of last shmop */
abi_ulong shm_nattch; /* number of current attaches */
abi_ulong __unused1;
abi_ulong __unused2;
};
#define TARGET_SEMID64_DS
/*
* The semid64_ds structure for the MIPS architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*/
struct target_semid64_ds {
struct target_ipc_perm sem_perm;
abi_ulong sem_otime;
abi_ulong sem_ctime;
abi_ulong sem_nsems;
abi_ulong __unused1;
abi_ulong __unused2;
};
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef MIPS_TARGET_SYSCALL_H
#define MIPS_TARGET_SYSCALL_H
#define UNAME_MACHINE "mips"
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_CLONE_BACKWARDS
#define TARGET_MCL_CURRENT 1
#define TARGET_MCL_FUTURE 2
#define TARGET_MCL_ONFAULT 4
#define TARGET_FORCE_SHMLBA
#define TARGET_SYSMIPS_FLUSH_CACHE 3
#define TARGET_SYSMIPS_FIXADE 7
#define TARGET_SYSMIPS_ATOMIC_SET 2001
static inline abi_ulong target_shmlba(CPUMIPSState *env)
{
return 0x40000;
}
#endif /* MIPS_TARGET_SYSCALL_H */
+293
View File
@@ -0,0 +1,293 @@
/* from asm/termbits.h */
#ifndef LINUX_USER_MIPS_TERMBITS_H
#define LINUX_USER_MIPS_TERMBITS_H
#define TARGET_NCCS 23
typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */
struct target_termios {
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};
struct target_termios2 {
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
target_speed_t c_ispeed; /* input speed */
target_speed_t c_ospeed; /* output speed */
};
struct target_ktermios {
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
target_speed_t c_ispeed; /* input speed */
target_speed_t c_ospeed; /* output speed */
};
/* c_iflag bits */
#define TARGET_IGNBRK 0000001
#define TARGET_BRKINT 0000002
#define TARGET_IGNPAR 0000004
#define TARGET_PARMRK 0000010
#define TARGET_INPCK 0000020
#define TARGET_ISTRIP 0000040
#define TARGET_INLCR 0000100
#define TARGET_IGNCR 0000200
#define TARGET_ICRNL 0000400
#define TARGET_IUCLC 0001000
#define TARGET_IXON 0002000
#define TARGET_IXANY 0004000
#define TARGET_IXOFF 0010000
#define TARGET_IMAXBEL 0020000
#define TARGET_IUTF8 0040000
/* c_oflag bits */
#define TARGET_OPOST 0000001
#define TARGET_OLCUC 0000002
#define TARGET_ONLCR 0000004
#define TARGET_OCRNL 0000010
#define TARGET_ONOCR 0000020
#define TARGET_ONLRET 0000040
#define TARGET_OFILL 0000100
#define TARGET_OFDEL 0000200
#define TARGET_NLDLY 0000400
#define TARGET_NL0 0000000
#define TARGET_NL1 0000400
#define TARGET_CRDLY 0003000
#define TARGET_CR0 0000000
#define TARGET_CR1 0001000
#define TARGET_CR2 0002000
#define TARGET_CR3 0003000
#define TARGET_TABDLY 0014000
#define TARGET_TAB0 0000000
#define TARGET_TAB1 0004000
#define TARGET_TAB2 0010000
#define TARGET_TAB3 0014000
#define TARGET_XTABS 0014000
#define TARGET_BSDLY 0020000
#define TARGET_BS0 0000000
#define TARGET_BS1 0020000
#define TARGET_VTDLY 0040000
#define TARGET_VT0 0000000
#define TARGET_VT1 0040000
#define TARGET_FFDLY 0100000
#define TARGET_FF0 0000000
#define TARGET_FF1 0100000
/* c_cflag bit meaning */
#define TARGET_CBAUD 0010017
#define TARGET_B0 0000000 /* hang up */
#define TARGET_B50 0000001
#define TARGET_B75 0000002
#define TARGET_B110 0000003
#define TARGET_B134 0000004
#define TARGET_B150 0000005
#define TARGET_B200 0000006
#define TARGET_B300 0000007
#define TARGET_B600 0000010
#define TARGET_B1200 0000011
#define TARGET_B1800 0000012
#define TARGET_B2400 0000013
#define TARGET_B4800 0000014
#define TARGET_B9600 0000015
#define TARGET_B19200 0000016
#define TARGET_B38400 0000017
#define TARGET_EXTA B19200
#define TARGET_EXTB B38400
#define TARGET_CSIZE 0000060
#define TARGET_CS5 0000000
#define TARGET_CS6 0000020
#define TARGET_CS7 0000040
#define TARGET_CS8 0000060
#define TARGET_CSTOPB 0000100
#define TARGET_CREAD 0000200
#define TARGET_PARENB 0000400
#define TARGET_PARODD 0001000
#define TARGET_HUPCL 0002000
#define TARGET_CLOCAL 0004000
#define TARGET_CBAUDEX 0010000
#define TARGET_BOTHER 0010000
#define TARGET_B57600 0010001
#define TARGET_B115200 0010002
#define TARGET_B230400 0010003
#define TARGET_B460800 0010004
#define TARGET_B500000 0010005
#define TARGET_B576000 0010006
#define TARGET_B921600 0010007
#define TARGET_B1000000 0010010
#define TARGET_B1152000 0010011
#define TARGET_B1500000 0010012
#define TARGET_B2000000 0010013
#define TARGET_B2500000 0010014
#define TARGET_B3000000 0010015
#define TARGET_B3500000 0010016
#define TARGET_B4000000 0010017
#define TARGET_CIBAUD 002003600000 /* input baud rate */
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
#define TARGET_CRTSCTS 020000000000 /* flow control */
#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
/* c_lflag bits */
#define TARGET_ISIG 0000001
#define TARGET_ICANON 0000002
#define TARGET_XCASE 0000004
#define TARGET_ECHO 0000010
#define TARGET_ECHOE 0000020
#define TARGET_ECHOK 0000040
#define TARGET_ECHONL 0000100
#define TARGET_NOFLSH 0000200
#define TARGET_IEXTEN 0000400
#define TARGET_ECHOCTL 0001000
#define TARGET_ECHOPRT 0002000
#define TARGET_ECHOKE 0004000
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_TOSTOP 0100000
#define TARGET_ITOSTOP TARGET_TOSTOP
#define TARGET_EXTPROC 0200000
/* c_cc character offsets */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
#define TARGET_VERASE 2
#define TARGET_VKILL 3
#define TARGET_VMIN 4
#define TARGET_VTIME 5
#define TARGET_VEOL2 6
#define TARGET_VSWTC 7
#define TARGET_VSTART 8
#define TARGET_VSTOP 9
#define TARGET_VSUSP 10
/* VDSUSP not supported */
#define TARGET_VREPRINT 12
#define TARGET_VDISCARD 13
#define TARGET_VWERASE 14
#define TARGET_VLNEXT 15
#define TARGET_VEOF 16
#define TARGET_VEOL 17
/* ioctls */
#define TARGET_TCGETA 0x5401
#define TARGET_TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
#define TARGET_TCSETAW 0x5403
#define TARGET_TCSETAF 0x5404
#define TARGET_TCSBRK 0x5405
#define TARGET_TCXONC 0x5406
#define TARGET_TCFLSH 0x5407
#define TARGET_TCGETS 0x540d
#define TARGET_TCSETS 0x540e
#define TARGET_TCSETSW 0x540f
#define TARGET_TCSETSF 0x5410
#define TARGET_TIOCEXCL 0x740d /* set exclusive use of tty */
#define TARGET_TIOCNXCL 0x740e /* reset exclusive use of tty */
#define TARGET_TIOCOUTQ 0x7472 /* output queue size */
#define TARGET_TIOCSTI 0x5472 /* simulate terminal input */
#define TARGET_TIOCMGET 0x741d /* get all modem bits */
#define TARGET_TIOCMBIS 0x741b /* bis modem bits */
#define TARGET_TIOCMBIC 0x741c /* bic modem bits */
#define TARGET_TIOCMSET 0x741a /* set all modem bits */
#define TARGET_TIOCPKT 0x5470 /* pty: set/clear packet mode */
#define TARGET_TIOCPKT_DATA 0x00 /* data packet */
#define TARGET_TIOCPKT_FLUSHREAD 0x01 /* flush packet */
#define TARGET_TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
#define TARGET_TIOCPKT_STOP 0x04 /* stop output */
#define TARGET_TIOCPKT_START 0x08 /* start output */
#define TARGET_TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
#define TARGET_TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
/* #define TIOCPKT_IOCTL 0x40 state change of pty driver */
#define TARGET_TIOCSWINSZ TARGET_IOW('t', 103, struct winsize) /* set window size */
#define TARGET_TIOCGWINSZ TARGET_IOR('t', 104, struct winsize) /* get window size */
#define TARGET_TIOCNOTTY 0x5471 /* void tty association */
#define TARGET_TIOCSETD 0x7401
#define TARGET_TIOCGETD 0x7400
#define TARGET_FIOCLEX 0x6601
#define TARGET_FIONCLEX 0x6602
#define TARGET_FIOASYNC 0x667d
#define TARGET_FIONBIO 0x667e
#define TARGET_FIOQSIZE 0x667f
#define TARGET_TIOCGLTC 0x7474 /* get special local chars */
#define TARGET_TIOCSLTC 0x7475 /* set special local chars */
#define TARGET_TIOCSPGRP TARGET_IOW('t', 118, int) /* set pgrp of tty */
#define TARGET_TIOCGPGRP TARGET_IOR('t', 119, int) /* get pgrp of tty */
#define TARGET_TIOCCONS TARGET_IOW('t', 120, int) /* become virtual console */
#define TARGET_FIONREAD 0x467f
#define TARGET_TIOCINQ TARGET_FIONREAD
#define TARGET_TIOCGETP 0x7408
#define TARGET_TIOCSETP 0x7409
#define TARGET_TIOCSETN 0x740a /* TIOCSETP wo flush */
/* #define TARGET_TIOCSETA TARGET_IOW('t', 20, struct termios) set termios struct */
/* #define TARGET_TIOCSETAW TARGET_IOW('t', 21, struct termios) drain output, set */
/* #define TARGET_TIOCSETAF TARGET_IOW('t', 22, struct termios) drn out, fls in, set */
/* #define TARGET_TIOCGETD TARGET_IOR('t', 26, int) get line discipline */
/* #define TARGET_TIOCSETD TARGET_IOW('t', 27, int) set line discipline */
/* 127-124 compat */
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
#define TARGET_TIOCGSID 0x7416 /* Return the session ID of FD */
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2)
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2)
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2)
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
#define TARGET_TIOCGDEV TARGET_IOR('T', 0x32, unsigned int)
#define TARGET_TIOCSIG TARGET_IOW('T', 0x36, int)
#define TARGET_TIOCVHANGUP 0x5437
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
/* I hope the range from 0x5480 on is free ... */
#define TARGET_TIOCSCTTY 0x5480 /* become controlling tty */
#define TARGET_TIOCGSOFTCAR 0x5481
#define TARGET_TIOCSSOFTCAR 0x5482
#define TARGET_TIOCLINUX 0x5483
#define TARGET_TIOCGSERIAL 0x5484
#define TARGET_TIOCSSERIAL 0x5485
#define TARGET_TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
#define TARGET_TIOCSERCONFIG 0x5488
#define TARGET_TIOCSERGWILD 0x5489
#define TARGET_TIOCSERSWILD 0x548a
#define TARGET_TIOCGLCKTRMIOS 0x548b
#define TARGET_TIOCSLCKTRMIOS 0x548c
#define TARGET_TIOCSERGSTRUCT 0x548d /* For debugging only */
#define TARGET_TIOCSERGETLSR 0x548e /* Get line status register */
#define TARGET_TIOCSERGETMULTI 0x548f /* Get multiport config */
#define TARGET_TIOCSERSETMULTI 0x5490 /* Set multiport config */
#define TARGET_TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
#define TARGET_TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
#define TARGET_TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
#define TARGET_TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
#endif