static void user_bootstrap_compat(void) { exec_info_t boot_exec_info; char host_string[12]; char device_string[12]; char flag_string[1024]; char root_string[1024]; /* * Copy the bootstrap code from boot_exec into the user task. */ copy_bootstrap(current_thread()->saved.other, &boot_exec_info); /* * Convert the host and device ports to strings, * to put in the argument list. */ itoa(host_string, boot_host_port); itoa(device_string, boot_device_port); /* * Get the (compatibility) boot flags and root name strings. */ get_compat_strings(flag_string, root_string); /* * Build the argument list and insert in the user task. * Argument list is * "bootstrap -<boothowto> <host_port> <device_port> <root_name>" $0 ${boot-args} ${host-port} ${device-port} ${root-device} $(task-create) $(task-resume) */ { char *argv[] = { "bootstrap", flag_string, host_string, device_string, root_string, 0 }; char *envp[] = { 0, 0 }; if (kernel_cmdline[0] != '\0') { static const char cmdline_var[] = "MULTIBOOT_CMDLINE="; envp[0] = alloca (sizeof cmdline_var + strlen (kernel_cmdline)); memcpy (envp[0], cmdline_var, sizeof cmdline_var - 1); strcpy (envp[0] + sizeof cmdline_var - 1, kernel_cmdline); } build_args_and_stack(&boot_exec_info, argv, envp); } /* * Exit to user thread. */ thread_bootstrap_return(); /*NOTREACHED*/ }
static void user_bootstrap() { struct exec_info boot_exec_info; char host_string[12]; char device_string[12]; char flag_string[12]; char root_string[12]; /* * Copy the bootstrap code from boot_exec into the user task. */ copy_bootstrap(boot_exec, &boot_exec_info); /* * Convert the host and device ports to strings, * to put in the argument list. */ itoa(host_string, boot_host_port); itoa(device_string, boot_device_port); /* * Get the (compatibility) boot flags and root name strings. */ get_compat_strings(flag_string, root_string); /* * Build the argument list and insert in the user task. * Argument list is * "bootstrap -<boothowto> <host_port> <device_port> <root_name>" */ build_args_and_stack(&boot_exec_info, "bootstrap", flag_string, host_string, device_string, root_string, (char *)0); printf("Starting bootstrap at %x\n", boot_exec_info.entry); /* * Exit to user thread. */ thread_bootstrap_return(); /*NOTREACHED*/ }
static void user_bootstrap(void) { struct user_bootstrap_info *info = current_thread()->saved.other; exec_info_t boot_exec_info; int err; char **av; /* 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) panic ("Cannot load user executable module (error code %d): %s", err, info->argv[0]); printf ("task loaded:"); /* Set up the stack with arguments. */ build_args_and_stack(&boot_exec_info, info->argv, 0); for (av = info->argv; *av != 0; ++av) printf (" %s", *av); task_suspend (current_task()); /* Tell the bootstrap thread running boot_script_exec_cmd that we are done looking at INFO. */ simple_lock (&info->lock); assert (!info->done); info->done = 1; thread_wakeup ((event_t) info); /* * Exit to user thread. */ thread_bootstrap_return(); /*NOTREACHED*/ }