From 9fe8d548fb1a7ea13a25aae88d0fd7ee42e19eab Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Sun, 28 Oct 2012 00:40:12 +0900 Subject: [PATCH] increase PIN_SHIFT to 28 for reading large .so-file (temporary, we should use pread instead), and added system-call time --- kernel/syscall.c | 12 ++++++++++++ linux/executer/mcexec.c | 24 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/kernel/syscall.c b/kernel/syscall.c index 80c6bd90..fef8e312 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -179,6 +179,16 @@ SYSCALL_DECLARE(stat) SYSCALL_FOOTER; } +SYSCALL_DECLARE(time) +{ + SYSCALL_HEADER; + if(aal_mc_syscall_arg0(ctx)) { + SYSCALL_ARGS_1(MO); + } else { + SYSCALL_ARGS_1(D); + } + SYSCALL_FOOTER; +} SYSCALL_DECLARE(gettimeofday) { @@ -950,6 +960,7 @@ static long (*syscall_table[])(int, aal_mc_user_context_t *) = { [110] = sys_getxid, [111] = sys_getxid, [158] = sys_arch_prctl, + [201] = sys_time, [202] = sys_futex, [203] = sys_sched_setaffinity, [204] = sys_sched_getaffinity, @@ -999,6 +1010,7 @@ static char *syscall_name[] = { [110] = "sys_getpgid", [111] = "sys_getppid", [158] = "sys_arch_prctl", + [201] = "sys_time", [202] = "sys_futex", [203] = "sys_sched_setaffinity", [204] = "sys_sched_getaffinity", diff --git a/linux/executer/mcexec.c b/linux/executer/mcexec.c index aae257eb..3df7342f 100644 --- a/linux/executer/mcexec.c +++ b/linux/executer/mcexec.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -208,7 +209,7 @@ void print_desc(struct program_load_desc *desc) } } -#define PIN_SHIFT 24 +#define PIN_SHIFT 28 #define PIN_SIZE (1 << PIN_SHIFT) #define PIN_MASK ~(unsigned long)(PIN_SIZE - 1) @@ -591,6 +592,27 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock) } break; + /* + glibc-2.14.90/sysdeps/unix/sysv/linux/x86_64/time.S + linux-2.6.34.13/arch/x86/kernel/vsyscall_64.c + /usr/include/time.h + /usr/include/bits/types.h + /usr/include/bits/typesizes.h + #define __TIME_T_TYPE __SLONGWORD_TYPE + */ + case __NR_time: { + time_t ret; + if(w.sr.args[0]) { + ret = time((time_t *)dma_buf); + } else { + ret = time(NULL); + } + SET_ERR(ret); + printf("time=%ld\n", ret); + do_syscall_return(fd, cpu, ret, 1, (unsigned long)dma_buf, + w.sr.args[0], sizeof(time_t)); + break; } + case __NR_gettimeofday: ret = gettimeofday((struct timeval *)dma_buf, NULL); SET_ERR(ret);