+void
+unlock_reserved_memory();
+
+void
+__do_reserved_memory(int unlock);
+
+int
+mount_bootmedium()
+{
+ struct v_dnode* dnode;
+ int errno = 0;
+ struct device* dev = probe_boot_medium();
+ if (!dev) {
+ kprintf(KERROR "fail to acquire device. (%d)", errno);
+ return 0;
+ }
+
+ if ((errno = vfs_mount("/mnt/lunaix-os", "iso9660", dev, 0))) {
+ kprintf(KERROR "fail to mount boot medium. (%d)", errno);
+ return 0;
+ }
+
+ return 1;
+}
+
+int
+exec_initd()
+{
+ int errno = 0;
+ struct ld_param param;
+ char filename[] = "/mnt/lunaix-os/usr/init";
+
+ ld_create_param(¶m, __current, VMS_SELF);
+
+ if ((errno = exec_load_byname(¶m, filename, NULL, NULL))) {
+ goto fail;
+ }
+
+ // user space
+ asm volatile("movw %0, %%ax\n"
+ "movw %%ax, %%es\n"
+ "movw %%ax, %%ds\n"
+ "movw %%ax, %%fs\n"
+ "movw %%ax, %%gs\n"
+ "pushl %0\n"
+ "pushl %1\n"
+ "pushl %2\n"
+ "pushl %3\n"
+ "retf" ::"i"(UDATA_SEG),
+ "r"(param.info.stack_top),
+ "i"(UCODE_SEG),
+ "r"(param.info.entry)
+ : "eax", "memory");
+
+ fail("should not reach");
+
+fail:
+ kprintf(KERROR "fail to load initd. (%d)", errno);
+ return 0;
+}
+