bug-hurd
[Top][All Lists]
Advanced

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

Re: Getting rid of serverboot


From: Neal H Walfield
Subject: Re: Getting rid of serverboot
Date: Sat, 18 Aug 2001 18:25:36 +0200
User-agent: Mutt/1.3.18i

> On the kernel side, I've checked in changes on the oskit-branch.
> But you can just take kern/bootstrap.c from oskit-branch and plop
> it into your gnumach tree (or "cvs up -r oskit-branch kern/bootstrap.c"
> in your gnumach tree) and it will build ok.
> 
> Right now this new kern/bootstrap.c contains
> `#include "../../hurd/boot/boot_script.h"',
> so it only builds right if you have your hurd source tree as ../hurd
> relative to your mach source tree.  (After this gets working, I will rectify
> this before checking in the changes to the gnumach trunk.)
> 
> The first thing to test with the new kernel is that an old-style boot still
> works.  It checks if there is exactly one multiboot module and its module
> string contains no spaces (i.e. "/boot/serverboot"), and uses (mostly) the
> old code in that case.  Please make sure I haven't broken this before
> getting into debugging the new functionality.

A few small things.  First, boot_info is a pointer under GNUMach and
just a plain structure under OSKit Mach.  I created a small marcro to
mask this and to minimize the changes.  I imagine that you will want a
rewrite of this.  Second, struct multiboot_module.  I do not know if
this works under OSKit Mach, however, this was the root of all my
trouble in GNUMach.  Basically, this does not work at all.  Here is the
error message that I got with this code enabled:

        Loading single multiboot modules in compat mode: /serverboot
        panic: Cannot load user-boostrap image: error code -1

Finally, there is no strchr function in GNU Mach.  I have included a
patch to add this to kern/strings.[ch].

Change log:

2001-08-18  Neal H Walfield  <neal@cs.uml.edu>

        * kern/bootstrap.c (boot_info) [!OSKIT_MACH]: This a
        pointer to a multiboot_info structure, not a multiboot_info
        structure.
        (FUBAR, boot_info) [!OSKIT_MACH]: New marcros.
        (boot_read) [!OSKIT_MACH]: Treat HANDLE as a void *, not a
        struct multiboot_module *.
        (read_exec) [!OSKIT_MACH]: Likewise.

        * kern/strings.c (strchr): New function.
        * kern/strings.h (strchr): Prototype it.


Index: bootstrap.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/bootstrap.c,v
retrieving revision 1.3.2.6
diff -u -p -r1.3.2.6 bootstrap.c
--- bootstrap.c 2001/08/17 10:26:11     1.3.2.6
+++ bootstrap.c 2001/08/18 16:02:38
@@ -67,7 +67,14 @@
 static mach_port_t     boot_device_port;       /* local name */
 static mach_port_t     boot_host_port;         /* local name */
 
+#ifdef OSKIT_MACH
 extern struct multiboot_info boot_info;
+#else /* GNU/Mach.  I.e. not OSKit Mach.  */
+extern struct multiboot_info *boot_info;
+#define FUBAR (*boot_info)
+#define boot_info FUBAR
+#endif
+
 extern char *kernel_cmdline;
 
 static void user_bootstrap();  /* forward */
@@ -343,12 +350,16 @@ static int
 boot_read(void *handle, vm_offset_t file_ofs, void *buf, vm_size_t size,
          vm_size_t *out_actual)
 {
+#if OSKIT_MACH
   struct multiboot_module *mod = handle;
 
   if (mod->mod_start + file_ofs + size > mod->mod_end)
     return -1;
 
   memcpy(buf, (const char*)mod->mod_start + file_ofs, size);
+#else
+  memcpy(buf, handle + file_ofs, size);
+#endif
   *out_actual = size;
   return 0;
 }
@@ -358,15 +369,19 @@ read_exec(void *handle, vm_offset_t file
                     vm_offset_t mem_addr, vm_size_t mem_size,
                     exec_sectype_t sec_type)
 {
+#if OSKIT_MACH
   struct multiboot_module *mod = handle;
+#endif
 
        vm_map_t user_map = current_task()->map;
        vm_offset_t start_page, end_page;
        vm_prot_t mem_prot = sec_type & EXEC_SECTYPE_PROT_MASK;
        int err;
 
+#if OSKIT_MACH
        if (mod->mod_start + file_ofs + file_size > mod->mod_end)
          return -1;
+#endif
 
        if (!(sec_type & EXEC_SECTYPE_ALLOC))
                return 0;
@@ -388,8 +403,12 @@ read_exec(void *handle, vm_offset_t file
 
        if (file_size > 0)
        {
+#if OSKIT_MACH
                err = copyout((char *)mod->mod_start + file_ofs,
                              mem_addr, file_size);
+#else
+               err = copyout(handle + file_ofs, mem_addr, file_size);
+#endif
                assert(err == 0);
        }
 
Index: strings.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/strings.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 strings.c
--- strings.c   1997/02/25 21:28:26     1.1.1.1
+++ strings.c   2001/08/18 16:02:53
@@ -172,3 +172,29 @@ strlen(
 
        return string - 1 - ret;
 }
+
+/*
+ * Abstract:
+ *      strchr locates a character in a string.
+ */
+char *
+strchr(
+        const char *s,
+        int c)
+{
+        for (; *s && *s != c; s ++)
+               ;
+
+       if (*s)
+               return (char *) s;
+       else
+               return 0;
+}
+
+
+
+
+
+
+
+
Index: strings.h
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/strings.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 strings.h
--- strings.h   1997/02/25 21:28:26     1.1.1.1
+++ strings.h   2001/08/18 16:02:53
@@ -51,3 +51,7 @@ extern char *strncpy(
 
 extern unsigned long strlen(
        const char *);
+
+extern char *strchr(
+        const char *,
+        int c);

Attachment: pgpTejXCQhr2R.pgp
Description: PGP signature


reply via email to

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