Switch back bpmain back to main

This commit is contained in:
Frans Kaashoek 2018-10-03 17:58:21 -04:00
parent 020fc6a1c6
commit 23a58370a4
2 changed files with 8 additions and 8 deletions

View file

@ -84,8 +84,8 @@ start64:
# Clear frame pointer for stack walks # Clear frame pointer for stack walks
movl $0, %ebp movl $0, %ebp
# Call into C code. # Call into C code.
call bpmain call main
# should not return from bpmain # should not return from main
jmp . jmp .
.code32 .code32

12
main.c
View file

@ -9,7 +9,7 @@
extern pde_t *kpgdir; extern pde_t *kpgdir;
extern char end[]; // first address after kernel loaded from ELF file extern char end[]; // first address after kernel loaded from ELF file
static void main(void) __attribute__((noreturn)); static void mpmain(void) __attribute__((noreturn));
static void startothers(void); static void startothers(void);
@ -17,7 +17,7 @@ static void startothers(void);
// Allocate a real stack and switch to it, first // Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work. // doing some setup required for memory allocator to work.
int int
bpmain(uint64 mbmagic, uint64 mbaddr) main(uint64 mbmagic, uint64 mbaddr)
{ {
if(mbmagic != 0x2badb002) if(mbmagic != 0x2badb002)
panic("multiboot header not found"); panic("multiboot header not found");
@ -41,13 +41,13 @@ bpmain(uint64 mbmagic, uint64 mbaddr)
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
userinit(); // first user process userinit(); // first user process
main(); mpmain();
return 0; return 0;
} }
// Common CPU setup code. // Common CPU setup code.
static void static void
main(void) mpmain(void)
{ {
cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); cprintf("cpu%d: starting %d\n", cpuid(), cpuid());
idtinit(); // load idt register idtinit(); // load idt register
@ -55,14 +55,14 @@ main(void)
scheduler(); // start running processes scheduler(); // start running processes
} }
// Other CPUs jump here from entryother.S. // AP processors jump here from entryother.S.
void void
apmain(void) apmain(void)
{ {
switchkvm(); switchkvm();
seginit(); seginit();
lapicinit(); lapicinit();
main(); mpmain();
} }
void apstart(void); void apstart(void);