merge mpi host assist process into mcexec,

use syscall instead of another ikc

Conflicts:

	kernel/syscall.c
	linux/executer/mcexec.c
This commit is contained in:
simin
2012-11-29 16:28:25 +09:00
parent 9fd7f3ddf7
commit c08e60382d
3 changed files with 46 additions and 6 deletions

View File

@@ -76,7 +76,8 @@ static void send_syscall(struct syscall_request *req)
#endif #endif
} }
static int do_syscall(struct syscall_request *req, aal_mc_user_context_t *ctx)
int do_syscall(struct syscall_request *req, aal_mc_user_context_t *ctx)
{ {
struct syscall_response *res = cpu_local_var(scp).response_va; struct syscall_response *res = cpu_local_var(scp).response_va;

View File

@@ -3,7 +3,7 @@ CFLAGS = -O3 -Wall -g -pthread
all: mcexec all: mcexec
mcexec: mcexec.c mcexec: mcexec.c
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^ $(EXTRA_OBJS)
clean: clean:
rm -f mcexec rm -f mcexec

View File

@@ -25,13 +25,13 @@
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#define DEBUG //#define DEBUG
#ifndef DEBUG #ifndef DEBUG
#define __dprint(msg, ...) #define __dprint(msg, ...)
#define __dprintf(arg, ...) #define __dprintf(arg, ...)
#define __eprint(msg, ...) #define __eprint(msg, ...)
#define __eprinf(format, ...) #define __eprintf(format, ...)
#else #else
#define __dprint(msg, ...) printf("%s: " msg, __FUNCTION__) #define __dprint(msg, ...) printf("%s: " msg, __FUNCTION__)
#define __dprintf(format, ...) printf("%s: " format, __FUNCTION__, \ #define __dprintf(format, ...) printf("%s: " format, __FUNCTION__, \
@@ -41,6 +41,15 @@
__VA_ARGS__) __VA_ARGS__)
#endif #endif
#ifdef USE_SYSCALL_MOD_CALL
extern int mc_cmd_server_init();
extern void mc_cmd_server_exit();
extern void mc_cmd_handle(int fd, int cpu, unsigned long args[6]);
int __glob_argc = -1;
char **__glob_argv = 0;
#endif
typedef unsigned char cc_t; typedef unsigned char cc_t;
typedef unsigned int speed_t; typedef unsigned int speed_t;
typedef unsigned int tcflag_t; typedef unsigned int tcflag_t;
@@ -301,8 +310,9 @@ struct thread_data_s {
static void *main_loop_thread_func(void *arg) static void *main_loop_thread_func(void *arg)
{ {
struct thread_data_s *td = (struct thread_data_s *)arg; struct thread_data_s *td = (struct thread_data_s *)arg;
td->ret = main_loop(td->fd, td->cpu, td->lock); td->ret = main_loop(td->fd, td->cpu, td->lock);
return NULL; return NULL;
} }
@@ -320,6 +330,11 @@ int main(int argc, char **argv)
int i; int i;
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
#ifdef USE_SYSCALL_MOD_CALL
__glob_argc = argc;
__glob_argv = argv;
#endif
if (argc < 2) { if (argc < 2) {
fprintf(stderr, "Usage: %s (program) [args...]\n", fprintf(stderr, "Usage: %s (program) [args...]\n",
argv[0]); argv[0]);
@@ -397,6 +412,17 @@ int main(int argc, char **argv)
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
#ifdef USE_SYSCALL_MOD_CALL
/**
* TODO: need mutex for static structures
*/
if(mc_cmd_server_init()){
fprintf(stderr, "Error: cmd server init failed\n");
return 1;
}
__dprint("mccmd server initialized\n");
#endif
for (i = 0; i < NUM_HANDLER_THREADS; ++i) { for (i = 0; i < NUM_HANDLER_THREADS; ++i) {
int ret; int ret;
@@ -423,6 +449,11 @@ int main(int argc, char **argv)
ret = pthread_join(thread_data[i].thread_id, NULL); ret = pthread_join(thread_data[i].thread_id, NULL);
} }
#ifdef USE_SYSCALL_MOD_CALL
mc_cmd_server_exit();
__dprint("mccmd server exited\n");
#endif
return 0; return 0;
} }
@@ -487,7 +518,7 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
} }
*/ */
printf("open: %s\n", dma_buf); __dprintf("open: %s\n", dma_buf);
ret = open((char *)dma_buf, w.sr.args[1], w.sr.args[2]); ret = open((char *)dma_buf, w.sr.args[1], w.sr.args[2]);
SET_ERR(ret); SET_ERR(ret);
@@ -748,6 +779,14 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
mmap_out: mmap_out:
do_syscall_return(fd, cpu, ret, 1, (unsigned long)dma_buf, w.sr.args[0], w.sr.args[1]); do_syscall_return(fd, cpu, ret, 1, (unsigned long)dma_buf, w.sr.args[0], w.sr.args[1]);
break; } break; }
#ifdef USE_SYSCALL_MOD_CALL
case 303:{
__dprintf("mcexec.c,mod_cal,mod=%ld,cmd=%ld\n", w.sr.args[0], w.sr.args[1]);
mc_cmd_handle(fd, cpu, w.sr.args);
break;
}
#endif
default: default:
__dprintf("Unhandled system calls: %ld\n", w.sr.number); __dprintf("Unhandled system calls: %ld\n", w.sr.number);
break; break;