Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80251
b: refs/heads/master
c: acd644b
h: refs/heads/master
i:
  80249: 5c337c2
  80247: 518336c
v: v3
  • Loading branch information
H. Peter Anvin authored and Ingo Molnar committed Jan 30, 2008
1 parent acf4d4a commit 257062b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a8514e04e3f0249a75f66225e99cdf48d305be7
refs/heads/master: acd644bb4abb4d9f0ba6b9ec2b356263971ef9d0
24 changes: 18 additions & 6 deletions trunk/arch/x86/boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,32 @@ static void set_bios_mode(void)
#endif
}

void main(void)
static void init_heap(void)
{
/* First, copy the boot header into the "zeropage" */
copy_boot_params();
char *stack_end;

/* End of heap check */
if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
heap_end = (char *)(boot_params.hdr.heap_end_ptr
+0x200-STACK_SIZE);
asm("leal %P1(%%esp),%0"
: "=r" (stack_end) : "i" (-STACK_SIZE));

heap_end = (char *)
((size_t)boot_params.hdr.heap_end_ptr + 0x200);
if (heap_end > stack_end)
heap_end = stack_end;
} else {
/* Boot protocol 2.00 only, no heap available */
puts("WARNING: Ancient bootloader, some functionality "
"may be limited!\n");
}
}

void main(void)
{
/* First, copy the boot header into the "zeropage" */
copy_boot_params();

/* End of heap check */
init_heap();

/* Make sure we have all the proper CPU support */
if (validate_cpu()) {
Expand Down

0 comments on commit 257062b

Please sign in to comment.