diff options
author | Roland McGrath <roland@gnu.org> | 1995-08-23 20:20:45 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-08-23 20:20:45 +0000 |
commit | 8dd7c5b3abea4280e70c938a4d458039f284f231 (patch) | |
tree | 2a7c3c54d1665d075f425dd66ea4de8c2c7799a3 /boot/boot_script.h | |
parent | 8e6ab400ea7f7dd58d0eed9f4d03d63964b256e7 (diff) |
Initial revision
Diffstat (limited to 'boot/boot_script.h')
-rw-r--r-- | boot/boot_script.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/boot/boot_script.h b/boot/boot_script.h new file mode 100644 index 00000000..88a6bf49 --- /dev/null +++ b/boot/boot_script.h @@ -0,0 +1,91 @@ +/* Error codes returned by boot_script_parse_line() + and boot_script_exec_cmd(). */ +#define BOOT_SCRIPT_NOMEM 1 +#define BOOT_SCRIPT_SYNTAX_ERROR 2 +#define BOOT_SCRIPT_INVALID_ASG 3 +#define BOOT_SCRIPT_MACH_ERROR 4 +#define BOOT_SCRIPT_UNDEF_SYM 5 +#define BOOT_SCRIPT_EXEC_ERROR 6 + +/* The user must define this variable. The root device name. + This must be initialized prior to calling the parser. */ +extern char *boot_script_root_device; + +/* The user must define this variable. The task port of the program. */ +extern mach_port_t boot_script_task_port; + +/* The user must define this variable. Send right to the host port. */ +extern mach_port_t boot_script_host_port; + +/* The user must define this variable. Send right to the + master device port. */ +extern mach_port_t boot_script_device_port; + +/* The user must define this variable. Send right to the + the bootstrap port. */ +extern mach_port_t boot_script_bootstrap_port; + +/* The user must define this function. Allocate SIZE bytes of memory + and return a pointer to it. */ +void *boot_script_malloc (int size); + +/* The user must define this function. Free SIZE bytes of memory + named by PTR that was previously allocated by boot_script_malloc(). */ +void boot_script_free (void *ptr, int size); + +/* The user must define this function. Create a new task and + return a send right to it presumably using task_create(). + Return 0 on error. */ +mach_port_t boot_script_task_create (void); + +/* The user must define this function. Terminate the task whose + send right is TASK presumably using task_terminate(). */ +void boot_script_task_terminate (mach_port_t task); + +/* The user must define this function. Suspend TASK presumably + using task_suspend(). */ +void boot_script_task_suspend (mach_port_t task); + +/* The user must define this function. Resume TASK presumably + using task_resume(). Return 0 on success, non-zero otherwise. */ +int boot_script_task_resume (mach_port_t task); + +/* The user must define this function. Deallocate a send right to PORT + in the TASK presumably using mach_port_deallocate(). */ +void boot_script_port_deallocate (mach_port_t task, mach_port_t port); + +/* The user must define this function. Insert the specified RIGHT to + the PORT in the current task into TASK with NAME, presumably using + mach_port_insert_right(). RIGHT can take any value allowed by + mach_port_insert_right(). Return 0 for success, non-zero otherwise. */ +int boot_script_port_insert_right (mach_port_t task, + mach_port_t name, mach_port_t port, + mach_msg_type_name_t right); + +/* The user must define this function. Set the bootstrap port for TASK. */ +void boot_script_set_bootstrap_port (mach_port_t task, mach_port_t port); + +/* The user must define this function. Load the image of the + executable specified by PATH in TASK. Create a thread + in TASK and point it at the executable's entry point. Initialize + TASK's stack with argument vector ARGV of length ARGC whose + strings are STRINGS. STRINGS has length STRINGLEN. + Return 0 for success, non-zero otherwise. */ +int boot_script_exec_cmd (mach_port_t task, char *path, int argc, + char **argv, char *strings, int stringlen); + +/* Parse the command line LINE. This causes the command line to be + converted into an internal format. Returns 0 for success, non-zero + otherwise. + + NOTE: The parser writes into the line so it must not be a string constant. + It is also the responsibility of the caller not to deallocate the line + across calls to the parser. */ +int boot_script_parse_line (char *cmdline); + +/* Execute the command lines prevously parsed. + Returns 0 for success, non-zero otherwise. */ +int boot_script_exec (void); + +/* Returns a string describing the error ERR. */ +char *boot_script_error_string (int err); |