Example #1
0
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*/
}
Example #2
0
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*/
}