summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/boot_script.c25
-rw-r--r--boot/boot_script.h4
-rw-r--r--boot/userland-boot.c13
3 files changed, 31 insertions, 11 deletions
diff --git a/boot/boot_script.c b/boot/boot_script.c
index fb5b8d6c..d0317520 100644
--- a/boot/boot_script.c
+++ b/boot/boot_script.c
@@ -3,6 +3,9 @@
/* Written by Shantanu Goel (goel@cs.columbia.edu). */
#include <mach/mach_types.h>
+#if !KERNEL || OSKIT_MACH
+#include <string.h>
+#endif
#include "boot_script.h"
@@ -30,8 +33,8 @@ struct sym
/* Additional values symbols can take.
These are only used internally. */
-#define VAL_SYM 3 /* symbol table entry */
-#define VAL_FUNC 4 /* function pointer */
+#define VAL_SYM 10 /* symbol table entry */
+#define VAL_FUNC 11 /* function pointer */
/* This structure describes an argument. */
struct arg
@@ -90,7 +93,7 @@ prompt_resume_task (struct cmd *cmd, int *val)
/* List of builtin symbols. */
static struct sym builtin_symbols[] =
{
- { "task-create", VAL_FUNC, (int) create_task, VAL_PORT, 0 },
+ { "task-create", VAL_FUNC, (int) create_task, VAL_TASK, 0 },
{ "task-resume", VAL_FUNC, (int) resume_task, VAL_NONE, 1 },
{ "prompt-task-resume", VAL_FUNC, (int) prompt_resume_task, VAL_NONE, 1 },
};
@@ -543,6 +546,7 @@ boot_script_exec ()
{
char *p, buf[50];
int len;
+ mach_port_t name;
if (arg->type == VAL_SYM)
{
@@ -568,14 +572,21 @@ boot_script_exec ()
len = strlen (p);
break;
+ case VAL_TASK:
case VAL_PORT:
- /* Insert send right. */
- error = boot_script_insert_right (cmd,
- (mach_port_t) arg->val);
+ if (arg->type == VAL_TASK)
+ /* Insert send right to task port. */
+ error = boot_script_insert_task_port
+ (cmd, (task_t) arg->val, &name);
+ else
+ /* Insert send right. */
+ error = boot_script_insert_right (cmd,
+ (mach_port_t) arg->val,
+ &name);
if (error)
goto done;
- i = arg->val;
+ i = name;
p = buf + sizeof (buf);
len = 0;
do
diff --git a/boot/boot_script.h b/boot/boot_script.h
index 5695328e..c436ac21 100644
--- a/boot/boot_script.h
+++ b/boot/boot_script.h
@@ -21,6 +21,7 @@
#define VAL_NONE 0 /* none -- function runs at exec time */
#define VAL_STR 1 /* string */
#define VAL_PORT 2 /* port */
+#define VAL_TASK 3 /* task port */
/* This structure describes a command. */
struct cmd
@@ -77,7 +78,8 @@ mach_port_t boot_script_read_file (const char *file);
int boot_script_task_create (struct cmd *); /* task_create + task_suspend */
int boot_script_task_resume (struct cmd *);
int boot_script_prompt_task_resume (struct cmd *);
-int boot_script_insert_right (struct cmd *, mach_port_t); /* same name */
+int boot_script_insert_right (struct cmd *, mach_port_t, mach_port_t *namep);
+int boot_script_insert_task_port (struct cmd *, task_t, mach_port_t *namep);
/* The user must define this function to clean up the `task_t'
returned by boot_script_task_create. */
diff --git a/boot/userland-boot.c b/boot/userland-boot.c
index b6f38290..c053b2b8 100644
--- a/boot/userland-boot.c
+++ b/boot/userland-boot.c
@@ -25,13 +25,13 @@
#include "boot_script.h"
void *
-boot_script_malloc (size_t size)
+boot_script_malloc (unsigned int size)
{
return malloc (size);
}
void
-boot_script_free (void *ptr, size_t size)
+boot_script_free (void *ptr, unsigned int size)
{
free (ptr);
}
@@ -82,7 +82,7 @@ boot_script_free_task (task_t task, int aborting)
}
int
-boot_script_insert_right (struct cmd *cmd , mach_port_t port)
+boot_script_insert_right (struct cmd *cmd, mach_port_t port, mach_port_t *name)
{
error_t err = mach_port_insert_right (cmd->task,
port, port, MACH_MSG_TYPE_COPY_SEND);
@@ -91,5 +91,12 @@ boot_script_insert_right (struct cmd *cmd , mach_port_t port)
error (0, err, "%s: task_resume", cmd->path);
return BOOT_SCRIPT_MACH_ERROR;
}
+ *name = port;
return 0;
}
+
+int
+boot_script_insert_task_port (struct cmd *cmd, task_t task, mach_port_t *name)
+{
+ return boot_script_insert_right (cmd, task, name);
+}