return syscall_table[] to the arch-independent part

This commit is contained in:
NAKAMURA Gou
2013-06-24 15:53:37 +09:00
parent 295c2ee5ca
commit cbc37b62a9
4 changed files with 31 additions and 35 deletions

View File

@@ -57,7 +57,9 @@ SYSCALL_HANDLED(218, set_tid_address)
SYSCALL_HANDLED(231, exit_group) SYSCALL_HANDLED(231, exit_group)
SYSCALL_HANDLED(234, tgkill) SYSCALL_HANDLED(234, tgkill)
SYSCALL_HANDLED(273, set_robust_list) SYSCALL_HANDLED(273, set_robust_list)
#ifdef DCFA_KMOD
SYSCALL_HANDLED(303, mod_call) SYSCALL_HANDLED(303, mod_call)
#endif
SYSCALL_HANDLED(502, process_data_section) SYSCALL_HANDLED(502, process_data_section)
SYSCALL_HANDLED(601, pmc_init) SYSCALL_HANDLED(601, pmc_init)
SYSCALL_HANDLED(602, pmc_start) SYSCALL_HANDLED(602, pmc_start)

View File

@@ -14,34 +14,4 @@
#define dkprintf(...) #define dkprintf(...)
#endif #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 */ /* archtecture-depended syscall handlers */

View File

@@ -184,10 +184,6 @@ struct syscall_params {
#define SYSCALL_FOOTER return do_syscall(&request, ctx) #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); extern int do_syscall(struct syscall_request *req, ihk_mc_user_context_t *ctx);
#endif #endif

View File

@@ -35,6 +35,34 @@
static ihk_atomic_t pid_cnt = IHK_ATOMIC_INIT(1024); 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 #ifdef DCFA_KMOD
static void do_mod_exit(int status); static void do_mod_exit(int status);
#endif #endif
@@ -873,7 +901,7 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
dkprintf("\n"); dkprintf("\n");
if ((0 <= num) && (num < syscall_table_elems) if ((0 <= num) && (num < (sizeof(syscall_table) / sizeof(syscall_table[0])))
&& (syscall_table[num] != NULL)) { && (syscall_table[num] != NULL)) {
l = syscall_table[num](num, ctx); l = syscall_table[num](num, ctx);