2 #include "../port/lib.h"
11 extern void checkmtrr(void);
16 // iprint("Hello Squidboy\n");
36 active.machs |= 1<<m->machno;
39 while(!active.thunderbirdsarego)
48 ulong *apbootp, *pdb, *pte;
56 * Initialise the AP page-tables and Mach structure. The page-tables
57 * are the same as for the bootstrap processor with the exception of
58 * the PTE for the Mach structure.
59 * Xspanalloc will panic if an allocation can't be made.
61 p = xspanalloc(4*BY2PG, BY2PG, 0);
63 memmove(pdb, mach0->pdb, BY2PG);
66 if((pte = mmuwalk(pdb, MACHADDR, 1, 0)) == nil)
68 memmove(p, KADDR(PPN(*pte)), BY2PG);
69 *pte = PADDR(p)|PTEWRITE|PTEVALID;
75 if((pte = mmuwalk(pdb, MACHADDR, 2, 0)) == nil)
77 *pte = PADDR(mach)|PTEWRITE|PTEVALID;
82 machno = apic->machno;
84 mach->machno = machno;
86 mach->gdt = (Segdesc*)p; /* filled by mmuinit */
89 * Tell the AP where its kernel vector and pdb are.
90 * The offsets are known in the AP bootstrap code.
92 apbootp = (ulong*)(APBOOTSTRAP+0x08);
93 *apbootp++ = (ulong)squidboy; /* assembler jumps here eventually */
94 *apbootp++ = PADDR(pdb);
95 *apbootp = (ulong)apic;
98 * Universal Startup Algorithm.
100 p = KADDR(0x467); /* warm-reset vector */
101 *p++ = PADDR(APBOOTSTRAP);
102 *p++ = PADDR(APBOOTSTRAP)>>8;
103 i = (PADDR(APBOOTSTRAP) & ~0xFFFF)/16;
104 /* code assumes i==0 */
106 print("mp: bad APBOOTSTRAP\n");
111 nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
112 lapicstartap(apic, PADDR(APBOOTSTRAP));
113 for(i = 0; i < 1000; i++){
118 nvramwrite(0x0F, 0x00);