add arm64 support
- add arm64 dependent codes with GICv3 and SVE support - fix bugs based on architecture separation requests
This commit is contained in:
23
executer/user/arch/arm64/Makefile.in
Normal file
23
executer/user/arch/arm64/Makefile.in
Normal file
@ -0,0 +1,23 @@
|
||||
CC=@CC@
|
||||
AR=ar
|
||||
BINDIR=@BINDIR@
|
||||
KDIR ?= @KDIR@
|
||||
CFLAGS=-Wall -O -I.
|
||||
VPATH=@abs_srcdir@
|
||||
TARGET=../../libmcexec.a
|
||||
LIBS=@LIBS@
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
../../libmcexec.a: archdep.o
|
||||
$(AR) cr ../../libmcexec.a archdep.o
|
||||
|
||||
archdep.o: archdep.S
|
||||
$(CC) -c -I${KDIR} $(CFLAGS) $(EXTRA_CFLAGS) -fPIE -pie -pthread $<
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGET) *.o
|
||||
|
||||
.PHONY: all clean install
|
||||
|
||||
install:
|
||||
51
executer/user/arch/arm64/arch-eclair.c
Normal file
51
executer/user/arch/arm64/arch-eclair.c
Normal file
@ -0,0 +1,51 @@
|
||||
/* arch-eclair.c COPYRIGHT FUJITSU LIMITED 2016 */
|
||||
#include <stdio.h>
|
||||
#include <eclair.h>
|
||||
#include <arch-eclair.h>
|
||||
|
||||
int print_kregs(char *rbp, size_t rbp_size, const struct arch_kregs *kregs)
|
||||
{
|
||||
int i, ret, total = 0;
|
||||
const unsigned long *regs[] = {&kregs->x19, &kregs->x20, &kregs->x21,
|
||||
&kregs->x22, &kregs->x23, &kregs->x24,
|
||||
&kregs->x25, &kregs->x26, &kregs->x27,
|
||||
&kregs->x28};
|
||||
|
||||
for (i = 0; i < 18; i++) /* x0-x18 */{
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxxxxxxxxxx");
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(regs)/sizeof(regs[0]); i++) { /* x19-x28 */
|
||||
ret = print_bin(rbp, rbp_size, (void *)regs[i], sizeof(*regs[0]));
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) { /* x29-x30 */
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxxxxxxxxxx");
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
ret += print_bin(rbp, rbp_size, (void *)&kregs->sp, sizeof(kregs->sp));
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
total += ret;
|
||||
|
||||
return total;
|
||||
}
|
||||
126
executer/user/arch/arm64/arch_args.h
Normal file
126
executer/user/arch/arm64/arch_args.h
Normal file
@ -0,0 +1,126 @@
|
||||
/* arch_args.h COPYRIGHT FUJITSU LIMITED 2017 */
|
||||
#ifndef ARCH_ARGS_H
|
||||
#define ARCH_ARGS_H
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
typedef struct user_pt_regs syscall_args;
|
||||
|
||||
static inline int
|
||||
get_syscall_args(int pid, syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
set_syscall_args(int pid, syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_number(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_return(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg1(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg2(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg3(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg4(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg5(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
get_syscall_arg6(syscall_args *args)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_number(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_return(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg1(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg2(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg3(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg4(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg5(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_syscall_arg6(syscall_args *args, unsigned long value)
|
||||
{
|
||||
/* TODO: skeleton for UTI */
|
||||
}
|
||||
#endif /* !ARCH_ARGS_H */
|
||||
16
executer/user/arch/arm64/archdep.S
Normal file
16
executer/user/arch/arm64/archdep.S
Normal file
@ -0,0 +1,16 @@
|
||||
/* archdep.S COPYRIGHT FUJITSU LIMITED 2017 */
|
||||
/* TODO: skeleton for UTI */
|
||||
.global switch_ctx
|
||||
switch_ctx:
|
||||
ret
|
||||
|
||||
/* TODO: skeleton for UTI */
|
||||
.global compare_and_swap
|
||||
compare_and_swap:
|
||||
ret
|
||||
|
||||
/* TODO: skeleton for UTI */
|
||||
.global compare_and_swap_int
|
||||
compare_and_swap_int:
|
||||
ret
|
||||
|
||||
24
executer/user/arch/arm64/include/arch-eclair.h
Normal file
24
executer/user/arch/arm64/include/arch-eclair.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* arch-eclair.h COPYRIGHT FUJITSU LIMITED 2016 */
|
||||
#ifndef HEADER_USER_ARM64_ECLAIR_H
|
||||
#define HEADER_USER_ARM64_ECLAIR_H
|
||||
|
||||
/* VA_BITS=48, 4K_PAGE address */
|
||||
#define MAP_KERNEL 0xffffffffff800000
|
||||
#define MAP_ST 0xffff800000000000
|
||||
#define MAP_KERNEL_TEXT "0xffffffffff800000"
|
||||
|
||||
#define ARCH_CLV_SPAN "arm64_cpu_local_variables_span"
|
||||
|
||||
#define ARCH "aarch64"
|
||||
|
||||
#define ARCH_REGS 34
|
||||
|
||||
#define PANIC_REGS_OFFSET 144
|
||||
|
||||
struct arch_kregs {
|
||||
unsigned long x19, x20, x21, x22, x23;
|
||||
unsigned long x24, x25, x26, x27, x28;
|
||||
unsigned long fp, sp, pc;
|
||||
};
|
||||
|
||||
#endif /* HEADER_USER_ARM64_ECLAIR_H */
|
||||
101
executer/user/arch/x86_64/arch-eclair.c
Normal file
101
executer/user/arch/x86_64/arch-eclair.c
Normal file
@ -0,0 +1,101 @@
|
||||
/* arch-eclair.c COPYRIGHT FUJITSU LIMITED 2016 */
|
||||
#include <eclair.h>
|
||||
#include <stdio.h>
|
||||
#include <arch-eclair.h>
|
||||
|
||||
int print_kregs(char *rbp, size_t rbp_size, const struct arch_kregs *kregs)
|
||||
{
|
||||
int i, ret, total = 0;
|
||||
uintptr_t ihk_mc_switch_context = -1;
|
||||
const uint64_t *regs_1[] = {&kregs->rsi, &kregs->rdi, &kregs->rbp,
|
||||
&kregs->rsp};
|
||||
const uint64_t *regs_2[] = {&kregs->r12, &kregs->r13, &kregs->r14,
|
||||
&kregs->r15};
|
||||
|
||||
ihk_mc_switch_context = lookup_symbol("ihk_mc_switch_context");
|
||||
if (0) printf("ihk_mc_switch_context: %lx\n", ihk_mc_switch_context);
|
||||
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxxxxxxxxxx"); /* rax */
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
|
||||
ret += print_bin(rbp, rbp_size, (void *)&kregs->rbx, sizeof(uint64_t)); /* rbx */
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
|
||||
for (i = 0; i < 2; i++){ /* rcx, rdx */
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxxxxxxxxxx");
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(regs_1)/sizeof(regs_1[0]); i++) { /* rsi, rdi, rbp, rsp */
|
||||
ret = print_bin(rbp, rbp_size, (void *)regs_1[i], sizeof(regs_1[0]));
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) { /* r8-x11 */
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxxxxxxxxxx");
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(regs_2)/sizeof(regs_2[0]); i++) { /* r12-r15 */
|
||||
ret = print_bin(rbp, rbp_size, (void *)regs_2[i], sizeof(regs_2[0]));
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
ret += print_bin(rbp, rbp_size, (void *)&ihk_mc_switch_context, sizeof(uint64_t)); /* rip */
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
|
||||
ret += print_bin(rbp, rbp_size, (void *)&kregs->rflags, sizeof(uint32_t)); /* rflags */
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
|
||||
for (i = 0; i < 6; i++) { /* cs, ss, ds, es, fs, gs */
|
||||
ret = snprintf(rbp, rbp_size, "xxxxxxxx");
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
rbp += ret;
|
||||
total += ret;
|
||||
rbp_size -= ret;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
@ -1,6 +1,10 @@
|
||||
#ifndef ARCH_ARGS_H
|
||||
#define ARCH_ARGS_H
|
||||
|
||||
#ifdef POSTK_DEBUG_ARCH_DEP_77 /* arch depend hide */
|
||||
#include <asm/prctl.h>
|
||||
#endif /* !POSTK_DEBUG_ARCH_DEP_77 */
|
||||
|
||||
typedef struct user_regs_struct syscall_args;
|
||||
|
||||
static inline int
|
||||
|
||||
24
executer/user/arch/x86_64/include/arch-eclair.h
Normal file
24
executer/user/arch/x86_64/include/arch-eclair.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* arch-eclair.h COPYRIGHT FUJITSU LIMITED 2016 */
|
||||
#ifndef HEADER_USER_X86_ECLAIR_H
|
||||
#define HEADER_USER_X86_ECLAIR_H
|
||||
|
||||
#define MAP_KERNEL 0xFFFFFFFF80000000
|
||||
#define MAP_ST 0xFFFF800000000000
|
||||
|
||||
#define ARCH_CLV_SPAN "x86_cpu_local_variables_span"
|
||||
|
||||
#define ARCH "i386:x86-64"
|
||||
|
||||
#define ARCH_REGS 21
|
||||
|
||||
#define PANIC_REGS_OFFSET 240
|
||||
|
||||
#define MAP_KERNEL_TEXT "0xffffffff80001000"
|
||||
|
||||
struct arch_kregs {
|
||||
uintptr_t rsp, rbp, rbx, rsi;
|
||||
uintptr_t rdi, r12, r13, r14;
|
||||
uintptr_t r15, rflags, rsp0;
|
||||
};
|
||||
|
||||
#endif /* HEADER_USER_x86_ECLAIR_H */
|
||||
Reference in New Issue
Block a user