示例#1
0
/**
 * Kernel entry point
 */
void kmain(struct multiboot_info* info, unsigned int magic) {

    initMemoryMap(info);
    mm_pagination_init();

    setupGDT();
    setupIDT();
    
    stdin = STACK_TOP_MAPPING;
    stdout = (STACK_TOP_MAPPING + sizeof(FILE));
    stderr = (STACK_TOP_MAPPING + 2 * sizeof(FILE));

    cache_init();
    ata_init(info);
    fs_load();
    fifo_init();
    scheduler_init();

    struct Process* idleProcess = process_table_new(idle, "idle", NULL, 1, NO_TERMINAL, 0);
    struct Process* shellProcess = process_table_new(tty_run, "tty", idleProcess, 1, NO_TERMINAL, 0);
    struct Process* cacheProcess = process_table_new(cache_flush, "cache_flush",idleProcess, 1, NO_TERMINAL, 0);
    yield();

    while (1) {}
}
示例#2
0
/**
 * Runs a new process.
 *
 * @param entrypoint, the entrypoint of the new process.
 * @param args, the arguments that the new process receives.
 * @param active, if the process runs on foreground.
 * @return the process id of the new process.
 */
pid_t _run(EntryPoint entryPoint, char* args, int active) {
    struct Process* parent = scheduler_current();
    struct Process* p = process_table_new(entryPoint, args, parent, 0, parent->terminal, active);
    return p->pid;
}