diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-06 21:33:16 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-28 16:47:23 +0100 |
commit | 71c43b24e0cfb1efab2519a97fbf74d677cc36c5 (patch) | |
tree | cf6e1a851a85b8b915e4330abc8b0d856fcfe4b1 /kern | |
parent | c6d1409185743c34e1c1688019c71e35e7f0e9ac (diff) | |
download | gnumach-71c43b24e0cfb1efab2519a97fbf74d677cc36c5.tar.gz gnumach-71c43b24e0cfb1efab2519a97fbf74d677cc36c5.tar.bz2 gnumach-71c43b24e0cfb1efab2519a97fbf74d677cc36c5.zip |
bootstrap.c: Add 32-on-64bit support
* kern/bootstrap.c (bootstrap_create): Support loading 32bit binaries on
64bit.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/bootstrap.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/kern/bootstrap.c b/kern/bootstrap.c index 8b88d17d..c7b18b1d 100644 --- a/kern/bootstrap.c +++ b/kern/bootstrap.c @@ -126,14 +126,32 @@ void bootstrap_create(void) int compat; unsigned n = 0; #ifdef MACH_XEN - struct multiboot_module *bmods = ((struct multiboot_module *) - boot_info.mod_start); +#ifdef __x86_64__ // 32_ON_64 actually + struct multiboot32_module *bmods32 = (struct multiboot32_module *) + boot_info.mod_start; + struct multiboot_module *bmods; + if (bmods32) { + int i; + for (n = 0; bmods32[n].mod_start; n++) + ; + bmods = alloca(n * sizeof(*bmods)); + for (i = 0; i < n ; i++) + { + bmods[i].mod_start = kvtophys(bmods32[i].mod_start + (vm_offset_t) bmods32); + bmods[i].mod_end = kvtophys(bmods32[i].mod_end + (vm_offset_t) bmods32); + bmods[i].string = kvtophys(bmods32[i].string + (vm_offset_t) bmods32); + } + } +#else + struct multiboot_module *bmods = (struct multiboot_module *) + boot_info.mod_start; if (bmods) for (n = 0; bmods[n].mod_start; n++) { bmods[n].mod_start = kvtophys(bmods[n].mod_start + (vm_offset_t) bmods); bmods[n].mod_end = kvtophys(bmods[n].mod_end + (vm_offset_t) bmods); bmods[n].string = kvtophys(bmods[n].string + (vm_offset_t) bmods); } +#endif boot_info.mods_count = n; boot_info.flags |= MULTIBOOT_MODS; #else /* MACH_XEN */ |