Newer
Older
#include "param.h"
#include "mmu.h"
#include "proc.h"
#include "x86.h"
static void mpmain(void) __attribute__((noreturn));
mpinit(); // collect info about this machine
lapicinit(mpbcpu());
ksegment();
picinit(); // interrupt controller
ioapicinit(); // another interrupt controller
consoleinit(); // I/O devices & their interrupts
uartinit(); // serial port
pminit(); // physical memory for kernel
jkstack(); // Jump to mainc on a proper-allocated kernel stack
}
void
mainc(void)
{
cprintf("cpus %p cpu %p\n", cpus, cpu);
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
vminit(); // virtual memory
cprintf("ismp: %d\n", ismp);
// bootothers(); // start other processors XXX fix where to boot from
if(cpunum() != mpbcpu()) {
ksegment();
cprintf("other cpu\n");
vminit();
bootothers(void)
{
extern uchar _binary_bootother_start[], _binary_bootother_size[];
uchar *code;
struct cpu *c;
// Write bootstrap code to unused memory at 0x7000.
code = (uchar*)0x7000;
memmove(code, _binary_bootother_start, (uint)_binary_bootother_size);
for(c = cpus; c < cpus+ncpu; c++){
cprintf("lapicstartap\n");
cprintf("lapicstartap done\n");
// Wait for cpu to get through bootstrap.
while(c->booted == 0)
;
cprintf("lapicstartap booted\n");