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

+260
View File
@@ -0,0 +1,260 @@
/*
* 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"
static void xtensa_rfw(CPUXtensaState *env)
{
xtensa_restore_owb(env);
env->pc = env->sregs[EPC1];
}
static void xtensa_rfwu(CPUXtensaState *env)
{
env->sregs[WINDOW_START] |= (1 << env->sregs[WINDOW_BASE]);
xtensa_rfw(env);
}
static void xtensa_rfwo(CPUXtensaState *env)
{
env->sregs[WINDOW_START] &= ~(1 << env->sregs[WINDOW_BASE]);
xtensa_rfw(env);
}
static void xtensa_overflow4(CPUXtensaState *env)
{
put_user_ual(env->regs[0], env->regs[5] - 16);
put_user_ual(env->regs[1], env->regs[5] - 12);
put_user_ual(env->regs[2], env->regs[5] - 8);
put_user_ual(env->regs[3], env->regs[5] - 4);
xtensa_rfwo(env);
}
static void xtensa_underflow4(CPUXtensaState *env)
{
get_user_ual(env->regs[0], env->regs[5] - 16);
get_user_ual(env->regs[1], env->regs[5] - 12);
get_user_ual(env->regs[2], env->regs[5] - 8);
get_user_ual(env->regs[3], env->regs[5] - 4);
xtensa_rfwu(env);
}
static void xtensa_overflow8(CPUXtensaState *env)
{
put_user_ual(env->regs[0], env->regs[9] - 16);
get_user_ual(env->regs[0], env->regs[1] - 12);
put_user_ual(env->regs[1], env->regs[9] - 12);
put_user_ual(env->regs[2], env->regs[9] - 8);
put_user_ual(env->regs[3], env->regs[9] - 4);
put_user_ual(env->regs[4], env->regs[0] - 32);
put_user_ual(env->regs[5], env->regs[0] - 28);
put_user_ual(env->regs[6], env->regs[0] - 24);
put_user_ual(env->regs[7], env->regs[0] - 20);
xtensa_rfwo(env);
}
static void xtensa_underflow8(CPUXtensaState *env)
{
get_user_ual(env->regs[0], env->regs[9] - 16);
get_user_ual(env->regs[1], env->regs[9] - 12);
get_user_ual(env->regs[2], env->regs[9] - 8);
get_user_ual(env->regs[7], env->regs[1] - 12);
get_user_ual(env->regs[3], env->regs[9] - 4);
get_user_ual(env->regs[4], env->regs[7] - 32);
get_user_ual(env->regs[5], env->regs[7] - 28);
get_user_ual(env->regs[6], env->regs[7] - 24);
get_user_ual(env->regs[7], env->regs[7] - 20);
xtensa_rfwu(env);
}
static void xtensa_overflow12(CPUXtensaState *env)
{
put_user_ual(env->regs[0], env->regs[13] - 16);
get_user_ual(env->regs[0], env->regs[1] - 12);
put_user_ual(env->regs[1], env->regs[13] - 12);
put_user_ual(env->regs[2], env->regs[13] - 8);
put_user_ual(env->regs[3], env->regs[13] - 4);
put_user_ual(env->regs[4], env->regs[0] - 48);
put_user_ual(env->regs[5], env->regs[0] - 44);
put_user_ual(env->regs[6], env->regs[0] - 40);
put_user_ual(env->regs[7], env->regs[0] - 36);
put_user_ual(env->regs[8], env->regs[0] - 32);
put_user_ual(env->regs[9], env->regs[0] - 28);
put_user_ual(env->regs[10], env->regs[0] - 24);
put_user_ual(env->regs[11], env->regs[0] - 20);
xtensa_rfwo(env);
}
static void xtensa_underflow12(CPUXtensaState *env)
{
get_user_ual(env->regs[0], env->regs[13] - 16);
get_user_ual(env->regs[1], env->regs[13] - 12);
get_user_ual(env->regs[2], env->regs[13] - 8);
get_user_ual(env->regs[11], env->regs[1] - 12);
get_user_ual(env->regs[3], env->regs[13] - 4);
get_user_ual(env->regs[4], env->regs[11] - 48);
get_user_ual(env->regs[5], env->regs[11] - 44);
get_user_ual(env->regs[6], env->regs[11] - 40);
get_user_ual(env->regs[7], env->regs[11] - 36);
get_user_ual(env->regs[8], env->regs[11] - 32);
get_user_ual(env->regs[9], env->regs[11] - 28);
get_user_ual(env->regs[10], env->regs[11] - 24);
get_user_ual(env->regs[11], env->regs[11] - 20);
xtensa_rfwu(env);
}
void cpu_loop(CPUXtensaState *env)
{
CPUState *cs = env_cpu(env);
abi_ulong ret;
int trapnr;
while (1) {
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
qemu_process_cpu_events(cs);
env->sregs[PS] &= ~PS_EXCM;
switch (trapnr) {
case EXCP_INTERRUPT:
break;
case EXC_WINDOW_OVERFLOW4:
xtensa_overflow4(env);
break;
case EXC_WINDOW_UNDERFLOW4:
xtensa_underflow4(env);
break;
case EXC_WINDOW_OVERFLOW8:
xtensa_overflow8(env);
break;
case EXC_WINDOW_UNDERFLOW8:
xtensa_underflow8(env);
break;
case EXC_WINDOW_OVERFLOW12:
xtensa_overflow12(env);
break;
case EXC_WINDOW_UNDERFLOW12:
xtensa_underflow12(env);
break;
case EXC_USER:
switch (env->sregs[EXCCAUSE]) {
case ILLEGAL_INSTRUCTION_CAUSE:
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC,
env->sregs[EPC1]);
break;
case PRIVILEGED_CAUSE:
force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC,
env->sregs[EPC1]);
break;
case SYSCALL_CAUSE:
env->pc += 3;
ret = do_syscall(env, env->regs[2],
env->regs[6], env->regs[3],
env->regs[4], env->regs[5],
env->regs[8], env->regs[9], 0, 0);
switch (ret) {
default:
env->regs[2] = ret;
break;
case -QEMU_ERESTARTSYS:
env->pc -= 3;
break;
case -QEMU_ESIGRETURN:
case -QEMU_ESETPC:
break;
}
break;
case ALLOCA_CAUSE:
env->sregs[PS] = deposit32(env->sregs[PS],
PS_OWB_SHIFT,
PS_OWB_LEN,
env->sregs[WINDOW_BASE]);
switch (env->regs[0] & 0xc0000000) {
case 0x00000000:
case 0x40000000:
xtensa_rotate_window(env, -1);
xtensa_underflow4(env);
break;
case 0x80000000:
xtensa_rotate_window(env, -2);
xtensa_underflow8(env);
break;
case 0xc0000000:
xtensa_rotate_window(env, -3);
xtensa_underflow12(env);
break;
}
break;
case INTEGER_DIVIDE_BY_ZERO_CAUSE:
force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV,
env->sregs[EPC1]);
break;
default:
fprintf(stderr, "exccause = %d\n", env->sregs[EXCCAUSE]);
g_assert_not_reached();
}
break;
case EXCP_DEBUG:
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT,
env->sregs[EPC1]);
break;
case EXC_DEBUG:
default:
fprintf(stderr, "trapnr = %d\n", trapnr);
g_assert_not_reached();
}
process_pending_signals(env);
}
}
void init_main_thread(CPUState *cs, struct image_info *info)
{
CPUArchState *env = cpu_env(cs);
env->sregs[WINDOW_BASE] = 0;
env->sregs[WINDOW_START] = 1;
env->regs[1] = info->start_stack;
env->pc = info->entry;
if (info_is_fdpic(info)) {
env->regs[4] = info->loadmap_addr;
env->regs[5] = info->interpreter_loadmap_addr;
if (info->interpreter_loadmap_addr) {
env->regs[6] = info->interpreter_pt_dynamic_addr;
} else {
env->regs[6] = info->pt_dynamic_addr;
}
}
}
+31
View File
@@ -0,0 +1,31 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "qemu/osdep.h"
#include "qemu.h"
#include "loader.h"
#include "target_elf.h"
const char *get_elf_cpu_model(uint32_t eflags)
{
return XTENSA_DEFAULT_CPU_MODEL;
}
void elf_core_copy_regs(target_elf_gregset_t *r, const CPUXtensaState *env)
{
r->pt.pc = tswap32(env->pc);
r->pt.ps = tswap32(env->sregs[PS] & ~PS_EXCM);
r->pt.lbeg = tswap32(env->sregs[LBEG]);
r->pt.lend = tswap32(env->sregs[LEND]);
r->pt.lcount = tswap32(env->sregs[LCOUNT]);
r->pt.sar = tswap32(env->sregs[SAR]);
r->pt.windowstart = tswap32(env->sregs[WINDOW_START]);
r->pt.windowbase = tswap32(env->sregs[WINDOW_BASE]);
r->pt.threadptr = tswap32(env->uregs[THREADPTR]);
xtensa_sync_phys_from_window((CPUXtensaState *)env);
for (unsigned i = 0; i < env->config->nareg; ++i) {
r->pt.a[i] = tswap32(env->phys_regs[i]);
}
}
+5
View File
@@ -0,0 +1,5 @@
syscall_nr_generators += {
'xtensa': generator(sh,
arguments: [ meson.current_source_dir() / 'syscallhdr.sh', '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@' ],
output: '@BASENAME@_nr.h')
}
+386
View File
@@ -0,0 +1,386 @@
/*
* 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"
#include "target/xtensa/cpu.h"
struct target_sigcontext {
abi_ulong sc_pc;
abi_ulong sc_ps;
abi_ulong sc_lbeg;
abi_ulong sc_lend;
abi_ulong sc_lcount;
abi_ulong sc_sar;
abi_ulong sc_acclo;
abi_ulong sc_acchi;
abi_ulong sc_a[16];
abi_ulong sc_xtregs;
};
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_xtensa_xtregs_fp {
uint32_t f[16];
uint32_t fcr;
uint32_t fsr;
};
struct target_xtensa_xtregs_dfp {
uint64_t f[16];
uint32_t fcr;
uint32_t fsr;
};
struct target_rt_sigframe {
target_siginfo_t info;
struct target_ucontext uc;
union {
struct target_xtensa_xtregs_fp fp;
struct target_xtensa_xtregs_dfp dfp;
} xtregs;
uint8_t retcode[6];
abi_ulong window[4];
};
static abi_ulong get_sigframe(struct target_sigaction *sa,
CPUXtensaState *env,
unsigned long framesize)
{
abi_ulong sp;
sp = target_sigsp(get_sp_from_cpustate(env), sa);
return (sp - framesize) & -16;
}
static int flush_window_regs(CPUXtensaState *env)
{
uint32_t wb = env->sregs[WINDOW_BASE];
uint32_t ws = xtensa_replicate_windowstart(env) >> (wb + 1);
unsigned d = ctz32(ws) + 1;
unsigned i;
int ret = 0;
for (i = d; i < env->config->nareg / 4; i += d) {
uint32_t ssp, osp;
unsigned j;
ws >>= d;
xtensa_rotate_window(env, d);
if (ws & 0x1) {
ssp = env->regs[5];
d = 1;
} else if (ws & 0x2) {
ssp = env->regs[9];
ret |= get_user_ual(osp, env->regs[1] - 12);
osp -= 32;
d = 2;
} else if (ws & 0x4) {
ssp = env->regs[13];
ret |= get_user_ual(osp, env->regs[1] - 12);
osp -= 48;
d = 3;
} else {
g_assert_not_reached();
}
for (j = 0; j < 4; ++j) {
ret |= put_user_ual(env->regs[j], ssp - 16 + j * 4);
}
for (j = 4; j < d * 4; ++j) {
ret |= put_user_ual(env->regs[j], osp - 16 + j * 4);
}
}
xtensa_rotate_window(env, d);
g_assert(env->sregs[WINDOW_BASE] == wb);
return ret == 0;
}
static int setup_sigcontext(struct target_rt_sigframe *frame,
abi_ulong frame_addr,
CPUXtensaState *env)
{
struct target_sigcontext *sc = &frame->uc.tuc_mcontext;
int i;
__put_user(env->pc, &sc->sc_pc);
__put_user(env->sregs[PS], &sc->sc_ps);
__put_user(env->sregs[LBEG], &sc->sc_lbeg);
__put_user(env->sregs[LEND], &sc->sc_lend);
__put_user(env->sregs[LCOUNT], &sc->sc_lcount);
if (!flush_window_regs(env)) {
return 0;
}
for (i = 0; i < 16; ++i) {
__put_user(env->regs[i], sc->sc_a + i);
}
if (xtensa_option_enabled(env->config, XTENSA_OPTION_DFP_COPROCESSOR)) {
for (i = 0; i < 16; ++i) {
__put_user(env->fregs[i].f64, &frame->xtregs.dfp.f[i]);
}
__put_user(env->uregs[FCR], &frame->xtregs.dfp.fcr);
__put_user(cpu_get_fsr(env), &frame->xtregs.dfp.fsr);
__put_user(frame_addr + offsetof(struct target_rt_sigframe, xtregs),
&sc->sc_xtregs);
} else if (xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) {
for (i = 0; i < 16; ++i) {
__put_user(env->fregs[i].f32[FP_F32_LOW], &frame->xtregs.fp.f[i]);
}
__put_user(env->uregs[FCR], &frame->xtregs.fp.fcr);
__put_user(cpu_get_fsr(env), &frame->xtregs.fp.fsr);
__put_user(frame_addr + offsetof(struct target_rt_sigframe, xtregs),
&sc->sc_xtregs);
} else {
__put_user(0, &sc->sc_xtregs);
}
return 1;
}
static void install_sigtramp(uint8_t *tramp)
{
#if TARGET_BIG_ENDIAN
/* Generate instruction: MOVI a2, __NR_rt_sigreturn */
__put_user(0x22, &tramp[0]);
__put_user(0x0a, &tramp[1]);
__put_user(TARGET_NR_rt_sigreturn, &tramp[2]);
/* Generate instruction: SYSCALL */
__put_user(0x00, &tramp[3]);
__put_user(0x05, &tramp[4]);
__put_user(0x00, &tramp[5]);
#else
/* Generate instruction: MOVI a2, __NR_rt_sigreturn */
__put_user(0x22, &tramp[0]);
__put_user(0xa0, &tramp[1]);
__put_user(TARGET_NR_rt_sigreturn, &tramp[2]);
/* Generate instruction: SYSCALL */
__put_user(0x00, &tramp[3]);
__put_user(0x50, &tramp[4]);
__put_user(0x00, &tramp[5]);
#endif
}
void setup_rt_frame(int sig, struct target_sigaction *ka,
target_siginfo_t *info,
target_sigset_t *set, CPUXtensaState *env)
{
abi_ulong frame_addr;
struct target_rt_sigframe *frame;
int is_fdpic = info_is_fdpic(get_task_state(thread_cpu)->info);
abi_ulong handler = 0;
abi_ulong handler_fdpic_GOT = 0;
uint32_t ra;
bool abi_call0;
unsigned base;
int i;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
if (is_fdpic) {
abi_ulong funcdesc_ptr = ka->_sa_handler;
if (get_user_ual(handler, funcdesc_ptr)
|| get_user_ual(handler_fdpic_GOT, funcdesc_ptr + 4)) {
goto give_sigsegv;
}
} else {
handler = ka->_sa_handler;
}
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
goto give_sigsegv;
}
if (ka->sa_flags & SA_SIGINFO) {
frame->info = *info;
}
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
target_save_altstack(&frame->uc.tuc_stack, env);
if (!setup_sigcontext(frame, frame_addr, env)) {
unlock_user_struct(frame, frame_addr, 0);
goto give_sigsegv;
}
for (i = 0; i < TARGET_NSIG_WORDS; ++i) {
__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
}
if (ka->sa_flags & TARGET_SA_RESTORER) {
if (is_fdpic) {
if (get_user_ual(ra, ka->sa_restorer)) {
unlock_user_struct(frame, frame_addr, 0);
goto give_sigsegv;
}
} else {
ra = ka->sa_restorer;
}
} else {
/* Not used, but retain for ABI compatibility. */
install_sigtramp(frame->retcode);
ra = default_rt_sigreturn;
}
memset(env->regs, 0, sizeof(env->regs));
env->pc = handler;
env->regs[1] = frame_addr;
env->sregs[WINDOW_BASE] = 0;
env->sregs[WINDOW_START] = 1;
abi_call0 = (env->sregs[PS] & PS_WOE) == 0;
env->sregs[PS] = PS_UM | (3 << PS_RING_SHIFT);
if (abi_call0) {
base = 0;
env->regs[base] = ra;
} else {
env->sregs[PS] |= PS_WOE | (1 << PS_CALLINC_SHIFT);
base = 4;
env->regs[base] = (ra & 0x3fffffff) | 0x40000000;
}
env->regs[base + 2] = sig;
env->regs[base + 3] = frame_addr + offsetof(struct target_rt_sigframe,
info);
env->regs[base + 4] = frame_addr + offsetof(struct target_rt_sigframe, uc);
if (is_fdpic) {
env->regs[base + 11] = handler_fdpic_GOT;
}
unlock_user_struct(frame, frame_addr, 1);
return;
give_sigsegv:
force_sigsegv(sig);
}
static int restore_sigcontext(CPUXtensaState *env,
struct target_rt_sigframe *frame)
{
struct target_sigcontext *sc = &frame->uc.tuc_mcontext;
uint32_t ps;
int i;
__get_user(env->pc, &sc->sc_pc);
__get_user(ps, &sc->sc_ps);
__get_user(env->sregs[LBEG], &sc->sc_lbeg);
__get_user(env->sregs[LEND], &sc->sc_lend);
__get_user(env->sregs[LCOUNT], &sc->sc_lcount);
env->sregs[WINDOW_BASE] = 0;
env->sregs[WINDOW_START] = 1;
env->sregs[PS] = deposit32(env->sregs[PS],
PS_CALLINC_SHIFT,
PS_CALLINC_LEN,
extract32(ps, PS_CALLINC_SHIFT,
PS_CALLINC_LEN));
for (i = 0; i < 16; ++i) {
__get_user(env->regs[i], sc->sc_a + i);
}
{
abi_ulong xtregs_addr;
__get_user(xtregs_addr, &sc->sc_xtregs);
if (xtregs_addr) {
if (xtensa_option_enabled(env->config,
XTENSA_OPTION_DFP_COPROCESSOR)) {
struct target_xtensa_xtregs_dfp *xtregs;
uint32_t fcr, fsr;
xtregs = lock_user(VERIFY_READ, xtregs_addr,
sizeof(*xtregs), 1);
if (!xtregs) {
return 0;
}
for (i = 0; i < 16; ++i) {
__get_user(env->fregs[i].f64, &xtregs->f[i]);
}
__get_user(fcr, &xtregs->fcr);
__get_user(fsr, &xtregs->fsr);
unlock_user(xtregs, xtregs_addr, 0);
cpu_set_fcr(env, fcr);
cpu_set_fsr(env, fsr);
} else if (xtensa_option_enabled(env->config,
XTENSA_OPTION_FP_COPROCESSOR)) {
struct target_xtensa_xtregs_fp *xtregs;
uint32_t fcr, fsr;
xtregs = lock_user(VERIFY_READ, xtregs_addr,
sizeof(*xtregs), 1);
if (!xtregs) {
return 0;
}
for (i = 0; i < 16; ++i) {
__get_user(env->fregs[i].f32[FP_F32_LOW], &xtregs->f[i]);
}
__get_user(fcr, &xtregs->fcr);
__get_user(fsr, &xtregs->fsr);
unlock_user(xtregs, xtregs_addr, 0);
cpu_set_fcr(env, fcr);
cpu_set_fsr(env, fsr);
}
}
}
return 1;
}
long do_rt_sigreturn(CPUXtensaState *env)
{
abi_ulong frame_addr = env->regs[1];
struct target_rt_sigframe *frame;
sigset_t set;
trace_user_do_rt_sigreturn(env, frame_addr);
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
force_sig(TARGET_SIGSEGV);
return -QEMU_ESIGRETURN;
}
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
set_sigmask(&set);
if (!restore_sigcontext(env, frame)) {
goto badframe;
}
target_restore_altstack(&frame->uc.tuc_stack, env);
unlock_user_struct(frame, frame_addr, 0);
return -QEMU_ESIGRETURN;
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV);
return -QEMU_ESIGRETURN;
}
void setup_sigtramp(abi_ulong sigtramp_page)
{
uint8_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 6, 0);
assert(tramp != NULL);
default_rt_sigreturn = sigtramp_page;
install_sigtramp(tramp);
unlock_user(tramp, sigtramp_page, 6);
}
+1
View File
@@ -0,0 +1 @@
#include "../generic/sockbits.h"
+435
View File
@@ -0,0 +1,435 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
#
# system call numbers and entry vectors for xtensa
#
# The format is:
# <number> <abi> <name> <entry point>
#
# The <abi> is always "common" for this file
#
0 common spill sys_ni_syscall
1 common xtensa sys_ni_syscall
2 common available4 sys_ni_syscall
3 common available5 sys_ni_syscall
4 common available6 sys_ni_syscall
5 common available7 sys_ni_syscall
6 common available8 sys_ni_syscall
7 common available9 sys_ni_syscall
# File Operations
8 common open sys_open
9 common close sys_close
10 common dup sys_dup
11 common dup2 sys_dup2
12 common read sys_read
13 common write sys_write
14 common select sys_select
15 common lseek sys_lseek
16 common poll sys_poll
17 common _llseek sys_llseek
18 common epoll_wait sys_epoll_wait
19 common epoll_ctl sys_epoll_ctl
20 common epoll_create sys_epoll_create
21 common creat sys_creat
22 common truncate sys_truncate
23 common ftruncate sys_ftruncate
24 common readv sys_readv
25 common writev sys_writev
26 common fsync sys_fsync
27 common fdatasync sys_fdatasync
28 common truncate64 sys_truncate64
29 common ftruncate64 sys_ftruncate64
30 common pread64 sys_pread64
31 common pwrite64 sys_pwrite64
32 common link sys_link
33 common rename sys_rename
34 common symlink sys_symlink
35 common readlink sys_readlink
36 common mknod sys_mknod
37 common pipe sys_pipe
38 common unlink sys_unlink
39 common rmdir sys_rmdir
40 common mkdir sys_mkdir
41 common chdir sys_chdir
42 common fchdir sys_fchdir
43 common getcwd sys_getcwd
44 common chmod sys_chmod
45 common chown sys_chown
46 common stat sys_newstat
47 common stat64 sys_stat64
48 common lchown sys_lchown
49 common lstat sys_newlstat
50 common lstat64 sys_lstat64
51 common available51 sys_ni_syscall
52 common fchmod sys_fchmod
53 common fchown sys_fchown
54 common fstat sys_newfstat
55 common fstat64 sys_fstat64
56 common flock sys_flock
57 common access sys_access
58 common umask sys_umask
59 common getdents sys_getdents
60 common getdents64 sys_getdents64
61 common fcntl64 sys_fcntl64
62 common fallocate sys_fallocate
63 common fadvise64_64 xtensa_fadvise64_64
64 common utime sys_utime32
65 common utimes sys_utimes_time32
66 common ioctl sys_ioctl
67 common fcntl sys_fcntl
68 common setxattr sys_setxattr
69 common getxattr sys_getxattr
70 common listxattr sys_listxattr
71 common removexattr sys_removexattr
72 common lsetxattr sys_lsetxattr
73 common lgetxattr sys_lgetxattr
74 common llistxattr sys_llistxattr
75 common lremovexattr sys_lremovexattr
76 common fsetxattr sys_fsetxattr
77 common fgetxattr sys_fgetxattr
78 common flistxattr sys_flistxattr
79 common fremovexattr sys_fremovexattr
# File Map / Shared Memory Operations
80 common mmap2 sys_mmap_pgoff
81 common munmap sys_munmap
82 common mprotect sys_mprotect
83 common brk sys_brk
84 common mlock sys_mlock
85 common munlock sys_munlock
86 common mlockall sys_mlockall
87 common munlockall sys_munlockall
88 common mremap sys_mremap
89 common msync sys_msync
90 common mincore sys_mincore
91 common madvise sys_madvise
92 common shmget sys_shmget
93 common shmat xtensa_shmat
94 common shmctl sys_old_shmctl
95 common shmdt sys_shmdt
# Socket Operations
96 common socket sys_socket
97 common setsockopt sys_setsockopt
98 common getsockopt sys_getsockopt
99 common shutdown sys_shutdown
100 common bind sys_bind
101 common connect sys_connect
102 common listen sys_listen
103 common accept sys_accept
104 common getsockname sys_getsockname
105 common getpeername sys_getpeername
106 common sendmsg sys_sendmsg
107 common recvmsg sys_recvmsg
108 common send sys_send
109 common recv sys_recv
110 common sendto sys_sendto
111 common recvfrom sys_recvfrom
112 common socketpair sys_socketpair
113 common sendfile sys_sendfile
114 common sendfile64 sys_sendfile64
115 common sendmmsg sys_sendmmsg
# Process Operations
116 common clone sys_clone
117 common execve sys_execve
118 common exit sys_exit
119 common exit_group sys_exit_group
120 common getpid sys_getpid
121 common wait4 sys_wait4
122 common waitid sys_waitid
123 common kill sys_kill
124 common tkill sys_tkill
125 common tgkill sys_tgkill
126 common set_tid_address sys_set_tid_address
127 common gettid sys_gettid
128 common setsid sys_setsid
129 common getsid sys_getsid
130 common prctl sys_prctl
131 common personality sys_personality
132 common getpriority sys_getpriority
133 common setpriority sys_setpriority
134 common setitimer sys_setitimer
135 common getitimer sys_getitimer
136 common setuid sys_setuid
137 common getuid sys_getuid
138 common setgid sys_setgid
139 common getgid sys_getgid
140 common geteuid sys_geteuid
141 common getegid sys_getegid
142 common setreuid sys_setreuid
143 common setregid sys_setregid
144 common setresuid sys_setresuid
145 common getresuid sys_getresuid
146 common setresgid sys_setresgid
147 common getresgid sys_getresgid
148 common setpgid sys_setpgid
149 common getpgid sys_getpgid
150 common getppid sys_getppid
151 common getpgrp sys_getpgrp
# 152 was set_thread_area
152 common reserved152 sys_ni_syscall
# 153 was get_thread_area
153 common reserved153 sys_ni_syscall
154 common times sys_times
155 common acct sys_acct
156 common sched_setaffinity sys_sched_setaffinity
157 common sched_getaffinity sys_sched_getaffinity
158 common capget sys_capget
159 common capset sys_capset
160 common ptrace sys_ptrace
161 common semtimedop sys_semtimedop_time32
162 common semget sys_semget
163 common semop sys_semop
164 common semctl sys_old_semctl
165 common available165 sys_ni_syscall
166 common msgget sys_msgget
167 common msgsnd sys_msgsnd
168 common msgrcv sys_msgrcv
169 common msgctl sys_old_msgctl
170 common available170 sys_ni_syscall
# File System
171 common umount2 sys_umount
172 common mount sys_mount
173 common swapon sys_swapon
174 common chroot sys_chroot
175 common pivot_root sys_pivot_root
176 common umount sys_oldumount
177 common swapoff sys_swapoff
178 common sync sys_sync
179 common syncfs sys_syncfs
180 common setfsuid sys_setfsuid
181 common setfsgid sys_setfsgid
182 common sysfs sys_sysfs
183 common ustat sys_ustat
184 common statfs sys_statfs
185 common fstatfs sys_fstatfs
186 common statfs64 sys_statfs64
187 common fstatfs64 sys_fstatfs64
# System
188 common setrlimit sys_setrlimit
189 common getrlimit sys_getrlimit
190 common getrusage sys_getrusage
191 common futex sys_futex_time32
192 common gettimeofday sys_gettimeofday
193 common settimeofday sys_settimeofday
194 common adjtimex sys_adjtimex_time32
195 common nanosleep sys_nanosleep_time32
196 common getgroups sys_getgroups
197 common setgroups sys_setgroups
198 common sethostname sys_sethostname
199 common setdomainname sys_setdomainname
200 common syslog sys_syslog
201 common vhangup sys_vhangup
202 common uselib sys_uselib
203 common reboot sys_reboot
204 common quotactl sys_quotactl
# 205 was old nfsservctl
205 common nfsservctl sys_ni_syscall
206 common _sysctl sys_ni_syscall
207 common bdflush sys_ni_syscall
208 common uname sys_newuname
209 common sysinfo sys_sysinfo
210 common init_module sys_init_module
211 common delete_module sys_delete_module
212 common sched_setparam sys_sched_setparam
213 common sched_getparam sys_sched_getparam
214 common sched_setscheduler sys_sched_setscheduler
215 common sched_getscheduler sys_sched_getscheduler
216 common sched_get_priority_max sys_sched_get_priority_max
217 common sched_get_priority_min sys_sched_get_priority_min
218 common sched_rr_get_interval sys_sched_rr_get_interval_time32
219 common sched_yield sys_sched_yield
222 common available222 sys_ni_syscall
# Signal Handling
223 common restart_syscall sys_restart_syscall
224 common sigaltstack sys_sigaltstack
225 common rt_sigreturn xtensa_rt_sigreturn
226 common rt_sigaction sys_rt_sigaction
227 common rt_sigprocmask sys_rt_sigprocmask
228 common rt_sigpending sys_rt_sigpending
229 common rt_sigtimedwait sys_rt_sigtimedwait_time32
230 common rt_sigqueueinfo sys_rt_sigqueueinfo
231 common rt_sigsuspend sys_rt_sigsuspend
# Message
232 common mq_open sys_mq_open
233 common mq_unlink sys_mq_unlink
234 common mq_timedsend sys_mq_timedsend_time32
235 common mq_timedreceive sys_mq_timedreceive_time32
236 common mq_notify sys_mq_notify
237 common mq_getsetattr sys_mq_getsetattr
238 common available238 sys_ni_syscall
239 common io_setup sys_io_setup
# IO
240 common io_destroy sys_io_destroy
241 common io_submit sys_io_submit
242 common io_getevents sys_io_getevents_time32
243 common io_cancel sys_io_cancel
244 common clock_settime sys_clock_settime32
245 common clock_gettime sys_clock_gettime32
246 common clock_getres sys_clock_getres_time32
247 common clock_nanosleep sys_clock_nanosleep_time32
# Timer
248 common timer_create sys_timer_create
249 common timer_delete sys_timer_delete
250 common timer_settime sys_timer_settime32
251 common timer_gettime sys_timer_gettime32
252 common timer_getoverrun sys_timer_getoverrun
# System
253 common reserved253 sys_ni_syscall
254 common lookup_dcookie sys_ni_syscall
255 common available255 sys_ni_syscall
256 common add_key sys_add_key
257 common request_key sys_request_key
258 common keyctl sys_keyctl
259 common available259 sys_ni_syscall
260 common readahead sys_readahead
261 common remap_file_pages sys_remap_file_pages
262 common migrate_pages sys_migrate_pages
263 common mbind sys_mbind
264 common get_mempolicy sys_get_mempolicy
265 common set_mempolicy sys_set_mempolicy
266 common unshare sys_unshare
267 common move_pages sys_move_pages
268 common splice sys_splice
269 common tee sys_tee
270 common vmsplice sys_vmsplice
271 common available271 sys_ni_syscall
272 common pselect6 sys_pselect6_time32
273 common ppoll sys_ppoll_time32
274 common epoll_pwait sys_epoll_pwait
275 common epoll_create1 sys_epoll_create1
276 common inotify_init sys_inotify_init
277 common inotify_add_watch sys_inotify_add_watch
278 common inotify_rm_watch sys_inotify_rm_watch
279 common inotify_init1 sys_inotify_init1
280 common getcpu sys_getcpu
281 common kexec_load sys_ni_syscall
282 common ioprio_set sys_ioprio_set
283 common ioprio_get sys_ioprio_get
284 common set_robust_list sys_set_robust_list
285 common get_robust_list sys_get_robust_list
286 common available286 sys_ni_syscall
287 common available287 sys_ni_syscall
# Relative File Operations
288 common openat sys_openat
289 common mkdirat sys_mkdirat
290 common mknodat sys_mknodat
291 common unlinkat sys_unlinkat
292 common renameat sys_renameat
293 common linkat sys_linkat
294 common symlinkat sys_symlinkat
295 common readlinkat sys_readlinkat
296 common utimensat sys_utimensat_time32
297 common fchownat sys_fchownat
298 common futimesat sys_futimesat_time32
299 common fstatat64 sys_fstatat64
300 common fchmodat sys_fchmodat
301 common faccessat sys_faccessat
302 common available302 sys_ni_syscall
303 common available303 sys_ni_syscall
304 common signalfd sys_signalfd
# 305 was timerfd
306 common eventfd sys_eventfd
307 common recvmmsg sys_recvmmsg_time32
308 common setns sys_setns
309 common signalfd4 sys_signalfd4
310 common dup3 sys_dup3
311 common pipe2 sys_pipe2
312 common timerfd_create sys_timerfd_create
313 common timerfd_settime sys_timerfd_settime32
314 common timerfd_gettime sys_timerfd_gettime32
315 common available315 sys_ni_syscall
316 common eventfd2 sys_eventfd2
317 common preadv sys_preadv
318 common pwritev sys_pwritev
319 common available319 sys_ni_syscall
320 common fanotify_init sys_fanotify_init
321 common fanotify_mark sys_fanotify_mark
322 common process_vm_readv sys_process_vm_readv
323 common process_vm_writev sys_process_vm_writev
324 common name_to_handle_at sys_name_to_handle_at
325 common open_by_handle_at sys_open_by_handle_at
326 common sync_file_range2 sys_sync_file_range2
327 common perf_event_open sys_perf_event_open
328 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo
329 common clock_adjtime sys_clock_adjtime32
330 common prlimit64 sys_prlimit64
331 common kcmp sys_kcmp
332 common finit_module sys_finit_module
333 common accept4 sys_accept4
334 common sched_setattr sys_sched_setattr
335 common sched_getattr sys_sched_getattr
336 common renameat2 sys_renameat2
337 common seccomp sys_seccomp
338 common getrandom sys_getrandom
339 common memfd_create sys_memfd_create
340 common bpf sys_bpf
341 common execveat sys_execveat
342 common userfaultfd sys_userfaultfd
343 common membarrier sys_membarrier
344 common mlock2 sys_mlock2
345 common copy_file_range sys_copy_file_range
346 common preadv2 sys_preadv2
347 common pwritev2 sys_pwritev2
348 common pkey_mprotect sys_pkey_mprotect
349 common pkey_alloc sys_pkey_alloc
350 common pkey_free sys_pkey_free
351 common statx sys_statx
352 common rseq sys_rseq
# 353 through 402 are unassigned to sync up with generic numbers
403 common clock_gettime64 sys_clock_gettime
404 common clock_settime64 sys_clock_settime
405 common clock_adjtime64 sys_clock_adjtime
406 common clock_getres_time64 sys_clock_getres
407 common clock_nanosleep_time64 sys_clock_nanosleep
408 common timer_gettime64 sys_timer_gettime
409 common timer_settime64 sys_timer_settime
410 common timerfd_gettime64 sys_timerfd_gettime
411 common timerfd_settime64 sys_timerfd_settime
412 common utimensat_time64 sys_utimensat
413 common pselect6_time64 sys_pselect6
414 common ppoll_time64 sys_ppoll
416 common io_pgetevents_time64 sys_io_pgetevents
417 common recvmmsg_time64 sys_recvmmsg
418 common mq_timedsend_time64 sys_mq_timedsend
419 common mq_timedreceive_time64 sys_mq_timedreceive
420 common semtimedop_time64 sys_semtimedop
421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait
422 common futex_time64 sys_futex
423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval
424 common pidfd_send_signal sys_pidfd_send_signal
425 common io_uring_setup sys_io_uring_setup
426 common io_uring_enter sys_io_uring_enter
427 common io_uring_register sys_io_uring_register
428 common open_tree sys_open_tree
429 common move_mount sys_move_mount
430 common fsopen sys_fsopen
431 common fsconfig sys_fsconfig
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 common clone3 sys_clone3
436 common close_range sys_close_range
437 common openat2 sys_openat2
438 common pidfd_getfd sys_pidfd_getfd
439 common faccessat2 sys_faccessat2
440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr
443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self
# 447 reserved for memfd_secret
448 common process_mrelease sys_process_mrelease
449 common futex_waitv sys_futex_waitv
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
451 common cachestat sys_cachestat
452 common fchmodat2 sys_fchmodat2
453 common map_shadow_stack sys_map_shadow_stack
454 common futex_wake sys_futex_wake
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common statmount sys_statmount
458 common listmount sys_listmount
459 common lsm_get_self_attr sys_lsm_get_self_attr
460 common lsm_set_self_attr sys_lsm_set_self_attr
461 common lsm_list_modules sys_lsm_list_modules
462 common mseal sys_mseal
+32
View File
@@ -0,0 +1,32 @@
#!/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_XTENSA_`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 ; do
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}"
) > "$out"
+32
View File
@@ -0,0 +1,32 @@
/*
* Xtensa-specific CPU ABI and functions for linux-user
*/
#ifndef XTENSA_TARGET_CPU_H
#define XTENSA_TARGET_CPU_H
static inline void cpu_clone_regs_child(CPUXtensaState *env,
target_ulong newsp,
unsigned flags)
{
if (newsp) {
env->regs[1] = newsp;
env->sregs[WINDOW_BASE] = 0;
env->sregs[WINDOW_START] = 0x1;
}
env->regs[2] = 0;
}
static inline void cpu_clone_regs_parent(CPUXtensaState *env, unsigned flags)
{
}
static inline void cpu_set_tls(CPUXtensaState *env, target_ulong newtls)
{
env->uregs[THREADPTR] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUXtensaState *state)
{
return state->regs[1];
}
#endif
+26
View File
@@ -0,0 +1,26 @@
/*
* 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 XTENSA_TARGET_ELF_H
#define XTENSA_TARGET_ELF_H
#include "target_ptrace.h"
#define ELF_CLASS ELFCLASS32
#define ELF_MACHINE EM_XTENSA
#define HAVE_ELF_CORE_DUMP 1
/*
* See linux kernel: arch/xtensa/include/asm/elf.h, where elf_gregset_t
* is mapped to struct user_pt_regs via typedef and sizeof.
*/
typedef struct target_elf_gregset_t {
struct target_user_pt_regs pt;
} target_elf_gregset_t;
#endif
+7
View File
@@ -0,0 +1,7 @@
#ifndef XTENSA_TARGET_ERRNO_DEFS_H
#define XTENSA_TARGET_ERRNO_DEFS_H
/* Target uses generic errno */
#include "../generic/target_errno_defs.h"
#endif
+11
View File
@@ -0,0 +1,11 @@
/*
* 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 XTENSA_TARGET_FCNTL_H
#define XTENSA_TARGET_FCNTL_H
#include "../generic/fcntl.h"
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef LINUX_USER_XTENSA_TARGET_FLAT_H
#define LINUX_USER_XTENSA_TARGET_FLAT_H
#define flat_argvp_envp_on_stack() 0
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
#define flat_old_ram_flag(flag) (flag)
#define flat_get_relocate_addr(relval) (relval)
#define flat_get_addr_from_rp(rp, relval, flags, persistent) (rp)
#define flat_set_persistent(relval, persistent) (*persistent)
#define flat_put_addr_at_rp(rp, addr, relval) put_user_ual(addr, rp)
#endif
+29
View File
@@ -0,0 +1,29 @@
#ifndef XTENSA_TARGET_MMAN_H
#define XTENSA_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/xtensa/include/asm/processor.h:
* TASK_UNMAPPED_BASE (TASK_SIZE / 2)
*/
#define TASK_UNMAPPED_BASE (1u << (TARGET_VIRT_ADDR_SPACE_BITS - 1))
/* arch/xtensa/include/asm/elf.h */
#define ELF_ET_DYN_BASE \
TARGET_PAGE_ALIGN((1u << TARGET_VIRT_ADDR_SPACE_BITS) / 3)
#include "../generic/target_mman.h"
#endif
+1
View File
@@ -0,0 +1 @@
/* No special prctl support required. */
+1
View File
@@ -0,0 +1 @@
/* No target-specific /proc support */
+22
View File
@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef XTENSA_TARGET_PTRACE_H
#define XTENSA_TARGET_PTRACE_H
/* See arch/xtensa/include/uapi/asm/ptrace.h. */
struct target_user_pt_regs {
uint32_t pc;
uint32_t ps;
uint32_t lbeg;
uint32_t lend;
uint32_t lcount;
uint32_t sar;
uint32_t windowstart;
uint32_t windowbase;
uint32_t threadptr;
uint32_t syscall;
uint32_t reserved[6 + 48];
uint32_t a[64];
};
#endif /* XTENSA_TARGET_PTRACE_H */
+1
View File
@@ -0,0 +1 @@
#include "../generic/target_resource.h"
+10
View File
@@ -0,0 +1,10 @@
#ifndef XTENSA_TARGET_SIGNAL_H
#define XTENSA_TARGET_SIGNAL_H
#include "../generic/signal.h"
#define TARGET_SA_RESTORER 0x04000000
#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
#endif
+51
View File
@@ -0,0 +1,51 @@
#ifndef XTENSA_TARGET_STRUCTS_H
#define XTENSA_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_ulong __seq; /* Sequence number. */
abi_ulong __unused1;
abi_ulong __unused2;
};
struct target_semid64_ds {
struct target_ipc_perm sem_perm;
#if TARGET_BIG_ENDIAN
abi_ulong __unused1;
abi_ulong sem_otime;
abi_ulong __unused2;
abi_ulong sem_ctime;
#else
abi_ulong sem_otime;
abi_ulong __unused1;
abi_ulong sem_ctime;
abi_ulong __unused2;
#endif
abi_ulong sem_nsems;
abi_ulong __unused3;
abi_ulong __unused4;
};
#define TARGET_SEMID64_DS
struct target_shmid_ds {
struct target_ipc_perm shm_perm; /* operation permission struct */
abi_long shm_segsz; /* size of segment in bytes */
abi_long shm_atime; /* time of last shmat() */
abi_ulong __unused1;
abi_long shm_dtime; /* time of last shmdt() */
abi_ulong __unused2;
abi_long shm_ctime; /* time of last change by shmctl() */
abi_ulong __unused3;
abi_uint shm_cpid; /* pid of creator */
abi_uint shm_lpid; /* pid of last shmop */
abi_ulong shm_nattch; /* number of current attaches */
abi_ulong __unused4;
abi_ulong __unused5;
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef XTENSA_TARGET_SYSCALL_H
#define XTENSA_TARGET_SYSCALL_H
#define UNAME_MACHINE "xtensa"
#define UNAME_MINIMUM_RELEASE "3.19"
#define TARGET_CLONE_BACKWARDS
#define MMAP_SHIFT TARGET_PAGE_BITS
#define TARGET_MCL_CURRENT 1
#define TARGET_MCL_FUTURE 2
#define TARGET_MCL_ONFAULT 4
#endif
+331
View File
@@ -0,0 +1,331 @@
/*
* include/asm-xtensa/termbits.h
*
* Copied from SH.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 - 2005 Tensilica Inc.
*/
#ifndef XTENSA_TERMBITS_H
#define XTENSA_TERMBITS_H
#include <linux/posix_types.h>
#define TARGET_NCCS 19
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_cc characters */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
#define TARGET_VERASE 2
#define TARGET_VKILL 3
#define TARGET_VEOF 4
#define TARGET_VTIME 5
#define TARGET_VMIN 6
#define TARGET_VSWTC 7
#define TARGET_VSTART 8
#define TARGET_VSTOP 9
#define TARGET_VSUSP 10
#define TARGET_VEOL 11
#define TARGET_VREPRINT 12
#define TARGET_VDISCARD 13
#define TARGET_VWERASE 14
#define TARGET_VLNEXT 15
#define TARGET_VEOL2 16
/* 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_TOSTOP 0000400
#define TARGET_ECHOCTL 0001000
#define TARGET_ECHOPRT 0002000
#define TARGET_ECHOKE 0004000
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_IEXTEN 0100000
#define TARGET_EXTPROC 0200000
/* tcflow() and TCXONC use these */
#define TARGET_TCOOFF 0
#define TARGET_TCOON 1
#define TARGET_TCIOFF 2
#define TARGET_TCION 3
/* tcflush() and TCFLSH use these */
#define TARGET_TCIFLUSH 0
#define TARGET_TCOFLUSH 1
#define TARGET_TCIOFLUSH 2
/* tcsetattr uses these */
#define TARGET_TCSANOW 0
#define TARGET_TCSADRAIN 1
#define TARGET_TCSAFLUSH 2
/* from arch/xtensa/include/uapi/asm/ioctls.h */
#define TARGET_FIOCLEX _IO('f', 1)
#define TARGET_FIONCLEX _IO('f', 2)
#define TARGET_FIOASYNC _IOW('f', 125, int)
#define TARGET_FIONBIO _IOW('f', 126, int)
#define TARGET_FIONREAD _IOR('f', 127, int)
#define TARGET_TIOCINQ FIONREAD
#define TARGET_FIOQSIZE _IOR('f', 128, loff_t)
#define TARGET_TCGETS 0x5401
#define TARGET_TCSETS 0x5402
#define TARGET_TCSETSW 0x5403
#define TARGET_TCSETSF 0x5404
#define TARGET_TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
#define TARGET_TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
#define TARGET_TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
#define TARGET_TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
#define TARGET_TCSBRK _IO('t', 29)
#define TARGET_TCXONC _IO('t', 30)
#define TARGET_TCFLSH _IO('t', 31)
#define TARGET_TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
#define TARGET_TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
#define TARGET_TIOCSTART _IO('t', 110) /* start output, like ^Q */
#define TARGET_TIOCSTOP _IO('t', 111) /* stop output, like ^S */
#define TARGET_TIOCOUTQ _IOR('t', 115, int) /* output queue size */
#define TARGET_TIOCSPGRP _IOW('t', 118, int)
#define TARGET_TIOCGPGRP _IOR('t', 119, int)
#define TARGET_TIOCEXCL _IO('T', 12)
#define TARGET_TIOCNXCL _IO('T', 13)
#define TARGET_TIOCSCTTY _IO('T', 14)
#define TARGET_TIOCSTI _IOW('T', 18, char)
#define TARGET_TIOCMGET _IOR('T', 21, unsigned int)
#define TARGET_TIOCMBIS _IOW('T', 22, unsigned int)
#define TARGET_TIOCMBIC _IOW('T', 23, unsigned int)
#define TARGET_TIOCMSET _IOW('T', 24, unsigned int)
# define TARGET_TIOCM_LE 0x001
# define TARGET_TIOCM_DTR 0x002
# define TARGET_TIOCM_RTS 0x004
# define TARGET_TIOCM_ST 0x008
# define TARGET_TIOCM_SR 0x010
# define TARGET_TIOCM_CTS 0x020
# define TARGET_TIOCM_CAR 0x040
# define TARGET_TIOCM_RNG 0x080
# define TARGET_TIOCM_DSR 0x100
# define TARGET_TIOCM_CD TIOCM_CAR
# define TARGET_TIOCM_RI TIOCM_RNG
#define TARGET_TIOCGSOFTCAR _IOR('T', 25, unsigned int)
#define TARGET_TIOCSSOFTCAR _IOW('T', 26, unsigned int)
#define TARGET_TIOCLINUX _IOW('T', 28, char)
#define TARGET_TIOCCONS _IO('T', 29)
#define TARGET_TIOCGSERIAL 0x803C541E /*_IOR('T', 30, struct serial_struct)*/
#define TARGET_TIOCSSERIAL 0x403C541F /*_IOW('T', 31, struct serial_struct)*/
#define TARGET_TIOCPKT _IOW('T', 32, int)
# define TARGET_TIOCPKT_DATA 0
# define TARGET_TIOCPKT_FLUSHREAD 1
# define TARGET_TIOCPKT_FLUSHWRITE 2
# define TARGET_TIOCPKT_STOP 4
# define TARGET_TIOCPKT_START 8
# define TARGET_TIOCPKT_NOSTOP 16
# define TARGET_TIOCPKT_DOSTOP 32
# define TARGET_TIOCPKT_IOCTL 64
#define TARGET_TIOCNOTTY _IO('T', 34)
#define TARGET_TIOCSETD _IOW('T', 35, int)
#define TARGET_TIOCGETD _IOR('T', 36, int)
#define TARGET_TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/
#define TARGET_TIOCSBRK _IO('T', 39) /* BSD compatibility */
#define TARGET_TIOCCBRK _IO('T', 40) /* BSD compatibility */
#define TARGET_TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/
#define TARGET_TCGETS2 _IOR('T', 42, struct termios2)
#define TARGET_TCSETS2 _IOW('T', 43, struct termios2)
#define TARGET_TCSETSW2 _IOW('T', 44, struct termios2)
#define TARGET_TCSETSF2 _IOW('T', 45, struct termios2)
#define TARGET_TIOCGRS485 _IOR('T', 46, struct serial_rs485)
#define TARGET_TIOCSRS485 _IOWR('T', 47, struct serial_rs485)
#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TARGET_TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TARGET_TIOCVHANGUP _IO('T', 0x37)
#define TARGET_TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
#define TARGET_TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
#define TARGET_TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
#define TARGET_TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
#define TARGET_TIOCSERCONFIG _IO('T', 83)
#define TARGET_TIOCSERGWILD _IOR('T', 84, int)
#define TARGET_TIOCSERSWILD _IOW('T', 85, int)
#define TARGET_TIOCGLCKTRMIOS 0x5456
#define TARGET_TIOCSLCKTRMIOS 0x5457
#define TARGET_TIOCSERGSTRUCT 0x5458 /* For debugging only */
#define TARGET_TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
# define TARGET_TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#define TARGET_TIOCSERGETMULTI 0x80a8545a /* Get multiport config */
/* _IOR('T', 90, struct serial_multiport_struct) */
#define TARGET_TIOCSERSETMULTI 0x40a8545b /* Set multiport config */
/* _IOW('T', 91, struct serial_multiport_struct) */
#define TARGET_TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
#define TARGET_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
#endif /* XTENSA_TERMBITS_H */