move mccmd cleanup into a sub-thread which receives the exit_group syscall
This commit is contained in:
@@ -469,11 +469,11 @@ SYSCALL_DECLARE(mmap)
|
|||||||
unsigned long s = (region->map_end + PAGE_SIZE - 1) & PAGE_MASK;
|
unsigned long s = (region->map_end + PAGE_SIZE - 1) & PAGE_MASK;
|
||||||
unsigned long map_end_aligned = region->map_end;
|
unsigned long map_end_aligned = region->map_end;
|
||||||
unsigned long len = (aal_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
|
unsigned long len = (aal_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
|
||||||
dkprintf("SC(%d),syscall.c,mmap,len=%lx", cpuid, len);
|
dkprintf("syscall.c,mmap,len=%lx", len);
|
||||||
|
|
||||||
#ifdef USE_NOCACHE_MMAP
|
#ifdef USE_NOCACHE_MMAP
|
||||||
if ((aal_mc_syscall_arg3(ctx) & 0x40) == 0x40) {
|
if ((aal_mc_syscall_arg3(ctx) & 0x40) == 0x40) {
|
||||||
dkprintf("SC(%d),syscall.c,mmap,nocache,len=%lx\n", cpuid, len);
|
dkprintf("syscall.c,mmap,nocache,len=%lx\n", len);
|
||||||
region->map_end = extend_process_region(
|
region->map_end = extend_process_region(
|
||||||
cpu_local_var(current), region->map_start, map_end_aligned,
|
cpu_local_var(current), region->map_start, map_end_aligned,
|
||||||
s + len, VR_IO_NOCACHE);
|
s + len, VR_IO_NOCACHE);
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
#define __eprint(msg, ...)
|
#define __eprint(msg, ...)
|
||||||
#define __eprintf(format, ...)
|
#define __eprintf(format, ...)
|
||||||
#else
|
#else
|
||||||
#define __dprint(msg, ...) printf("%s: " msg, __FUNCTION__)
|
#define __dprint(msg, ...) {printf("%s: " msg, __FUNCTION__);fflush(stdout);}
|
||||||
#define __dprintf(format, ...) printf("%s: " format, __FUNCTION__, \
|
#define __dprintf(format, ...) {printf("%s: " format, __FUNCTION__, \
|
||||||
__VA_ARGS__)
|
__VA_ARGS__);fflush(stdout);}
|
||||||
#define __eprint(msg, ...) fprintf(stderr, "%s: " msg, __FUNCTION__)
|
#define __eprint(msg, ...) {fprintf(stderr, "%s: " msg, __FUNCTION__);fflush(stderr);}
|
||||||
#define __eprintf(format, ...) fprintf(stderr, "%s: " format, __FUNCTION__, \
|
#define __eprintf(format, ...) {fprintf(stderr, "%s: " format, __FUNCTION__, \
|
||||||
__VA_ARGS__)
|
__VA_ARGS__);fflush(stderr);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SYSCALL_MOD_CALL
|
#ifdef USE_SYSCALL_MOD_CALL
|
||||||
@@ -346,6 +346,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "Error: Failed to open %s\n", argv[1]);
|
fprintf(stderr, "Error: Failed to open %s\n", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc = load_elf(fp);
|
desc = load_elf(fp);
|
||||||
if (!desc) {
|
if (!desc) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -449,11 +450,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +675,14 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
|
|||||||
case __NR_exit:
|
case __NR_exit:
|
||||||
case __NR_exit_group:
|
case __NR_exit_group:
|
||||||
do_syscall_return(fd, cpu, 0, 0, 0, 0, 0);
|
do_syscall_return(fd, cpu, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
__dprintf("__NR_exit/__NR_exit_group: %ld (cpu_id: %d)\n",
|
||||||
|
w.sr.args[0], cpu);
|
||||||
|
|
||||||
|
#ifdef USE_SYSCALL_MOD_CALL
|
||||||
|
mc_cmd_server_exit();
|
||||||
|
__dprint("mccmd server exited\n");
|
||||||
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
pthread_mutex_unlock(lock);
|
pthread_mutex_unlock(lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user