summaryrefslogtreecommitdiff
path: root/boot/boot.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-11-06 18:36:41 +0100
committerJustus Winter <justus@gnupg.org>2016-09-04 12:31:06 +0200
commit9c98b0d28be5ed8e1807d866f8480833bd73896c (patch)
treecc8a73db411601634fdc744c47811fcb5a8f56da /boot/boot.c
parentec8febd9aef1f1ca8c35f6f0dc0a3b36f9dbc1e7 (diff)
boot: XXX hand out fake host-priv port
Diffstat (limited to 'boot/boot.c')
-rw-r--r--boot/boot.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/boot/boot.c b/boot/boot.c
index 7f28f6b3..fb26a4b4 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -1,6 +1,6 @@
/* Load a task using the single server, and then run it
as if we were the kernel.
- Copyright (C) 1993,94,95,96,97,98,99,2000,01,02,2006
+ Copyright (C) 1993,94,95,96,97,98,99,2000,01,02,2006,14
Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -49,6 +49,7 @@
#include "term_S.h"
#include "bootstrap_S.h"
/* #include "tioctl_S.h" */
+#include "mach_S.h"
#include "boot_script.h"
@@ -116,7 +117,7 @@ host_exit (int status)
#endif /* UX */
mach_port_t privileged_host_port, master_device_port;
-mach_port_t pseudo_master_device_port;
+mach_port_t pseudo_privileged_host_port, pseudo_master_device_port;
mach_port_t receive_set;
mach_port_t pseudo_console, pseudo_root, pseudo_time;
auth_t authserver;
@@ -216,7 +217,8 @@ boot_demuxer (mach_msg_header_t *inp,
if ((routine = io_server_routine (inp)) ||
(routine = device_server_routine (inp)) ||
(routine = notify_server_routine (inp)) ||
- (routine = term_server_routine (inp))
+ (routine = term_server_routine (inp)) ||
+ (routine = mach_server_routine (inp))
/* (routine = tioctl_server_routine (inp)) */)
{
(*routine) (inp, outp);
@@ -552,6 +554,21 @@ main (int argc, char **argv, char **envp)
}
mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
+ &pseudo_privileged_host_port);
+ mach_port_insert_right (mach_task_self (),
+ pseudo_privileged_host_port,
+ pseudo_privileged_host_port,
+ MACH_MSG_TYPE_MAKE_SEND);
+ mach_port_move_member (mach_task_self (), pseudo_privileged_host_port,
+ receive_set);
+ mach_port_request_notification (mach_task_self (), pseudo_privileged_host_port,
+ MACH_NOTIFY_NO_SENDERS, 1,
+ pseudo_privileged_host_port,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE, &foo);
+ if (foo != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), foo);
+
+ mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
&pseudo_master_device_port);
mach_port_insert_right (mach_task_self (),
pseudo_master_device_port,
@@ -590,7 +607,7 @@ main (int argc, char **argv, char **envp)
/* Initialize boot script variables. */
if (boot_script_set_variable ("host-port", VAL_PORT,
- (int) privileged_host_port)
+ (int) pseudo_privileged_host_port)
|| boot_script_set_variable ("device-port", VAL_PORT,
(integer_t) pseudo_master_device_port)
|| boot_script_set_variable ("kernel-command-line", VAL_STR,
@@ -1895,3 +1912,20 @@ kern_return_t S_term_on_pty
io_t *ptymaster
)
{ return EOPNOTSUPP; }
+
+/* Mach host emulation. */
+
+kern_return_t
+S_vm_set_default_memory_manager (mach_port_t host_priv,
+ mach_port_t *default_manager)
+{
+ if (host_priv != pseudo_privileged_host_port)
+ return KERN_INVALID_HOST;
+
+ if (*default_manager != MACH_PORT_NULL)
+ return KERN_FAILURE;
+
+ *default_manager = MACH_PORT_NULL;
+ return KERN_SUCCESS;
+}
+