arm64: Add more random scripts to get stuff to compile
Signed-off-by: Jaroslaw Pelczar <[email protected]> Change-Id: Ie043af5b7471f626a1ffe100848151c832dcc439 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1853 Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
80f7396496
commit
cbdb30f467
@@ -422,6 +422,13 @@ rule KernelArchitectureSetup architecture
|
|||||||
-Wl,-z -Wl,max-page-size=0x1000
|
-Wl,-z -Wl,max-page-size=0x1000
|
||||||
-Wl,-z -Wl,common-page-size=0x1000 ;
|
-Wl,-z -Wl,common-page-size=0x1000 ;
|
||||||
|
|
||||||
|
case arm64 :
|
||||||
|
# Workaround for ld using 32k for alignment despite forcing it in the config...
|
||||||
|
# should definitely not be needed!
|
||||||
|
HAIKU_KERNEL_LINKFLAGS +=
|
||||||
|
-Wl,-z -Wl,max-page-size=0x1000
|
||||||
|
-Wl,-z -Wl,common-page-size=0x1000 ;
|
||||||
|
|
||||||
case ppc :
|
case ppc :
|
||||||
# Build a position independent PPC kernel. We need to be able to
|
# Build a position independent PPC kernel. We need to be able to
|
||||||
# relocate the kernel, since the virtual address space layout at
|
# relocate the kernel, since the virtual address space layout at
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch arm64 ;
|
||||||
|
|
||||||
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||||
|
|
||||||
|
UsePrivateHeaders kernel [ FDirName kernel arch arm64 ] ;
|
||||||
|
|
||||||
|
KernelStaticLibrary isa_arch_bus_manager :
|
||||||
|
isa_dma.c
|
||||||
|
isa_controller.c
|
||||||
|
;
|
||||||
|
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007 Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* arch-specific config manager
|
||||||
|
*
|
||||||
|
* Authors (in chronological order):
|
||||||
|
* François Revol ([email protected])
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
#include "ISA.h"
|
||||||
|
#include "arch_cpu.h"
|
||||||
|
#include "isa_arch.h"
|
||||||
|
|
||||||
|
//#define TRACE_ISA
|
||||||
|
#ifdef TRACE_ISA
|
||||||
|
# define TRACE(x) dprintf x
|
||||||
|
#else
|
||||||
|
# define TRACE(x) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
uint8
|
||||||
|
arch_isa_read_io_8(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
uint8 value = in8(mapped_io_addr);
|
||||||
|
|
||||||
|
TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_isa_write_io_8(int mapped_io_addr, uint8 value)
|
||||||
|
{
|
||||||
|
TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
|
||||||
|
|
||||||
|
out8(value, mapped_io_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16
|
||||||
|
arch_isa_read_io_16(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
return in16(mapped_io_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_isa_write_io_16(int mapped_io_addr, uint16 value)
|
||||||
|
{
|
||||||
|
out16(value, mapped_io_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32
|
||||||
|
arch_isa_read_io_32(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
return in32(mapped_io_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_isa_write_io_32(int mapped_io_addr, uint32 value)
|
||||||
|
{
|
||||||
|
out32(value, mapped_io_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
phys_addr_t
|
||||||
|
arch_isa_ram_address(phys_addr_t physical_address_in_system_memory)
|
||||||
|
{
|
||||||
|
// this is what the BeOS kernel does
|
||||||
|
return physical_address_in_system_memory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
arch_isa_init(void)
|
||||||
|
{
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007 Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* arch-specific config manager
|
||||||
|
*
|
||||||
|
* Authors (in chronological order):
|
||||||
|
* François Revol ([email protected])
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
#include "ISA.h"
|
||||||
|
#include "arch_cpu.h"
|
||||||
|
#include "isa_arch.h"
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
arch_start_isa_dma(long channel, void *buf, long transfer_count,
|
||||||
|
uchar mode, uchar e_mode)
|
||||||
|
{
|
||||||
|
// ToDo: implement this?!
|
||||||
|
return B_NOT_ALLOWED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons kernel bus_managers pci arch $(TARGET_ARCH) ;
|
||||||
|
|
||||||
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||||
|
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
|
||||||
|
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
|
||||||
|
|
||||||
|
KernelStaticLibrary pci_arch_bus_manager :
|
||||||
|
pci_controller.cpp
|
||||||
|
pci_io.c
|
||||||
|
;
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Haiku Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "pci_controller.h"
|
||||||
|
|
||||||
|
//#include <arch_platform.h>
|
||||||
|
|
||||||
|
#include "pci_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
pci_controller_init(void)
|
||||||
|
{
|
||||||
|
/* no support yet */
|
||||||
|
#warning ARM:WRITEME
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
phys_addr_t
|
||||||
|
pci_ram_address(phys_addr_t physical_address_in_system_memory)
|
||||||
|
{
|
||||||
|
return physical_address_in_system_memory;
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Haiku Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "pci_io.h"
|
||||||
|
#include "pci_private.h"
|
||||||
|
#warning ARM:WRITEME
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
pci_io_init()
|
||||||
|
{
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8
|
||||||
|
pci_read_io_8(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
pci_write_io_8(int mapped_io_addr, uint8 value)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16
|
||||||
|
pci_read_io_16(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
pci_write_io_16(int mapped_io_addr, uint16 value)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32
|
||||||
|
pci_read_io_32(int mapped_io_addr)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
pci_write_io_32(int mapped_io_addr, uint32 value)
|
||||||
|
{
|
||||||
|
/* NOT IMPLEMENTED */
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Haiku Inc.
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef PCI_BUS_MANAGER_ARM_IO_H
|
||||||
|
#define PCI_BUS_MANAGER_ARM_IO_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PCI_BUS_MANAGER_ARM_IO_H
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons kernel cpu arm64 ;
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <debug_support.h>
|
||||||
|
|
||||||
|
#include "arch_debug_support.h"
|
||||||
|
|
||||||
|
status_t
|
||||||
|
arch_debug_get_instruction_pointer(debug_context *context, thread_id thread,
|
||||||
|
void **ip, void **stackFrameAddress)
|
||||||
|
{
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
arch_debug_get_stack_frame(debug_context *context, void *stackFrameAddress,
|
||||||
|
debug_stack_frame_info *stackFrameInfo)
|
||||||
|
{
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
SubDir HAIKU_TOP src system boot arch arm64 ;
|
||||||
|
|
||||||
|
UseLibraryHeaders [ FDirName libfdt ] ;
|
||||||
|
UsePrivateHeaders [ FDirName kernel platform $(TARGET_BOOT_PLATFORM) ] ;
|
||||||
|
SubDirHdrs $(HAIKU_TOP) src add-ons kernel bus_managers fdt ;
|
||||||
|
|
||||||
|
# TODO: Is there any reason to recompile arch_string.S here?
|
||||||
|
local librootArchObjects =
|
||||||
|
# <src!system!libroot!posix!string!arch!$(TARGET_ARCH)>arch_string.o
|
||||||
|
arch_string.S
|
||||||
|
;
|
||||||
|
|
||||||
|
local kernelLibArchObjects =
|
||||||
|
<src!system!kernel!lib!arch!$(TARGET_ARCH)>byteorder.o
|
||||||
|
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
|
||||||
|
;
|
||||||
|
|
||||||
|
local platform ;
|
||||||
|
for platform in [ MultiBootSubDirSetup u-boot efi ] {
|
||||||
|
on $(platform) {
|
||||||
|
DEFINES += _BOOT_MODE ;
|
||||||
|
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
|
||||||
|
# Reuse a subset of kernel debugging.
|
||||||
|
$(librootArchObjects)
|
||||||
|
:
|
||||||
|
:
|
||||||
|
$(kernelLibArchObjects)
|
||||||
|
;
|
||||||
|
SEARCH on [ FGristFiles arch_elf.cpp $(kernelArchDriverSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(kernelGenericDriverSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system kernel arch generic ] ;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(librootArchObjects) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system libroot posix string arch $(TARGET_ARCH) ] ;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(kernelDebugSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system kernel debug ] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,3 +2,11 @@ SubDir HAIKU_TOP src system kernel arch arm64 ;
|
|||||||
|
|
||||||
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
|
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
|
||||||
UsePrivateKernelHeaders ;
|
UsePrivateKernelHeaders ;
|
||||||
|
|
||||||
|
KernelMergeObject kernel_arch_arm64.o :
|
||||||
|
arch_elf.cpp
|
||||||
|
|
||||||
|
:
|
||||||
|
$(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused
|
||||||
|
:
|
||||||
|
;
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2004-2018, Haiku Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Copyright 2002, Travis Geiselbrecht. All rights reserved.
|
||||||
|
* Distributed under the terms of the NewOS License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
# include <boot/arch.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
|
||||||
|
#include <elf_priv.h>
|
||||||
|
#include <arch/elf.h>
|
||||||
|
|
||||||
|
|
||||||
|
//#define TRACE_ARCH_ELF
|
||||||
|
#ifdef TRACE_ARCH_ELF
|
||||||
|
# define TRACE(x) dprintf x
|
||||||
|
#else
|
||||||
|
# define TRACE(x) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
|
static bool
|
||||||
|
is_in_image(struct elf_image_info *image, addr_t address)
|
||||||
|
{
|
||||||
|
return (address >= image->text_region.start
|
||||||
|
&& address < image->text_region.start + image->text_region.size)
|
||||||
|
|| (address >= image->data_region.start
|
||||||
|
&& address < image->data_region.start + image->data_region.size);
|
||||||
|
}
|
||||||
|
#endif // !_BOOT_MODE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
status_t
|
||||||
|
boot_arch_elf_relocate_rel(preloaded_elf64_image* image, Elf64_Rel* rel,
|
||||||
|
int relLength)
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
arch_elf_relocate_rel(struct elf_image_info *image,
|
||||||
|
struct elf_image_info *resolveImage, Elf64_Rel *rel, int relLength)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
dprintf("arch_elf_relocate_rel: not supported on arm64\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
status_t
|
||||||
|
boot_arch_elf_relocate_rela(preloaded_elf64_image* image, Elf64_Rela* rel,
|
||||||
|
int relLength)
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
arch_elf_relocate_rela(struct elf_image_info *image,
|
||||||
|
struct elf_image_info *resolveImage, Elf64_Rela *rel, int relLength)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
for (int i = 0; i < relLength / (int)sizeof(Elf64_Rela); i++) {
|
||||||
|
int type = ELF64_R_TYPE(rel[i].r_info);
|
||||||
|
int symIndex = ELF64_R_SYM(rel[i].r_info);
|
||||||
|
Elf64_Addr symAddr = 0;
|
||||||
|
|
||||||
|
// Resolve the symbol, if any.
|
||||||
|
if (symIndex != 0) {
|
||||||
|
Elf64_Sym* symbol = SYMBOL(image, symIndex);
|
||||||
|
|
||||||
|
status_t status;
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
status = boot_elf_resolve_symbol(image, symbol, &symAddr);
|
||||||
|
#else
|
||||||
|
status = elf_resolve_symbol(image, symbol, resolveImage, &symAddr);
|
||||||
|
#endif
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Address of the relocation.
|
||||||
|
Elf64_Addr relocAddr = image->text_region.delta + rel[i].r_offset;
|
||||||
|
|
||||||
|
// Calculate the relocation value.
|
||||||
|
Elf64_Addr relocValue;
|
||||||
|
switch (type) {
|
||||||
|
default:
|
||||||
|
dprintf("arch_elf_relocate_rela: unhandled relocation type %d\n",
|
||||||
|
type);
|
||||||
|
return B_BAD_DATA;
|
||||||
|
}
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
boot_elf64_set_relocation(relocAddr, relocValue);
|
||||||
|
#else
|
||||||
|
if (!is_in_image(image, relocAddr)) {
|
||||||
|
dprintf("arch_elf_relocate_rela: invalid offset %#lx\n",
|
||||||
|
rel[i].r_offset);
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
SubDir HAIKU_TOP src system kernel lib arch arm64 ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||||
|
|
||||||
|
local librootSources = [ FDirName $(HAIKU_TOP) src system libroot ] ;
|
||||||
|
local posixSources = [ FDirName $(librootSources) posix ] ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(librootSources) os arch $(TARGET_ARCH) ] ;
|
||||||
|
SEARCH_SOURCE += [ FDirName $(librootSources) os arch generic ] ;
|
||||||
|
|
||||||
|
KernelMergeObject kernel_os_arch_$(TARGET_ARCH).o :
|
||||||
|
generic_atomic.cpp
|
||||||
|
generic_system_time_nsecs.cpp
|
||||||
|
|
||||||
|
: $(TARGET_KERNEL_PIC_CCFLAGS)
|
||||||
|
;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(posixSources) arch $(TARGET_ARCH) ] ;
|
||||||
|
SEARCH_SOURCE += [ FDirName $(posixSources) string arch generic ] ;
|
||||||
|
SEARCH_SOURCE += [ FDirName $(posixSources) string arch $(TARGET_ARCH) ] ;
|
||||||
|
|
||||||
|
KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o :
|
||||||
|
arch_string.S
|
||||||
|
memset.c
|
||||||
|
|
||||||
|
: $(TARGET_KERNEL_PIC_CCFLAGS)
|
||||||
|
;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
SubDir HAIKU_TOP src system libroot os arch arm ;
|
SubDir HAIKU_TOP src system libroot os arch arm64 ;
|
||||||
|
|
||||||
SubDirC++Flags -std=gnu++11 ;
|
SubDirC++Flags -std=gnu++11 ;
|
||||||
|
|
||||||
@@ -13,7 +13,8 @@ for architectureObject in [ MultiArchSubDirSetup arm64 ] {
|
|||||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||||
|
|
||||||
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
|
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
|
||||||
|
tls.c
|
||||||
|
thread.c
|
||||||
|
|
||||||
generic_atomic.cpp
|
generic_atomic.cpp
|
||||||
generic_stack_trace.cpp
|
generic_stack_trace.cpp
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
#include "syscalls.h"
|
||||||
|
|
||||||
|
|
||||||
|
thread_id
|
||||||
|
find_thread(const char *name)
|
||||||
|
{
|
||||||
|
return _kern_find_thread(name);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <runtime_loader/runtime_loader.h>
|
||||||
|
|
||||||
|
#include "support/TLS.h"
|
||||||
|
#include "tls.h"
|
||||||
|
|
||||||
|
struct tls_index {
|
||||||
|
unsigned long ti_module;
|
||||||
|
unsigned long ti_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
void* __tls_get_addr(struct tls_index* ti);
|
||||||
|
|
||||||
|
static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
tls_allocate(void)
|
||||||
|
{
|
||||||
|
int32 next = atomic_add(&gNextSlot, 1);
|
||||||
|
if (next >= TLS_MAX_KEYS)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
tls_get(int32 index)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void **
|
||||||
|
tls_address(int32 index)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
tls_set(int32 index, void *value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void*
|
||||||
|
__tls_get_addr(struct tls_index* ti)
|
||||||
|
{
|
||||||
|
return __gRuntimeLoader->get_tls_address(ti->ti_module, ti->ti_offset);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
SubDir HAIKU_TOP src system libroot posix arch arm64 ;
|
||||||
|
|
||||||
|
local architectureObject ;
|
||||||
|
for architectureObject in [ MultiArchSubDirSetup arm64 ] {
|
||||||
|
on $(architectureObject) {
|
||||||
|
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||||
|
|
||||||
|
UsePrivateHeaders [ FDirName system arch $(TARGET_ARCH) ] ;
|
||||||
|
|
||||||
|
local genericSources =
|
||||||
|
setjmp_save_sigs.c
|
||||||
|
longjmp_return.c
|
||||||
|
;
|
||||||
|
|
||||||
|
MergeObject <$(architecture)>posix_arch_$(TARGET_ARCH).o :
|
||||||
|
fenv.c
|
||||||
|
sigsetjmp.S
|
||||||
|
siglongjmp.S
|
||||||
|
|
||||||
|
$(genericSources)
|
||||||
|
;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(genericSources) ]
|
||||||
|
= [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2004 David Schultz <[email protected]>
|
||||||
|
* Copyright (c) 2013 Andrew Turner <[email protected]>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, 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.
|
||||||
|
*
|
||||||
|
* $FreeBSD$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __fenv_static
|
||||||
|
#include "fenv.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hopefully the system ID byte is immutable, so it's valid to use
|
||||||
|
* this as a default environment.
|
||||||
|
*/
|
||||||
|
const fenv_t __fe_dfl_env = 0;
|
||||||
|
|
||||||
|
#ifdef __GNUC_GNU_INLINE__
|
||||||
|
#error "This file must be compiled with C99 'inline' semantics"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern inline int feclearexcept(int __excepts);
|
||||||
|
extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
|
||||||
|
extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
||||||
|
extern inline int feraiseexcept(int __excepts);
|
||||||
|
extern inline int fetestexcept(int __excepts);
|
||||||
|
extern inline int fegetround(void);
|
||||||
|
extern inline int fesetround(int __round);
|
||||||
|
extern inline int fegetenv(fenv_t *__envp);
|
||||||
|
extern inline int feholdexcept(fenv_t *__envp);
|
||||||
|
extern inline int fesetenv(const fenv_t *__envp);
|
||||||
|
extern inline int feupdateenv(const fenv_t *__envp);
|
||||||
|
extern inline int feenableexcept(int __mask);
|
||||||
|
extern inline int fedisableexcept(int __mask);
|
||||||
|
extern inline int fegetexcept(void);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <asm_defs.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* int __siglongjmp(jmp_buf buffer, int value) */
|
||||||
|
FUNCTION(siglongjmp):
|
||||||
|
FUNCTION(longjmp):
|
||||||
|
FUNCTION(_longjmp):
|
||||||
|
/* Loop infinitely here, for now.
|
||||||
|
TODO implement this for real */
|
||||||
|
b .
|
||||||
|
FUNCTION_END(siglongjmp)
|
||||||
|
FUNCTION_END(longjmp)
|
||||||
|
FUNCTION_END(_longjmp)
|
||||||
|
|
||||||
|
#pragma weak longjmp=siglongjmp
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm_defs.h>
|
||||||
|
|
||||||
|
/* int sigsetjmp(jmp_buf buffer, int saveMask) */
|
||||||
|
FUNCTION(__sigsetjmp):
|
||||||
|
FUNCTION(sigsetjmp):
|
||||||
|
b .
|
||||||
|
FUNCTION_END(sigsetjmp)
|
||||||
|
FUNCTION_END(__sigsetjmp)
|
||||||
|
|
||||||
|
|
||||||
|
/* int setjmp(jmp_buf buffer) */
|
||||||
|
FUNCTION(setjmp):
|
||||||
|
FUNCTION(_setjmp):
|
||||||
|
b .
|
||||||
|
FUNCTION_END(setjmp)
|
||||||
|
|
||||||
|
#pragma weak _setjmp=setjmp
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
SubDir HAIKU_TOP src system libroot posix glibc arch arm64 ;
|
||||||
|
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch $(TARGET_ARCH) ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch generic ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc libio ;
|
||||||
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
|
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
if $(OPTIM) = -O0 {
|
||||||
|
OPTIM = -O ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't compile with debugging
|
||||||
|
DEBUG = 0 ;
|
||||||
|
|
||||||
|
SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ;
|
||||||
|
|
||||||
|
# Note: There is no *l() support yet. Our compiler says sizeof(long double) = 8,
|
||||||
|
# while there are only 96 and 128 bit implementation in glibc.
|
||||||
|
local genericSources =
|
||||||
|
lshift.c rshift.c submul_1.c
|
||||||
|
add_n.c sub_n.c
|
||||||
|
addmul_1.c mul_1.c
|
||||||
|
|
||||||
|
branred.c
|
||||||
|
cmp.c dbl2mpn.c divrem.c
|
||||||
|
doasin.c dosincos.c
|
||||||
|
halfulp.c
|
||||||
|
memrchr.c
|
||||||
|
mpa.c mpatan.c mpatan2.c mpexp.c mplog.c mpn2dbl.c
|
||||||
|
mpn2flt.c mpn2ldbl.c mpsqrt.c mptan.c
|
||||||
|
mul.c mul_n.c
|
||||||
|
sincos32.c
|
||||||
|
slowexp.c
|
||||||
|
slowpow.c
|
||||||
|
|
||||||
|
e_acos.c e_acosf.c # e_acosl.c
|
||||||
|
e_acosh.c e_acoshf.c # e_acoshl.c
|
||||||
|
e_asin.c e_asinf.c # e_asinl.c
|
||||||
|
e_atan2.c e_atan2f.c # e_atan2l.c
|
||||||
|
e_atanh.c e_atanhf.c # e_atanhl.c
|
||||||
|
e_cosh.c e_coshf.c # e_coshl.c
|
||||||
|
e_exp.c e_expf.c
|
||||||
|
e_fmod.c e_fmodf.c # e_fmodl.c
|
||||||
|
e_gamma_r.c e_gammaf_r.c
|
||||||
|
e_hypot.c e_hypotf.c # e_hypotl.c
|
||||||
|
e_j0.c e_j0f.c
|
||||||
|
e_j1.c e_j1f.c
|
||||||
|
e_jn.c e_jnf.c
|
||||||
|
e_lgamma_r.c e_lgammaf_r.c
|
||||||
|
e_log.c e_logf.c
|
||||||
|
e_log10.c e_log10f.c
|
||||||
|
e_pow.c e_powf.c # e_powl.c
|
||||||
|
e_rem_pio2f.c
|
||||||
|
e_remainder.c e_remainderf.c # e_remainderl.c
|
||||||
|
e_scalb.c e_scalbf.c # e_scalbl.c
|
||||||
|
e_sinh.c e_sinhf.c # e_sinhl.c
|
||||||
|
k_cos.c k_cosf.c
|
||||||
|
k_sin.c k_sinf.c
|
||||||
|
k_rem_pio2.c k_rem_pio2f.c # k_rem_pio2l.c
|
||||||
|
k_tan.c k_tanf.c
|
||||||
|
s_asinh.c s_asinhf.c # s_asinhl.c
|
||||||
|
s_atan.c s_atanf.c # s_atanl.c
|
||||||
|
s_cbrt.c s_cbrtf.c # s_cbrtl.c
|
||||||
|
s_ceil.c s_ceilf.c # s_ceill.c
|
||||||
|
s_cos.c s_cosf.c
|
||||||
|
s_copysign.c s_copysignf.c
|
||||||
|
s_erf.c s_erff.c # s_erfl.c
|
||||||
|
s_expm1f.c s_expm1.c
|
||||||
|
s_finite.c s_finitef.c # s_finitel.c
|
||||||
|
s_clog.c s_clogf.c # s_clogl.c
|
||||||
|
s_csqrt.c s_csqrtf.c # s_csqrtl.c
|
||||||
|
s_floor.c s_floorf.c # s_floorl.c
|
||||||
|
s_fabs.c s_fabsf.c
|
||||||
|
s_fdim.c s_fdimf.c
|
||||||
|
s_fma.c s_fmaf.c # s_fmal.c
|
||||||
|
s_fmax.c s_fmaxf.c
|
||||||
|
s_fmin.c s_fminf.c
|
||||||
|
s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c
|
||||||
|
s_frexp.c s_frexpf.c # s_frexpl.c
|
||||||
|
s_ilogb.c s_ilogbf.c
|
||||||
|
s_isinf.c s_isinff.c # s_isinfl.c
|
||||||
|
s_isnan.c s_isnanf.c
|
||||||
|
s_ldexp.c s_ldexpf.c # s_ldexpl.c
|
||||||
|
s_llrint.c s_llrintf.c # s_llrintl.c
|
||||||
|
s_log1p.c s_log1pf.c
|
||||||
|
s_logb.c s_logbf.c # s_logbl.c
|
||||||
|
s_lrint.c s_lrintf.c # s_lrintl.c
|
||||||
|
s_lround.c s_lroundf.c
|
||||||
|
s_modf.c s_modff.c # s_modfl.c
|
||||||
|
s_nan.c s_nanf.c # s_nanl.c
|
||||||
|
# s_nexttoward.c s_nexttowardf.c s_nexttowardl.c
|
||||||
|
s_round.c s_roundf.c # s_roundl.c
|
||||||
|
s_rint.c s_rintf.c
|
||||||
|
s_scalbn.c s_scalbnf.c # s_scalbnl.c
|
||||||
|
s_signbit.c s_signbitf.c # s_signbitl.c
|
||||||
|
s_significand.c s_significandf.c
|
||||||
|
s_signgam.c
|
||||||
|
s_sin.c s_sinf.c # s_sinl.c
|
||||||
|
s_sincos.c s_sincosf.c
|
||||||
|
s_tan.c s_tanf.c
|
||||||
|
s_tanh.c s_tanhf.c
|
||||||
|
s_trunc.c s_truncf.c
|
||||||
|
t_exp.c
|
||||||
|
w_acos.c w_acosf.c # w_acosl.c
|
||||||
|
w_acosh.c w_acoshf.c # w_acoshl.c
|
||||||
|
w_atan2.c w_atan2f.c # w_atan2l.c
|
||||||
|
w_asin.c w_asinf.c # w_asinl.c
|
||||||
|
w_atanh.c w_atanhf.c # w_atanhl.c
|
||||||
|
w_cosh.c w_coshf.c # w_coshl.c
|
||||||
|
w_drem.c w_dremf.c # w_dreml.c
|
||||||
|
w_exp.c w_expf.c # w_expl.c
|
||||||
|
w_fmod.c w_fmodf.c # w_fmodl.c
|
||||||
|
w_hypot.c w_hypotf.c # w_hypotl.c
|
||||||
|
w_j0.c w_j0f.c
|
||||||
|
w_j1.c w_j1f.c
|
||||||
|
w_jn.c w_jnf.c
|
||||||
|
w_lgamma.c w_lgammaf.c
|
||||||
|
w_lgamma_r.c w_lgammaf_r.c
|
||||||
|
w_log.c w_logf.c # w_logl.c
|
||||||
|
w_log10.c w_log10f.c # w_log10l.c
|
||||||
|
w_pow.c w_powf.c # w_powl.c
|
||||||
|
w_remainder.c w_remainderf.c # w_remainderl.c
|
||||||
|
w_scalb.c w_scalbf.c # w_scalbl.c
|
||||||
|
w_sinh.c w_sinhf.c # w_sinhl.c
|
||||||
|
w_sqrt.c w_sqrtf.c
|
||||||
|
w_tgamma.c w_tgammaf.c # w_tgammal.c
|
||||||
|
;
|
||||||
|
|
||||||
|
local architectureObject ;
|
||||||
|
for architectureObject in [ MultiArchSubDirSetup arm64 ] {
|
||||||
|
on $(architectureObject) {
|
||||||
|
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||||
|
|
||||||
|
MergeObject <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_generic.o :
|
||||||
|
$(genericSources)
|
||||||
|
;
|
||||||
|
|
||||||
|
MergeObjectFromObjects <$(architecture)>posix_gnu_arch_$(TARGET_ARCH).o
|
||||||
|
: :
|
||||||
|
<$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_generic.o
|
||||||
|
;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(genericSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system libroot posix glibc arch
|
||||||
|
generic ] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
SubDir HAIKU_TOP src system libroot posix string arch arm64 ;
|
||||||
|
|
||||||
|
local architectureObject ;
|
||||||
|
for architectureObject in [ MultiArchSubDirSetup arm64 ] {
|
||||||
|
on $(architectureObject) {
|
||||||
|
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||||
|
|
||||||
|
UsePrivateSystemHeaders ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||||
|
|
||||||
|
MergeObject <$(architecture)>posix_string_arch_$(TARGET_ARCH).o :
|
||||||
|
arch_string.S
|
||||||
|
memcpy.c
|
||||||
|
memset.c
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm_defs.h>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
SubDir HAIKU_TOP src system runtime_loader arch arm64 ;
|
||||||
|
|
||||||
|
local architectureObject ;
|
||||||
|
for architectureObject in [ MultiArchSubDirSetup arm64 ] {
|
||||||
|
on $(architectureObject) {
|
||||||
|
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||||
|
|
||||||
|
UsePrivateHeaders runtime_loader ;
|
||||||
|
UsePrivateSystemHeaders ;
|
||||||
|
|
||||||
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||||
|
|
||||||
|
StaticLibrary <$(architecture)>libruntime_loader_$(TARGET_ARCH).a :
|
||||||
|
arch_relocate.cpp
|
||||||
|
:
|
||||||
|
<src!system!libroot!os!arch!$(TARGET_ARCH)!$(architecture)>thread.o
|
||||||
|
|
||||||
|
<src!system!libroot!posix!string!arch!$(TARGET_ARCH)!$(architecture)>arch_string.o
|
||||||
|
<src!system!libroot!posix!string!arch!$(TARGET_ARCH)!$(architecture)>memset.o
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "runtime_loader_private.h"
|
||||||
|
|
||||||
|
#include <runtime_loader.h>
|
||||||
|
|
||||||
|
|
||||||
|
//#define TRACE_RLD
|
||||||
|
#ifdef TRACE_RLD
|
||||||
|
# define TRACE(x) dprintf x
|
||||||
|
#else
|
||||||
|
# define TRACE(x) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
arch_relocate_image(image_t *rootImage, image_t *image,
|
||||||
|
SymbolLookupCache* cache)
|
||||||
|
{
|
||||||
|
debugger("arch_relocate_image: Not Yet Implemented!");
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user