summaryrefslogtreecommitdiff
path: root/debian/patches/task-load.patch
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-01-23 02:27:03 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-01-23 02:27:03 +0100
commit08e734472280d6f87a2de15684b1b1b97d1d8920 (patch)
tree8e2e9f58f95a5dfec062e79f6b85b77a7fc6198d /debian/patches/task-load.patch
parentf3d6454fdd38b5a745c15e053bbf2a08c7883f37 (diff)
drop old patch series
Diffstat (limited to 'debian/patches/task-load.patch')
-rw-r--r--debian/patches/task-load.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/debian/patches/task-load.patch b/debian/patches/task-load.patch
new file mode 100644
index 0000000..bae7574
--- /dev/null
+++ b/debian/patches/task-load.patch
@@ -0,0 +1,101 @@
+From 270c3cd23333668696da3e81c3f60ff5d4fc1ad8 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Fri, 21 Nov 2014 00:23:39 +0100
+Subject: [PATCH gnumach] XXX
+
+---
+ kern/bootstrap.c | 36 ++++++++++++++++++++++++++++++------
+ 1 file changed, 30 insertions(+), 6 deletions(-)
+
+diff --git a/kern/bootstrap.c b/kern/bootstrap.c
+index 4edae7b..9c2eb87 100644
+--- a/kern/bootstrap.c
++++ b/kern/bootstrap.c
+@@ -35,6 +35,7 @@
+
+ #include <mach/port.h>
+ #include <mach/message.h>
++#include <mach/exec/elf.h>
+ #include <machine/locore.h>
+ #include <machine/vm_param.h>
+ #include <machine/pcb.h>
+@@ -422,23 +423,19 @@ boot_read(void *handle, vm_offset_t file_ofs, void *buf, vm_size_t size,
+ }
+
+ static int
+-read_exec(void *handle, vm_offset_t file_ofs, vm_size_t file_size,
++read_in(void *handle, vm_offset_t file_ofs, vm_size_t file_size,
+ vm_offset_t mem_addr, vm_size_t mem_size,
+- exec_sectype_t sec_type)
++ vm_prot_t mem_prot)
+ {
+ struct multiboot_module *mod = handle;
+
+ 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 (mod->mod_start + file_ofs + file_size > mod->mod_end)
+ return -1;
+
+- if (!(sec_type & EXEC_SECTYPE_ALLOC))
+- return 0;
+-
+ assert(mem_size > 0);
+ assert(mem_size >= file_size);
+
+@@ -470,6 +467,19 @@ read_exec(void *handle, vm_offset_t file_ofs, vm_size_t file_size,
+ return 0;
+ }
+
++static int
++read_exec(void *handle, vm_offset_t file_ofs, vm_size_t file_size,
++ vm_offset_t mem_addr, vm_size_t mem_size,
++ exec_sectype_t sec_type)
++{
++ if (!(sec_type & EXEC_SECTYPE_ALLOC))
++ return 0;
++
++ return read_in (handle, file_ofs, file_size,
++ mem_addr, mem_size,
++ sec_type & EXEC_SECTYPE_PROT_MASK);
++}
++
+ static void copy_bootstrap(void *e, exec_info_t *boot_exec_info)
+ {
+ //register vm_map_t user_map = current_task()->map;
+@@ -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.
+ */
+--
+2.1.4
+