From 4c274cef7425614e328eb2127362d36b203543a8 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 15 Sep 2010 16:15:07 -0400 Subject: Simplify boot loader by removing some JOS'isms --- bootmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bootmain.c') diff --git a/bootmain.c b/bootmain.c index 14f4ff3..f67f8fa 100644 --- a/bootmain.c +++ b/bootmain.c @@ -34,7 +34,7 @@ bootmain(void) ph = (struct proghdr*)((uchar*)elf + elf->phoff); eph = ph + elf->phnum; for(; ph < eph; ph++) { - va = (uchar*)(ph->va & 0xFFFFFF); + va = (uchar*)ph->va; readseg(va, ph->filesz, ph->offset); if(ph->memsz > ph->filesz) stosb(va + ph->filesz, 0, ph->memsz - ph->filesz); @@ -42,7 +42,7 @@ bootmain(void) // Call the entry point from the ELF header. // Does not return! - entry = (void(*)(void))(elf->entry & 0xFFFFFF); + entry = (void(*)(void))(elf->entry); entry(); } -- cgit v1.2.3 From 1a81e38b17144624415d252a521fd5a06079d681 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 11 Jan 2011 13:01:13 -0500 Subject: make new code like old code Variable declarations at top of function, separate from initialization. Use == 0 instead of ! for checking pointers. Consistent spacing around {, *, casts. Declare 0-parameter functions as (void) not (). Integer valued functions return -1 on failure, 0 on success. --- bootmain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bootmain.c') diff --git a/bootmain.c b/bootmain.c index f67f8fa..7cd469f 100644 --- a/bootmain.c +++ b/bootmain.c @@ -33,7 +33,7 @@ bootmain(void) // Load each program segment (ignores ph flags). ph = (struct proghdr*)((uchar*)elf + elf->phoff); eph = ph + elf->phnum; - for(; ph < eph; ph++) { + for(; ph < eph; ph++){ va = (uchar*)ph->va; readseg(va, ph->filesz, ph->offset); if(ph->memsz > ph->filesz) -- cgit v1.2.3