EFI: stub functions so we can call loader's main() function.
This commit is contained in:
@@ -419,7 +419,7 @@ rule KernelArchitectureSetup architecture
|
||||
-maccumulate-outgoing-args -Wno-error=unused-variable ;
|
||||
HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar -mno-red-zone
|
||||
-maccumulate-outgoing-args -Wno-error=unused-variable ;
|
||||
HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib -znocombreloc -nostartfiles ;
|
||||
HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib -znocombreloc -nostartfiles -no-undefined ;
|
||||
} else {
|
||||
HAIKU_BOOT_CCFLAGS += -fno-pic ;
|
||||
HAIKU_BOOT_C++FLAGS += -fno-pic ;
|
||||
|
||||
@@ -20,6 +20,12 @@ local platform_src =
|
||||
relocation_func.cpp
|
||||
start.cpp
|
||||
console.cpp
|
||||
video.cpp
|
||||
debug.cpp
|
||||
mmu.cpp
|
||||
heap.cpp
|
||||
menu.cpp
|
||||
devices.cpp
|
||||
;
|
||||
|
||||
Includes [ FGristFiles $(efi_glue_src) $(platform_src) ]
|
||||
@@ -36,6 +42,9 @@ BootMergeObject boot_platform_efi.o :
|
||||
: boot_platform_generic.a
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles relocation_func.cpp ] = [ FDirName $(SUBDIR) arch $(TARGET_ARCH) ] ;
|
||||
LOCATE on [ FGristFiles $(efi_glue_src) ] = [ BuildFeatureAttribute gnuefi : libdir : path ] ;
|
||||
Depends [ FGristFiles $(efi_glue_src) ] : [ BuildFeatureAttribute gnuefi : libdir ] ;
|
||||
SEARCH on [ FGristFiles relocation_func.cpp ]
|
||||
= [ FDirName $(SUBDIR) arch $(TARGET_ARCH) ] ;
|
||||
LOCATE on [ FGristFiles $(efi_glue_src) ]
|
||||
= [ BuildFeatureAttribute gnuefi : libdir : path ] ;
|
||||
Depends [ FGristFiles $(efi_glue_src) ]
|
||||
: [ BuildFeatureAttribute gnuefi : libdir ] ;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014-2016 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2013 Fredrik Holmqvist, [email protected]. All rights reserved.
|
||||
* Copyright 2013 Fredrik Holmqvist, [email protected]. All rights
|
||||
* reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -22,8 +23,10 @@ class Console : public ConsoleNode {
|
||||
public:
|
||||
Console();
|
||||
|
||||
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
|
||||
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
|
||||
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer,
|
||||
size_t bufferSize);
|
||||
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer,
|
||||
size_t bufferSize);
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +54,8 @@ Console::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
|
||||
|
||||
|
||||
ssize_t
|
||||
Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t bufferSize)
|
||||
Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer,
|
||||
size_t bufferSize)
|
||||
{
|
||||
const char *string = (const char *)buffer;
|
||||
CHAR16 ucsBuffer[bufferSize + 3];
|
||||
@@ -67,7 +71,8 @@ Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t bufferS
|
||||
//Not sure if we should keep going or abort for 0.
|
||||
//Keep going was easy anyway.
|
||||
ucsBuffer[j] = 0;
|
||||
kSystemTable->ConOut->OutputString(kSystemTable->ConOut, ucsBuffer);
|
||||
kSystemTable->ConOut->OutputString(kSystemTable->ConOut,
|
||||
ucsBuffer);
|
||||
j = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2016 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/stdio.h>
|
||||
|
||||
#include "efi_platform.h"
|
||||
|
||||
|
||||
extern "C" void
|
||||
dprintf(const char *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
panic(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
platform_switch_to_text_mode();
|
||||
|
||||
puts("*** PANIC ***");
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
while (true)
|
||||
kBootServices->Stall(1000000);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
platform_debug_get_log_buffer(size_t *_size)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2016 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
|
||||
|
||||
status_t
|
||||
platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_add_block_devices(struct stage2_args *args, NodeList *devicesList)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *partitions, boot::Partition **_partition)
|
||||
{
|
||||
panic("platform_get_boot_partition not implemented");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_register_boot_device(Node *device)
|
||||
{
|
||||
panic("platform_register_boot_device not implemented");
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2016 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_release_heap(struct stage2_args *args, void *base)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
platform_init_heap(struct stage2_args *args, void **_base, void **_top)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2016 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/menu.h>
|
||||
#include <boot/platform/generic/text_menu.h>
|
||||
|
||||
#include "efi_platform.h"
|
||||
|
||||
|
||||
void
|
||||
platform_add_menus(Menu *menu)
|
||||
{
|
||||
// No platform specific menus
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
platform_update_menu_item(Menu *menu, MenuItem *item)
|
||||
{
|
||||
platform_generic_update_text_menu_item(menu, item);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
platform_run_menu(Menu *menu)
|
||||
{
|
||||
platform_generic_run_text_menu(menu);
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
|
||||
size_t bufferSize)
|
||||
{
|
||||
return platform_generic_get_user_input_text(menu, item, buffer,
|
||||
bufferSize);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
platform_allocate_region(void **_virtualAddress, size_t size, uint8 protection,
|
||||
bool exactAddress)
|
||||
{
|
||||
panic("platform_allocate_region not implemented");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
platform_free_region(void *address, size_t size)
|
||||
{
|
||||
panic("platform_free_region not implemented");
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/stdio.h>
|
||||
|
||||
#include "console.h"
|
||||
#include "efi_platform.h"
|
||||
@@ -30,6 +32,27 @@ call_ctors(void)
|
||||
}
|
||||
|
||||
|
||||
extern "C" uint32
|
||||
platform_boot_options()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_start_kernel(void)
|
||||
{
|
||||
panic("platform_start_kernel not implemented");
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_exit(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* efi_main - The entry point for the EFI application
|
||||
* @image: firmware-allocated handle that identifies the image
|
||||
@@ -38,16 +61,19 @@ call_ctors(void)
|
||||
extern "C" EFI_STATUS
|
||||
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
|
||||
{
|
||||
stage2_args args;
|
||||
|
||||
kSystemTable = systemTable;
|
||||
kBootServices = systemTable->BootServices;
|
||||
kRuntimeServices = systemTable->RuntimeServices;
|
||||
|
||||
memset(&args, 0, sizeof(stage2_args));
|
||||
|
||||
call_ctors();
|
||||
|
||||
console_init();
|
||||
|
||||
printf("Hello from EFI Loader for Haiku!\nPress any key to continue...\n");
|
||||
console_wait_for_key();
|
||||
main(&args);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2016, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/platform/generic/video.h>
|
||||
|
||||
#include "efi_platform.h"
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
platform_init_video(void)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_switch_to_logo(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_blit4(addr_t frameBuffer, const uint8 *data,
|
||||
uint16 width, uint16 height, uint16 imageWidth,
|
||||
uint16 left, uint16 top)
|
||||
{
|
||||
panic("platform_blit4 unsupported");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_set_palette(const uint8 *palette)
|
||||
{
|
||||
panic("platform_set_palette unsupported");
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user