add arm64 support

- add arm64 dependent codes with GICv3 and SVE support
- fix bugs based on architecture separation requests
This commit is contained in:
Takayuki Okamoto
2017-09-05 15:06:27 +09:00
parent 704096b139
commit 9989f41fd3
192 changed files with 26941 additions and 34 deletions

View File

@@ -1,3 +1,4 @@
/* auxvec.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
#ifndef _LINUX_AUXVEC_H
#define _LINUX_AUXVEC_H

119
kernel/include/elfcore.h Normal file
View File

@@ -0,0 +1,119 @@
/* elfcore.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
#ifdef POSTK_DEBUG_ARCH_DEP_18 /* coredump arch separation. */
#ifndef __HEADER_ELFCORE_H
#define __HEADER_ELFCORE_H
/*
* Structures and definitions for ELF core file.
* Extracted from
* System V Application Binary Interface - DRAFT - 10 June 2013,
* http://www.sco.com/developers/gabi/latest/contents.html
*/
#include <ihk/types.h>
typedef uint16_t Elf64_Half;
typedef uint32_t Elf64_Word;
typedef uint64_t Elf64_Xword;
typedef uint64_t Elf64_Addr;
typedef uint64_t Elf64_Off;
#define EI_NIDENT 16
typedef struct {
unsigned char e_ident[EI_NIDENT];
Elf64_Half e_type;
Elf64_Half e_machine;
Elf64_Word e_version;
Elf64_Addr e_entry;
Elf64_Off e_phoff;
Elf64_Off e_shoff;
Elf64_Word e_flags;
Elf64_Half e_ehsize;
Elf64_Half e_phentsize;
Elf64_Half e_phnum;
Elf64_Half e_shentsize;
Elf64_Half e_shnum;
Elf64_Half e_shstrndx;
} Elf64_Ehdr;
/* e_ident table defined. */
/* offset */
#define EI_MAG0 0
#define EI_MAG1 1
#define EI_MAG2 2
#define EI_MAG3 3
#define EI_CLASS 4
#define EI_DATA 5
#define EI_VERSION 6
#define EI_OSABI 7
#define EI_ABIVERSION 8
#define EI_PAD 9
/* EI_MAG */
#define ELFMAG0 0x7f
#define ELFMAG1 'E'
#define ELFMAG2 'L'
#define ELFMAG3 'F'
/* EI_CLASS */
#define ELFCLASS64 2 /* 64-bit object */
/* EI_DATA */
#define ELFDATA2LSB 1 /* LSB */
#define ELFDATA2MSB 2 /* MSB */
/* EI_VERSION */
#define El_VERSION 1 /* defined to be the same as EV CURRENT */
#define EV_CURRENT 1 /* Current version */
/* EI_OSABI */
#define ELFOSABI_NONE 0 /* unspecied */
/* EI_ABIVERSION */
#define El_ABIVERSION_NONE 0 /* unspecied */
/* e_type defined */
#define ET_CORE 4 /* Core file */
typedef struct {
Elf64_Word p_type;
Elf64_Word p_flags;
Elf64_Off p_offset;
Elf64_Addr p_vaddr;
Elf64_Addr p_paddr;
Elf64_Xword p_filesz;
Elf64_Xword p_memsz;
Elf64_Xword p_align;
} Elf64_Phdr;
#define PT_LOAD 1
#define PT_NOTE 4
#define PF_X 1 /* executable bit */
#define PF_W 2 /* writable bit */
#define PF_R 4 /* readable bit */
struct note {
Elf64_Word namesz;
Elf64_Word descsz;
Elf64_Word type;
/* name char[namesz] and desc[descsz] */
};
#define NT_PRSTATUS 1
#ifdef POSTK_DEBUG_ARCH_DEP_18 /* coredump arch separation. */
#define NT_PRFPREG 2
#else /* POSTK_DEBUG_ARCH_DEP_18 */
#define NT_PRFRPREG 2
#endif /* POSTK_DEBUG_ARCH_DEP_18 */
#define NT_PRPSINFO 3
#define NT_AUXV 6
#include "elfcoregpl.h"
/* functions */
struct thread;
extern void arch_fill_prstatus(struct elf_prstatus64 *prstatus, struct thread *thread, void *regs0);
#endif /* __HEADER_ELFCORE_H */
#endif /* POSTK_DEBUG_ARCH_DEP_18 */

View File

@@ -0,0 +1,67 @@
/* elfcoregpl.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
#ifdef POSTK_DEBUG_ARCH_DEP_18 /* coredump arch separation. */
#ifndef __HEADER_ELFCOREGPL_H
#define __HEADER_ELFCOREGPL_H
#include <ihk/types.h>
/* From /usr/include/linux/elfcore.h of Linux */
#define ELF_PRARGSZ (80)
/* From /usr/include/linux/elfcore.h fro Linux */
struct elf_siginfo
{
int si_signo;
int si_code;
int si_errno;
};
/* From bfd/hosts/x86-64linux.h of gdb. */
typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t;
typedef a8_uint64_t elf_greg64_t;
#include <elf.h>
struct prstatus64_timeval
{
a8_uint64_t tv_sec;
a8_uint64_t tv_usec;
};
struct elf_prstatus64
{
struct elf_siginfo pr_info;
short int pr_cursig;
a8_uint64_t pr_sigpend;
a8_uint64_t pr_sighold;
pid_t pr_pid;
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
struct prstatus64_timeval pr_utime;
struct prstatus64_timeval pr_stime;
struct prstatus64_timeval pr_cutime;
struct prstatus64_timeval pr_cstime;
elf_gregset64_t pr_reg;
int pr_fpvalid;
};
struct elf_prpsinfo64
{
char pr_state;
char pr_sname;
char pr_zomb;
char pr_nice;
a8_uint64_t pr_flag;
unsigned int pr_uid;
unsigned int pr_gid;
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
char pr_fname[16];
char pr_psargs[ELF_PRARGSZ];
};
#endif /* __HEADER_ELFCOREGPL_H */
#endif /* POSTK_DEBUG_ARCH_DEP_18 */

View File

@@ -1,3 +1,4 @@
/* futex.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
/**
* \file futex.h
* Licence details are found in the file LICENSE.
@@ -116,6 +117,8 @@
#include <arch/system.h>
#endif
#ifdef POSTK_DEBUG_ARCH_DEP_8 /* arch depend hide */
#else
static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
{
int op = (encoded_op >> 28) & 7;
@@ -180,6 +183,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
return ret;
}
#endif /* arch depend hide */
#endif // __KERNEL__
#endif // _ASM_X86_FUTEX_H

View File

@@ -38,6 +38,17 @@ extern void __chk_io_ptr(void __iomem *);
#ifdef __KERNEL__
#ifdef POSTK_DEBUG_ARCH_DEP_72
#if __GNUC__ > 5
#error no compiler-gcc.h file for this gcc version
#elif __GNUC__ == 5
# include <lwk/compiler-gcc4.h>
#elif __GNUC__ == 4
# include <lwk/compiler-gcc4.h>
#else
# error Sorry, your compiler is too old/not recognized.
#endif
#else /* POSTK_DEBUG_ARCH_DEP_72 */
#if __GNUC__ > 4
#error no compiler-gcc.h file for this gcc version
#elif __GNUC__ == 4
@@ -45,6 +56,7 @@ extern void __chk_io_ptr(void __iomem *);
#else
# error Sorry, your compiler is too old/not recognized.
#endif
#endif /* POSTK_DEBUG_ARCH_DEP_72 */
/*
* Generic compiler-dependent macros required for kernel

View File

@@ -1,3 +1,4 @@
/* memobj.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
/**
* \file memobj.h
* License details are found in the file LICENSE.
@@ -19,6 +20,8 @@
#include <errno.h>
#include <list.h>
#ifdef POSTK_DEBUG_ARCH_DEP_18 /* coredump arch separation. */
#else /* POSTK_DEBUG_ARCH_DEP_18 */
/* begin types.h */
typedef int32_t key_t;
typedef uint32_t uid_t;
@@ -26,6 +29,7 @@ typedef uint32_t gid_t;
typedef int64_t time_t;
typedef int32_t pid_t;
/* end types.h */
#endif /* POSTK_DEBUG_ARCH_DEP_18 */
enum {
/* for memobj.flags */

View File

@@ -9,6 +9,7 @@
/*
* HISTORY
*/
/* process.h COPYRIGHT FUJITSU LIMITED 2015-2017 */
#ifndef HEADER_PROCESS_H
#define HEADER_PROCESS_H
@@ -66,6 +67,10 @@
#define PS_TRACED 0x40 /* Set to "not running" by a ptrace related event */
#define PS_STOPPING 0x80
#define PS_TRACING 0x100
#ifdef POSTK_DEBUG_TEMP_FIX_41 /* early to wait4() wakeup for ptrace, fix. */
#define PS_DELAY_STOPPED 0x200
#define PS_DELAY_TRACED 0x400
#endif /* POSTK_DEBUG_TEMP_FIX_41 */
#define PS_NORMAL (PS_INTERRUPTIBLE | PS_UNINTERRUPTIBLE)
@@ -135,6 +140,10 @@
#define WEXITED 0x00000004
#define WCONTINUED 0x00000008
#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */
#ifdef POSTK_DEBUG_ARCH_DEP_44 /* wait() add support __WALL */
#define __WALL 0x40000000 /* Wait on all children, regardless of type */
#endif /* POSTK_DEBUG_ARCH_DEP_44 */
#define __WCLONE 0x80000000
/* idtype */

View File

@@ -9,6 +9,7 @@
/*
* HISTORY
*/
/* syscall.h COPYRIGHT FUJITSU LIMITED 2015-2016 */
#ifndef __HEADER_SYSCALL_H
#define __HEADER_SYSCALL_H
@@ -346,13 +347,25 @@ enum {
#undef SYSCALL_DELEGATED
#define __NR_coredump 999 /* pseudo syscall for coredump */
#ifdef POSTK_DEBUG_TEMP_FIX_61 /* Core table size and lseek return value to loff_t */
struct coretable { /* table entry for a core chunk */
off_t len; /* length of the chunk */
unsigned long addr; /* physical addr of the chunk */
};
#else /* POSTK_DEBUG_TEMP_FIX_61 */
struct coretable { /* table entry for a core chunk */
int len; /* length of the chunk */
unsigned long addr; /* physical addr of the chunk */
};
#endif /* POSTK_DEBUG_TEMP_FIX_61 */
#ifdef POSTK_DEBUG_TEMP_FIX_1
void create_proc_procfs_files(int pid, int tid, int cpuid);
void delete_proc_procfs_files(int pid, int tid);
#else /* POSTK_DEBUG_TEMP_FIX_1 */
void create_proc_procfs_files(int pid, int cpuid);
void delete_proc_procfs_files(int pid);
#endif /* POSTK_DEBUG_TEMP_FIX_1 */
void create_os_procfs_files(void);
void delete_os_procfs_files(void);
@@ -452,6 +465,7 @@ int arch_setup_vdso(void);
int arch_cpu_read_write_register(struct ihk_os_cpu_register *desc,
enum mcctrl_os_cpu_operation op);
#ifndef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 2
struct vdso {
long busy;
@@ -468,6 +482,7 @@ struct vdso {
void *pvti_virt;
long pvti_phys;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
struct cpu_mapping {
int cpu_number;

View File

@@ -1,3 +1,4 @@
/* xpmem.h COPYRIGHT FUJITSU LIMITED 2017 */
/**
* \file xpmem.h
* License details are found in the file LICENSE.
@@ -16,7 +17,11 @@
#define XPMEM_DEV_PATH "/dev/xpmem"
#if defined(POSTK_DEBUG_ARCH_DEP_46) || defined(POSTK_DEBUG_ARCH_DEP_62)
extern int xpmem_open(int, const char*, int, ihk_mc_user_context_t *ctx);
#else /* POSTK_DEBUG_ARCH_DEP_46 || POSTK_DEBUG_ARCH_DEP_62 */
extern int xpmem_open(ihk_mc_user_context_t *ctx);
#endif /* POSTK_DEBUG_ARCH_DEP_46 || POSTK_DEBUG_ARCH_DEP_62 */
extern int xpmem_remove_process_memory_range(struct process_vm *vm,
struct vm_range *vmr);
extern int xpmem_fault_process_memory_range(struct process_vm *vm,