return syscall_table[] to the arch-independent part
This commit is contained in:
@@ -57,7 +57,9 @@ SYSCALL_HANDLED(218, set_tid_address)
|
||||
SYSCALL_HANDLED(231, exit_group)
|
||||
SYSCALL_HANDLED(234, tgkill)
|
||||
SYSCALL_HANDLED(273, set_robust_list)
|
||||
#ifdef DCFA_KMOD
|
||||
SYSCALL_HANDLED(303, mod_call)
|
||||
#endif
|
||||
SYSCALL_HANDLED(502, process_data_section)
|
||||
SYSCALL_HANDLED(601, pmc_init)
|
||||
SYSCALL_HANDLED(602, pmc_start)
|
||||
|
||||
@@ -14,34 +14,4 @@
|
||||
#define dkprintf(...)
|
||||
#endif
|
||||
|
||||
/* generate system call handler's prototypes */
|
||||
#define SYSCALL_HANDLED(number,name) extern long sys_##name(int n, ihk_mc_user_context_t *ctx);
|
||||
#define SYSCALL_DELEGATED(number,name)
|
||||
#include <syscall_list.h>
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
|
||||
/* generate syscall_table[] */
|
||||
long (*syscall_table[])(int, ihk_mc_user_context_t *) = {
|
||||
#define SYSCALL_HANDLED(number,name) [number] = &sys_##name,
|
||||
#define SYSCALL_DELEGATED(number,name)
|
||||
#include <syscall_list.h>
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
};
|
||||
|
||||
/* # of elements of syscall_table[] */
|
||||
long syscall_table_elems = sizeof(syscall_table) / sizeof(syscall_table[0]);
|
||||
|
||||
/* generate syscall_name[] */
|
||||
char *syscall_name[] = {
|
||||
#define DECLARATOR(number,name) [number] = #name,
|
||||
#define SYSCALL_HANDLED(number,name) DECLARATOR(number,sys_##name)
|
||||
#define SYSCALL_DELEGATED(number,name) DECLARATOR(number,sys_##name)
|
||||
#include <syscall_list.h>
|
||||
#undef DECLARATOR
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
};
|
||||
|
||||
/* archtecture-depended syscall handlers */
|
||||
|
||||
@@ -184,10 +184,6 @@ struct syscall_params {
|
||||
|
||||
#define SYSCALL_FOOTER return do_syscall(&request, ctx)
|
||||
|
||||
extern long (*syscall_table[])(int n, ihk_mc_user_context_t *ctx);
|
||||
extern char *syscall_name[];
|
||||
extern long syscall_table_elems;
|
||||
|
||||
extern int do_syscall(struct syscall_request *req, ihk_mc_user_context_t *ctx);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,34 @@
|
||||
|
||||
static ihk_atomic_t pid_cnt = IHK_ATOMIC_INIT(1024);
|
||||
|
||||
/* generate system call handler's prototypes */
|
||||
#define SYSCALL_HANDLED(number,name) extern long sys_##name(int n, ihk_mc_user_context_t *ctx);
|
||||
#define SYSCALL_DELEGATED(number,name)
|
||||
#include <syscall_list.h>
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
|
||||
/* generate syscall_table[] */
|
||||
static long (*syscall_table[])(int, ihk_mc_user_context_t *) = {
|
||||
#define SYSCALL_HANDLED(number,name) [number] = &sys_##name,
|
||||
#define SYSCALL_DELEGATED(number,name)
|
||||
#include <syscall_list.h>
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
};
|
||||
|
||||
/* generate syscall_name[] */
|
||||
#define MCKERNEL_UNUSED __attribute__ ((unused))
|
||||
static char *syscall_name[] MCKERNEL_UNUSED = {
|
||||
#define DECLARATOR(number,name) [number] = #name,
|
||||
#define SYSCALL_HANDLED(number,name) DECLARATOR(number,sys_##name)
|
||||
#define SYSCALL_DELEGATED(number,name) DECLARATOR(number,sys_##name)
|
||||
#include <syscall_list.h>
|
||||
#undef DECLARATOR
|
||||
#undef SYSCALL_HANDLED
|
||||
#undef SYSCALL_DELEGATED
|
||||
};
|
||||
|
||||
#ifdef DCFA_KMOD
|
||||
static void do_mod_exit(int status);
|
||||
#endif
|
||||
@@ -873,7 +901,7 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
|
||||
dkprintf("\n");
|
||||
|
||||
|
||||
if ((0 <= num) && (num < syscall_table_elems)
|
||||
if ((0 <= num) && (num < (sizeof(syscall_table) / sizeof(syscall_table[0])))
|
||||
&& (syscall_table[num] != NULL)) {
|
||||
l = syscall_table[num](num, ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user