bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reinventing the Hurd server bootstrap


From: Justus Winter
Subject: Re: Reinventing the Hurd server bootstrap
Date: Sat, 27 Dec 2014 12:32:21 +0100
User-agent: alot/0.3.5

Quoting Richard Braun (2014-12-27 12:20:17)
> On Fri, Dec 26, 2014 at 06:32:33PM +0100, Justus Winter wrote:
> > Quoting Richard Braun (2014-12-26 17:10:19)
> > > What kind of non-elf files ?
> > 
> > Any file.  I created this patch in an attempt to use a dead task
> > (i.e. a task w/o a thread) as a ramdisk.  Now I'm (ab)using this patch
> > to load the script that my interpreter runs:
> 
> But how does Mach handle the loading of a non-elf file ?

This isn't ready for inclusion, but for now it's mainly:

@@ -746,9 +756,20 @@ static void user_bootstrap(void)
exec_info_t boot_exec_info;
int err;
char **av;
+  boolean_t executable = TRUE;

/* Load this task up from the executable file in the module.  */
err = exec_load(boot_read, read_exec, info->mod, &boot_exec_info);
+  if (err == EX_NOT_EXECUTABLE)
+    {
+      struct multiboot_module *mod = info->mod;
+      printf("reading %d bytes into map %p\n", mod->mod_end - mod->mod_start, 
current_task()->map);
+      err = read_in (mod,
                      +              0, mod->mod_end - mod->mod_start,
                      +              0, mod->mod_end - mod->mod_start,
                      +              VM_PROT_READ);
+      executable = FALSE;
+    }
if (err)
panic ("Cannot load user executable module (error code %d): %s",
       err, info->argv[0]);
@@ -770,6 +791,9 @@ static void user_bootstrap(void)
info->done = 1;
thread_wakeup ((event_t) info);

+  if (! executable)
+    thread_terminate (current_thread ());
+
/*
* Exit to user thread.
*/

I generalized `read_exec' into `read_in' for that.

Justus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]