Browse Source

resurrect checkpoint/migration

Chia-Che Tsai 8 years ago
parent
commit
11e27a9a41
4 changed files with 21 additions and 27 deletions
  1. 1 2
      LibOS/shim/src/shim_init.c
  2. 1 8
      LibOS/shim/src/start.S
  3. 1 1
      LibOS/shim/test/native/manifest.template
  4. 18 16
      Pal/src/db_main.c

+ 1 - 2
LibOS/shim/src/shim_init.c

@@ -594,7 +594,7 @@ DEFINE_PROFILE_INTERVAL(init_signal, init);
 
 extern PAL_HANDLE thread_start_event;
 
-int shim_init (int argc, void * args, void ** return_stack)
+int shim_init (int argc, void * args)
 {
     debug_handle = PAL_CB(debug_stream);
     cur_process.vmid = (IDTYPE) PAL_CB(process_id);
@@ -730,7 +730,6 @@ restore:
         execute_elf_object(cur_thread->exec,
                            argc, argp, nauxv, auxp);
 
-    *return_stack = initial_stack;
     return 0;
 }
 

+ 1 - 8
LibOS/shim/src/start.S

@@ -37,7 +37,6 @@ shim_start:
    The arguments are passed via registers and on the stack:
    argc:         %rdi
    argv:         %rsi
-   stack:        %rdx
 */
 
     /* Align the stack to a 16 byte boundary to follow the ABI.  */
@@ -47,16 +46,10 @@ shim_start:
     movq 0(%rbp), %rdi      /* Pop the argument count.  */
     leaq 8(%rbp), %rsi      /* argv starts just at the current stack top.  */
 
-/* Provide the highest stack address to the user code (for stacks
-   which grow downwards).  */
-
-    pushq %rbp
-    movq %rsp, %rdx
+    pushq %rdx
 
     movq shim_init@GOTPCREL(%rip), %r11
     call *%r11
 
-    popq %rbp
-    leaveq
     retq
     .cfi_endproc

+ 1 - 1
LibOS/shim/test/native/manifest.template

@@ -19,4 +19,4 @@ net.rules.1 = 127.0.0.1:8000:0.0.0.0:0-65535
 # allow to connect to port 8000
 net.rules.2 = 0.0.0.0:0-65535:127.0.0.1:8000
 
-# sys.ask_for_checkpoint = 1
+sys.ask_for_checkpoint = 1

+ 18 - 16
Pal/src/db_main.c

@@ -239,12 +239,6 @@ void pal_main (PAL_NUM pal_token, void * pal_addr,
 
     init_slab_mgr(pal_state.alloc_align);
 
-    if (is_parent && !exec_handle && !manifest_handle) {
-        printf("USAGE: %s [executable|manifest] args ...\n", pal_name);
-        _DkProcessExit(0);
-        return;
-    }
-
     char * exec = NULL, * manifest = NULL;
 
     if (exec_handle) {
@@ -265,15 +259,17 @@ void pal_main (PAL_NUM pal_token, void * pal_addr,
             unsigned long before_find_manifest = _DkSystemTimeQuery();
 #endif
             do {
-                assert(!!exec);
-                /* try open "<exec>.manifest" */
-                manifest = __alloca(URI_MAX);
-                snprintf(manifest, URI_MAX, "%s.manifest", exec);
-                ret = _DkStreamOpen(&manifest_handle,
-                                    manifest,
-                                    PAL_ACCESS_RDONLY, 0, 0, 0);
-                if (!ret)
-                    break;
+                if (exec_handle) {
+                    assert(!!exec);
+                    /* try open "<exec>.manifest" */
+                    manifest = __alloca(URI_MAX);
+                    snprintf(manifest, URI_MAX, "%s.manifest", exec);
+                    ret = _DkStreamOpen(&manifest_handle,
+                                        manifest,
+                                        PAL_ACCESS_RDONLY, 0, 0, 0);
+                    if (!ret)
+                        break;
+                }
 
                 /* try open "file:manifest" */
                 manifest = "file:manifest";
@@ -353,6 +349,12 @@ void pal_main (PAL_NUM pal_token, void * pal_addr,
         }
     }
 
+    if (is_parent && !exec_handle && !manifest_handle) {
+        printf("USAGE: %s [executable|manifest] args ...\n", pal_name);
+        _DkProcessExit(0);
+        return;
+    }
+
     pal_state.manifest        = manifest;
     pal_state.manifest_handle = manifest_handle;
     pal_state.exec            = exec;
@@ -362,7 +364,7 @@ void pal_main (PAL_NUM pal_token, void * pal_addr,
     argc--;
     argv++;
 
-    if (is_parent && exec) {
+    if (is_parent && exec_handle) {
         first_argv = exec;
         if (pal_state.root_config) {
             char cfgbuf[CONFIG_MAX];