@@ -26,26 +26,21 @@ extern "C" {
2626
2727static char temp_cmdline[1024 ];
2828static uintptr_t mem_size = 0 ;
29+ static uintptr_t free_mem_begin;
2930
3031extern " C"
3132void kernel_start ()
3233{
3334 // generate checksums of read-only areas etc.
3435 __init_sanity_checks ();
3536
36- // Determine where free memory starts
37- uintptr_t free_mem_begin = reinterpret_cast <uintptr_t >(&_end);
38-
3937 // Preserve symbols from the ELF binary
4038 free_mem_begin += _move_symbols (free_mem_begin);
4139
4240 // Do not zero out all solo5 global variables!! == don't touch the BSS
4341 // _init_bss();
4442
4543 // Initialize heap
46- // XXX: this is dangerous as solo5 might be doing malloc()'s using it's own
47- // idea of a heap. Luckily there is no malloc instance at solo5/kernel/[ukvm|virtio|muen],
48- // so might be OK (for now).
4944 OS::init_heap (free_mem_begin, mem_size);
5045
5146 _init_elf_parser ();
@@ -62,17 +57,15 @@ void kernel_start()
6257}
6358
6459extern " C"
65- int solo5_app_main (char * cmdline )
60+ int solo5_app_main (const struct solo5_start_info *si )
6661{
67- // cmdline is stored at 0x6000 by ukvm which is used by includeos. Move it fast.
68- strncpy (temp_cmdline, cmdline, sizeof (temp_cmdline)-1 );
69- temp_cmdline[sizeof (temp_cmdline)-1 ] = 0 ;
70-
71- // solo5 sets the stack to be at the end of memory, so let's use that as
72- // our memory size (before we change).
73- mem_size = (uintptr_t ) get_cpu_ebp ();
74-
75- // set the stack location to its new includeos location, and call kernel_start
76- set_stack ();
77- return 0 ;
62+ // si is stored at 0x6000 by ukvm which is used by includeos. Move it fast.
63+ strncpy (temp_cmdline, si->cmdline , sizeof (temp_cmdline)-1 );
64+ temp_cmdline[sizeof (temp_cmdline)-1 ] = 0 ;
65+ free_mem_begin = si->heap_start ;
66+ mem_size = si->heap_size ;
67+
68+ // set the stack location to its new includeos location, and call kernel_start
69+ set_stack ();
70+ return 0 ;
7871}
0 commit comments