Example #1
0
int
main(int argc, char *argv[])
{
	START(argc, argv, "util_cpuid");

	check_cpu_features();

	DONE(NULL);
}
Example #2
0
/**
 * Get the system going.
 *
 * Prepare all system-specific structures and initialise BP and APs. Enter root domain and continue there.
 *
 * TODO: relate Pistachio SMP startup routines here.
 */
extern "C" void kernel_startup()
{
    // No dynamic memory allocation here yet, global objects not constructed either.
    run_global_ctors();

    global_descriptor_table_t gdt;
    kconsole << "Created GDT." << endl;
    interrupt_descriptor_table_t::instance().install();
    kconsole << "Created IDT." << endl;

    // Grab the bootinfo page and discover where is our bootimage.
    bootinfo_t* bi = new(bootinfo_t::ADDRESS) bootinfo_t;

    address_t start, end;
    const char* name;
    if (!bi->get_module(1, start, end, name))
    {
        PANIC("Bootimage not found!");
    }

    bootimage_t bootimage(name, start, end);

    parse_cmdline(bi);
    prepare_infopage(); // <-- init domain info page
    check_cpu_features(); // cmdline might affect used CPU feats? (i.e. noacpi flag)
    
    // TODO: CREATE INITIAL MEMORY MAPPINGS PROPERLY HERE
    // TEMPORARY: just map all mem 0..min(16Mb, RAMtop) to 1-1 mapping? for simplicity
//    int ramtop = 16*MiB;
    bi->append_vmap(0, 0, 16*MiB);//min(16*MiB, ramtop));

    timer_v1::closure_t* timer = init_timer();
    timer->enable(0); // enable timer interrupts
    kconsole << "Timer interrupt enabled." << endl;
    x86_cpu_t::enable_fpu();
    kconsole << "FPU enabled." << endl;

//    kconsole << WHITE << "...in the living memory of V2_OS" << LIGHTGRAY << endl;

    root_domain_t root_dom(bootimage);

//     kconsole << "+ root_domain entry @ 0x" << root_dom.entry() << endl;

    // Create an execution context and activate it.
    continuation_t::gpregs_t gpregs;
    gpregs.esp = read_stack_pointer();
    gpregs.eax = 0;
    gpregs.ebx = 0;
    gpregs.eflags = 0x03002; /* Flags for root domain: interrupts disabled, IOPL=3 (program can use IO ports) */
    new_context.set_gpregs(gpregs);
    new_context.set_entry(root_dom.entry());//FIXME: depends on gpregs being set before this call!
    new_context.activate(); // we have a liftoff!

    /* Never reached */
    PANIC("root domain returned!");
}
Example #3
0
extern "C" void
cpu_init()
{
	if (check_cpu_features() != B_OK)
		panic("You need a 68030 or higher in order to boot!\n");

	gKernelArgs.num_cpus = 1;
		// this will eventually be corrected later on
		// ...or not!
}