Added the new files to the build, and implemented a real startup.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7240 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b2f8da6214
commit
3796dbef26
|
@ -3,10 +3,12 @@ SubDir OBOS_TOP src kernel boot platform bios_ia32 ;
|
|||
SubDirHdrs $(OBOS_TOP) headers private kernel boot platform $(OBOS_BOOT_PLATFORM) ;
|
||||
|
||||
KernelMergeObject boot_platform_bios_ia32.o :
|
||||
<$(SOURCE_GRIST)>shell.S
|
||||
<$(SOURCE_GRIST)>start.c
|
||||
<$(SOURCE_GRIST)>debug.c
|
||||
<$(SOURCE_GRIST)>bios.S
|
||||
<$(SOURCE_GRIST)>console.cpp
|
||||
<$(SOURCE_GRIST)>devices.cpp
|
||||
<$(SOURCE_GRIST)>mmu.cpp
|
||||
:
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles crt0.S ]
|
||||
= [ FDirName $(OBOS_TOP) src kernel boot arch $(OBOS_ARCH) ] ;
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include "console.h"
|
||||
#include "mmu.h"
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/heap.h>
|
||||
|
@ -11,26 +14,33 @@
|
|||
#include <string.h>
|
||||
|
||||
|
||||
#define HEAP_SIZE 32768
|
||||
|
||||
// GCC defined globals
|
||||
extern void (*__ctor_list)(void);
|
||||
extern void (*__ctor_end)(void);
|
||||
extern uint8 __bss_start;
|
||||
extern uint8 _end;
|
||||
|
||||
extern int main(stage2_args *args);
|
||||
void _start(void);
|
||||
|
||||
|
||||
int32 stdin, stdout;
|
||||
// only needed for linking, must be derived from the (abstract) ConsoleNode class
|
||||
|
||||
|
||||
// dummy implementations
|
||||
|
||||
|
||||
void
|
||||
panic(const char *format, ...)
|
||||
static void
|
||||
clear_bss(void)
|
||||
{
|
||||
memset(&__bss_start, 0, &_end - &__bss_start);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dprintf(const char *format, ...)
|
||||
{
|
||||
static void
|
||||
call_ctors(void)
|
||||
{
|
||||
void (**f)(void);
|
||||
|
||||
for (f = &__ctor_list; f < &__ctor_end; f++) {
|
||||
(**f)();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,6 +54,7 @@ platform_user_menu_requested(void)
|
|||
status_t
|
||||
platform_allocate_region(void **_address, size_t size, uint8 protection)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
@ -51,6 +62,7 @@ platform_allocate_region(void **_address, size_t size, uint8 protection)
|
|||
status_t
|
||||
platform_free_region(void *address, size_t size)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
@ -58,18 +70,41 @@ platform_free_region(void *address, size_t size)
|
|||
void
|
||||
platform_release_heap(struct stage2_args *args, void *base)
|
||||
{
|
||||
mmu_free(base, args->heap_size);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_init_heap(struct stage2_args *args, void **_base, void **_top)
|
||||
{
|
||||
void *heap = mmu_allocate(NULL, args->heap_size);
|
||||
if (heap == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
*_base = heap;
|
||||
*_top = (void *)((int8 *)heap + args->heap_size);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_start(void)
|
||||
{
|
||||
main(NULL);
|
||||
stage2_args args;
|
||||
|
||||
asm("cld"); // Ain't nothing but a GCC thang.
|
||||
asm("fninit"); // initialize floating point unit
|
||||
|
||||
clear_bss();
|
||||
|
||||
call_ctors();
|
||||
// call C++ constructors before doing anything else
|
||||
|
||||
args.heap_size = HEAP_SIZE;
|
||||
|
||||
console_init();
|
||||
mmu_init();
|
||||
|
||||
main(&args);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue