void reios_boot() { //setup syscalls //find boot file //boot it memset(GetMemPtr(0x8C000000, 0), 0xFF, 64 * 1024); setup_syscall(hook_addr(&reios_sys_system), dc_bios_syscall_system); setup_syscall(hook_addr(&reios_sys_font), dc_bios_syscall_font); setup_syscall(hook_addr(&reios_sys_flashrom), dc_bios_syscall_flashrom); setup_syscall(hook_addr(&reios_sys_gd), dc_bios_syscall_gd); setup_syscall(hook_addr(&reios_sys_misc), dc_bios_syscall_misc); WriteMem32(dc_bios_entrypoint_gd_do_bioscall, REIOS_OPCODE); //Infinitive loop for arm ! WriteMem32(0x80800000, 0xEAFFFFFE); if (settings.reios.ElfFile.size()) { if (!reios_loadElf(settings.reios.ElfFile)) { msgboxf("Failed to open %s\n", MBX_ICONERROR, settings.reios.ElfFile.c_str()); } reios_setup_state(0x8C010000); } else { const char* bootfile = reios_locate_ip(); if (!bootfile || !reios_locate_bootfile(bootfile)) msgboxf("Failed to locate bootfile", MBX_ICONERROR); reios_setup_state(0xac008300); } }
static void reios_boot(void) { printf("-----------------\n"); printf("REIOS: Booting up\n"); printf("-----------------\n"); //setup syscalls //find boot file //boot it memset(GetMemPtr(0x8C000000, 0), 0xFF, 64 * 1024); setup_syscall(hook_addr(&reios_sys_system), dc_bios_syscall_system); setup_syscall(hook_addr(&reios_sys_font), dc_bios_syscall_font); setup_syscall(hook_addr(&reios_sys_flashrom), dc_bios_syscall_flashrom); setup_syscall(hook_addr(&reios_sys_gd), dc_bios_syscall_gd); setup_syscall(hook_addr(&reios_sys_misc), dc_bios_syscall_misc); WriteMem32(dc_bios_entrypoint_gd_do_bioscall, REIOS_OPCODE); //Infinitive loop for arm ! WriteMem32(0x80800000, 0xEAFFFFFE); if (settings.reios.ElfFile.size()) { if (!reios_loadElf(settings.reios.ElfFile)) msgboxf("Failed to open %s\n", MBX_ICONERROR, settings.reios.ElfFile.c_str()); reios_setup_state(0x8C010000); } else { if (DC_PLATFORM == DC_PLATFORM_DREAMCAST) { if (!bootfile_inited) msgboxf("Failed to locate bootfile", MBX_ICONERROR); reios_setup_state(0xac008300); } else { verify(DC_PLATFORM == DC_PLATFORM_NAOMI); u32* sz = (u32*)naomi_cart_GetPtr(0x368, 4); if (!sz) { msgboxf("Naomi boot failure", MBX_ICONERROR); } int size = *sz; verify(size < RAM_SIZE && naomi_cart_GetPtr(size - 1, 1) && "Invalid cart size"); WriteMemBlock_nommu_ptr(0x0c020000, (u32*)naomi_cart_GetPtr(0, size), size); reios_setuo_naomi(0x0c021000); } } }
void vfs_init_syscalls(void) { setup_syscall(SYSCALL_OPEN, "open", &syscall_open); setup_syscall(SYSCALL_CLOSE, "close", &syscall_close); setup_syscall(SYSCALL_READ, "read", &syscall_read); setup_syscall(SYSCALL_WRITE, "write", &syscall_write); setup_syscall(SYSCALL_SEEK, "seek", &syscall_seek); setup_syscall(SYSCALL_CHDIR, "chdir", &syscall_chdir); setup_syscall(SYSCALL_GETCWD, "getcwd", &syscall_getcwd); setup_syscall(SYSCALL_READDIR, "readdir", &syscall_readdir); setup_syscall(SYSCALL_FSTAT, "fstat", &syscall_fstat); }
/* idt_init -----------------------------------------------------------------*/ void idt_init() { short i; /* set default interrupt handler ------------------------------------*/ for (i = 0 ; i < 256 ; i ++) { set_idt(i, (unsigned long)intr_default, SEL_K32_C, 0, GT_TRAP); } /* please wirte other file. */ #if 1 setup_trap(); setup_irq(); setup_syscall(); #endif }
void mm_init_syscalls(void) { setup_syscall(SYSCALL_MALLOC, "malloc", &syscall_malloc_pages); setup_syscall(SYSCALL_MFREE, "free", &syscall_mfree_pages); }