boot/efi: add stubs for x86
Change-Id: I8d3dfa7cc07679a8b024df24f7cddb3a5bcec02c Reviewed-on: https://review.haiku-os.org/c/haiku/+/4747 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
parent
9a7f2c2459
commit
01cb3ed58e
31
src/system/boot/platform/efi/arch/x86/Jamfile
Normal file
31
src/system/boot/platform/efi/arch/x86/Jamfile
Normal file
@ -0,0 +1,31 @@
|
||||
SubDir HAIKU_TOP src system boot platform efi arch x86 ;
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) src system boot platform efi ;
|
||||
|
||||
UsePrivateHeaders [ FDirName kernel platform ] ;
|
||||
UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
||||
|
||||
local platform ;
|
||||
for platform in [ MultiBootSubDirSetup efi ] {
|
||||
on $(platform) {
|
||||
{
|
||||
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
|
||||
defines = [ FDefines $(defines) ] ;
|
||||
SubDirCcFlags $(defines) ;
|
||||
SubDirC++Flags $(defines) -fno-rtti ;
|
||||
}
|
||||
|
||||
local arch_src =
|
||||
crt0-efi-$(TARGET_ARCH).S
|
||||
relocation_func.cpp
|
||||
arch_mmu.cpp
|
||||
arch_smp.cpp
|
||||
arch_start.cpp
|
||||
arch_timer.cpp
|
||||
;
|
||||
|
||||
BootMergeObject boot_platform_efi_x86.o :
|
||||
$(arch_src)
|
||||
;
|
||||
}
|
||||
}
|
11
src/system/boot/platform/efi/arch/x86/arch_mmu.cpp
Normal file
11
src/system/boot/platform/efi/arch/x86/arch_mmu.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Released under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
arch_mmu_init(void)
|
||||
{
|
||||
|
||||
}
|
38
src/system/boot/platform/efi/arch/x86/arch_smp.cpp
Normal file
38
src/system/boot/platform/efi/arch/x86/arch_smp.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Released under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_smp.h"
|
||||
|
||||
|
||||
int
|
||||
arch_smp_get_current_cpu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_init_other_cpus(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_boot_other_cpus(uint32 pml4, uint64 kernel_entry)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_add_safemode_menus(Menu *menu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_init(void)
|
||||
{
|
||||
}
|
25
src/system/boot/platform/efi/arch/x86/arch_start.cpp
Normal file
25
src/system/boot/platform/efi/arch/x86/arch_start.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Released under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
|
||||
#include "mmu.h"
|
||||
|
||||
|
||||
void
|
||||
arch_convert_kernel_args(void)
|
||||
{
|
||||
fix_address(gKernelArgs.ucode_data);
|
||||
fix_address(gKernelArgs.arch_args.apic);
|
||||
fix_address(gKernelArgs.arch_args.hpet);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_start_kernel(addr_t kernelEntry)
|
||||
{
|
||||
}
|
13
src/system/boot/platform/efi/arch/x86/arch_timer.cpp
Normal file
13
src/system/boot/platform/efi/arch/x86/arch_timer.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Released under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_timer.h"
|
||||
|
||||
|
||||
void
|
||||
arch_timer_init(void)
|
||||
{
|
||||
}
|
101
src/system/boot/platform/efi/arch/x86/relocation_func.cpp
Normal file
101
src/system/boot/platform/efi/arch/x86/relocation_func.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/* reloc_ia32.c - position independent x86 ELF shared object relocator
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/system-table.h>
|
||||
|
||||
#include <elf.h>
|
||||
|
||||
|
||||
extern "C" efi_status _relocate (long ldbase, Elf32_Dyn *dyn,
|
||||
efi_handle image __attribute__((__unused__)),
|
||||
efi_system_table *systab __attribute__((__unused__)))
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
Elf32_Rel *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_REL:
|
||||
rel = (Elf32_Rel*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
|
||||
case DT_RELSZ:
|
||||
relsz = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
case DT_RELENT:
|
||||
relent = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
case DT_RELA:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rel && relent == 0)
|
||||
return EFI_SUCCESS;
|
||||
|
||||
if (!rel || relent == 0)
|
||||
return EFI_LOAD_ERROR;
|
||||
|
||||
while (relsz > 0) {
|
||||
/* apply the relocs */
|
||||
switch (ELF32_R_TYPE (rel->r_info)) {
|
||||
case R_386_NONE:
|
||||
break;
|
||||
|
||||
case R_386_RELATIVE:
|
||||
addr = (unsigned long *)
|
||||
(ldbase + rel->r_offset);
|
||||
*addr += ldbase;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rel = (Elf32_Rel*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user