e2k: Add e2k32 linux user files.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
This commit is contained in:
Denis Drakhnia 2021-02-19 12:46:34 +02:00 committed by Denis Drakhnia
parent e440ebc3db
commit d3e84e57e5
14 changed files with 130 additions and 13 deletions

View File

@ -0,0 +1,3 @@
TARGET_ARCH=e2k32
TARGET_BASE_ARCH=e2k
TARGET_ABI32=y

View File

@ -0,0 +1 @@
#include "../e2k/cpu_loop.c"

View File

@ -0,0 +1 @@
#include "../e2k/signal.c"

View File

@ -0,0 +1 @@
#include "../generic/sockbits.h"

View File

@ -0,0 +1 @@
#include "../e2k/syscall_nr.h"

View File

@ -0,0 +1 @@
#include "../e2k/target_cpu.h"

View File

@ -0,0 +1 @@
#include "../e2k/target_elf.h"

View File

@ -0,0 +1,4 @@
#ifndef E2K32_TARGET_FCNTL_H
#define E2K32_TARGET_FCNTL_H
#include "../generic/fcntl.h"
#endif

View File

@ -0,0 +1,26 @@
#ifndef E2K32_TARGET_SIGNAL_H
#define E2K32_TARGET_SIGNAL_H
/*
* sigaltstack controls
*/
#define TARGET_SS_ONSTACK 1
#define TARGET_SS_DISABLE 2
#define TARGET_MINSIGSTKSZ 4096
#define TARGET_SIGSTKSZ 8192
#define TARGET_MCL_CURRENT 1
#define TARGET_MCL_FUTURE 2
#define TARGET_MCL_ONFAULT 4
#define TARGET_ARCH_HAS_SETUP_FRAME
typedef struct target_sigaltstack {
abi_ulong ss_sp;
abi_int ss_flags;
abi_ulong ss_size;
} target_stack_t;
#include "../generic/signal.h"
#endif /* E2K32_TARGET_SIGNAL_H */

View File

@ -0,0 +1 @@
#include "../e2k/target_structs.h"

View File

@ -0,0 +1 @@
#include "../e2k/target_syscall.h"

View File

@ -0,0 +1,6 @@
#ifndef _E2K_TERMBITS_H_
#define _E2K_TERMBITS_H_
#include "../generic/termbits.h"
#endif /* _E2K_TERMBITS_H_ */

View File

@ -7089,6 +7089,47 @@ static abi_long do_e2k_longjmp2(CPUE2KState *env, struct target_jmp_info *jmp_in
return 0;
}
static abi_long do_e2k_access_hw_stacks(CPUState *cpu, abi_ulong arg2,
abi_ulong arg3, abi_ulong arg4, abi_ulong arg5, abi_ulong arg6)
{
E2KCPU *e2k_cpu = E2K_CPU(cpu);
CPUE2KState *env = &e2k_cpu->env;
int ret = 0;
abi_ulong mode = arg2;
abi_ulong frame_addr = arg3; // __user (abi_ullong *)
// abi_ulong buf_addr = arg4; // __user (char *)
// abi_ulong buf_size = arg5;
abi_ulong size_addr = arg6; // __user (void *)
switch (mode) {
case GET_PROCEDURE_STACK_SIZE:
ret = put_user(env->psp.index, size_addr, target_ulong);
break;
case GET_CHAIN_STACK_SIZE:
ret = put_user(env->pcsp.index, size_addr, target_ulong);
break;
case GET_CHAIN_STACK_OFFSET:
ret = -TARGET_ENOSYS;
break;
case READ_CHAIN_STACK_EX:
{
abi_ullong frame = 0;
copy_user();
break;
}
case READ_CHAIN_STACK:
case READ_PROCEDURE_STACK:
case WRITE_PROCEDURE_STACK:
case READ_PROCEDURE_STACK_EX:
case WRITE_PROCEDURE_STACK_EX:
case WRITE_CHAIN_STACK_EX:
return -TARGET_ENOSYS;
}
return ret;
}
#endif /* end of TARGET_E2K */
static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
@ -11999,24 +12040,16 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
if (ret) {
break;
}
do_e2k_longjmp2(env, &ji);
ret = do_e2k_longjmp2(env, &ji);
if (ret) {
break;
}
return arg2;
}
#endif
#ifdef TARGET_NR_access_hw_stacks
case TARGET_NR_access_hw_stacks:
{
#if 0
abi_ulong mode = arg2;
abi_ulong frame_ptr = arg3; // __user (abi_ullong *)
abi_ulong buf = arg4; // __user (char *)
abi_ulong buf_size = arg5;
abi_ulong real_size = arg6; // __user (void *)
#endif
// TODO: e2k_sys_access_hw_stacks
return -TARGET_ENOSYS;
}
return do_e2k_access_hw_stacks(cpu, arg1, arg2, arg3, arg4, arg5);
#endif
#ifdef CONFIG_ATTR
#ifdef TARGET_NR_setxattr

37
target/e2k/helper-tcg.h Normal file
View File

@ -0,0 +1,37 @@
/*
* e2k TCG specific prototypes for helpers
*
* Copyright (c) 2020-2021 Denis Drakhnya, Alibek Omarov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef E2K_HELPER_TCG_H
#define E2K_HELPER_TCG_H
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/exec-all.h"
/* helper.c */
void G_NORETURN raise_exception(CPUE2KState *env, int exception_index);
void G_NORETURN raise_exception_ra(CPUE2KState *env, int exception_index,
uintptr_t retaddr);
#endif /* E2K_HELPER_TCG_H */