diff --git a/src/add-ons/kernel/cpu/riscv32/Jamfile b/src/add-ons/kernel/cpu/riscv32/Jamfile new file mode 100644 index 0000000000..380e405c57 --- /dev/null +++ b/src/add-ons/kernel/cpu/riscv32/Jamfile @@ -0,0 +1,2 @@ +SubDir HAIKU_TOP src add-ons kernel cpu riscv32 ; + diff --git a/src/add-ons/kernel/cpu/riscv64/Jamfile b/src/add-ons/kernel/cpu/riscv64/Jamfile new file mode 100644 index 0000000000..9dd2afc43a --- /dev/null +++ b/src/add-ons/kernel/cpu/riscv64/Jamfile @@ -0,0 +1,2 @@ +SubDir HAIKU_TOP src add-ons kernel cpu risc64 ; + diff --git a/src/system/glue/arch/riscv32/Jamfile b/src/system/glue/arch/riscv32/Jamfile new file mode 100644 index 0000000000..5ec9d7ae5d --- /dev/null +++ b/src/system/glue/arch/riscv32/Jamfile @@ -0,0 +1,21 @@ +SubDir HAIKU_TOP src system glue arch riscv32 ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup riscv32 ] { + on $(architectureObject) { + local architecture = $(TARGET_PACKAGING_ARCH) ; + + UsePrivateSystemHeaders ; + + local sources = + crti.S + crtn.S + ; + MergeObject <$(architecture)>glue_arch_$(TARGET_ARCH).o : $(sources) ; + + if $(HAIKU_BUILD_TYPE) = bootstrap { + # build a version for stage0 of the bootstrap process + BootstrapStage0PlatformObjects [ FGristFiles $(sources) ] : true ; + } + } +} diff --git a/src/system/glue/arch/riscv32/crti.S b/src/system/glue/arch/riscv32/crti.S new file mode 100644 index 0000000000..337c772ec2 --- /dev/null +++ b/src/system/glue/arch/riscv32/crti.S @@ -0,0 +1,30 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +/** This file contains the first part of the ".init" and ".fini" sections in + * the ELF executable. + * The functions defined here will be called during initialization/termination + * of the loaded executable/library. The ".init" and ".fini" sections are + * stacked together like this: + * + * crti.S entry point + * call to _init_before/_term_before + * crtbegin.S GCC specific: constructors/destructors are called, ... + * crtend.S + * crtn.S call to _init_after/_term_after + * exit + */ + +#define FUNCTION(x) .global x; .type x,%function; x + +.section .init +FUNCTION(_init): + bl __haiku_init_before + // crtbegin.o stuff comes here + +.section .fini +FUNCTION(_fini): + bl __haiku_term_before + // crtbegin.o stuff comes here diff --git a/src/system/glue/arch/riscv32/crtn.S b/src/system/glue/arch/riscv32/crtn.S new file mode 100644 index 0000000000..125022e37d --- /dev/null +++ b/src/system/glue/arch/riscv32/crtn.S @@ -0,0 +1,19 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +/** This file contains the final part of the ".init" and ".fini" sections in + * the ELF executable. It is tightly connected to crti.S. + * Have a look at crti.S to find a description of what happens here. + */ + +.section .init + // the image ID and program args are still on the stack + bl __haiku_init_after + + +.section .fini + // the image ID and program args are still on the stack + bl __haiku_term_after + diff --git a/src/system/glue/arch/riscv64/Jamfile b/src/system/glue/arch/riscv64/Jamfile new file mode 100644 index 0000000000..1ec7273c45 --- /dev/null +++ b/src/system/glue/arch/riscv64/Jamfile @@ -0,0 +1,21 @@ +SubDir HAIKU_TOP src system glue arch riscv64 ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup riscv64 ] { + on $(architectureObject) { + local architecture = $(TARGET_PACKAGING_ARCH) ; + + UsePrivateSystemHeaders ; + + local sources = + crti.S + crtn.S + ; + MergeObject <$(architecture)>glue_arch_$(TARGET_ARCH).o : $(sources) ; + + if $(HAIKU_BUILD_TYPE) = bootstrap { + # build a version for stage0 of the bootstrap process + BootstrapStage0PlatformObjects [ FGristFiles $(sources) ] : true ; + } + } +} diff --git a/src/system/glue/arch/riscv64/crti.S b/src/system/glue/arch/riscv64/crti.S new file mode 100644 index 0000000000..337c772ec2 --- /dev/null +++ b/src/system/glue/arch/riscv64/crti.S @@ -0,0 +1,30 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +/** This file contains the first part of the ".init" and ".fini" sections in + * the ELF executable. + * The functions defined here will be called during initialization/termination + * of the loaded executable/library. The ".init" and ".fini" sections are + * stacked together like this: + * + * crti.S entry point + * call to _init_before/_term_before + * crtbegin.S GCC specific: constructors/destructors are called, ... + * crtend.S + * crtn.S call to _init_after/_term_after + * exit + */ + +#define FUNCTION(x) .global x; .type x,%function; x + +.section .init +FUNCTION(_init): + bl __haiku_init_before + // crtbegin.o stuff comes here + +.section .fini +FUNCTION(_fini): + bl __haiku_term_before + // crtbegin.o stuff comes here diff --git a/src/system/glue/arch/riscv64/crtn.S b/src/system/glue/arch/riscv64/crtn.S new file mode 100644 index 0000000000..125022e37d --- /dev/null +++ b/src/system/glue/arch/riscv64/crtn.S @@ -0,0 +1,19 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +/** This file contains the final part of the ".init" and ".fini" sections in + * the ELF executable. It is tightly connected to crti.S. + * Have a look at crti.S to find a description of what happens here. + */ + +.section .init + // the image ID and program args are still on the stack + bl __haiku_init_after + + +.section .fini + // the image ID and program args are still on the stack + bl __haiku_term_after + diff --git a/src/system/kernel/arch/riscv32/Jamfile b/src/system/kernel/arch/riscv32/Jamfile new file mode 100644 index 0000000000..4da73e15a0 --- /dev/null +++ b/src/system/kernel/arch/riscv32/Jamfile @@ -0,0 +1,4 @@ +SubDir HAIKU_TOP src system kernel arch riscv32 ; + +SubDirHdrs $(SUBDIR) $(DOTDOT) generic ; +UsePrivateKernelHeaders ; diff --git a/src/system/kernel/arch/riscv64/Jamfile b/src/system/kernel/arch/riscv64/Jamfile new file mode 100644 index 0000000000..8fb0460454 --- /dev/null +++ b/src/system/kernel/arch/riscv64/Jamfile @@ -0,0 +1,4 @@ +SubDir HAIKU_TOP src system kernel arch riscv64 ; + +SubDirHdrs $(SUBDIR) $(DOTDOT) generic ; +UsePrivateKernelHeaders ; diff --git a/src/system/libroot/posix/string/arch/riscv32/Jamfile b/src/system/libroot/posix/string/arch/riscv32/Jamfile new file mode 100644 index 0000000000..1ea4246f0c --- /dev/null +++ b/src/system/libroot/posix/string/arch/riscv32/Jamfile @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src system libroot posix string arch riscv64 ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup riscv64 ] { + on $(architectureObject) { + local architecture = $(TARGET_PACKAGING_ARCH) ; + + UsePrivateSystemHeaders ; + + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; + + MergeObject <$(architecture)>posix_string_arch_$(TARGET_ARCH).o : + memcpy.c + memset.c + ; + } +} diff --git a/src/system/libroot/posix/string/arch/riscv64/Jamfile b/src/system/libroot/posix/string/arch/riscv64/Jamfile new file mode 100644 index 0000000000..5f054aa971 --- /dev/null +++ b/src/system/libroot/posix/string/arch/riscv64/Jamfile @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src system libroot posix string arch ppc ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup ppc ] { + on $(architectureObject) { + local architecture = $(TARGET_PACKAGING_ARCH) ; + + UsePrivateSystemHeaders ; + + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; + + MergeObject <$(architecture)>posix_string_arch_$(TARGET_ARCH).o : + memcpy.c + memset.c + ; + } +} diff --git a/src/system/runtime_loader/arch/riscv32/Jamfile b/src/system/runtime_loader/arch/riscv32/Jamfile new file mode 100644 index 0000000000..609feed239 --- /dev/null +++ b/src/system/runtime_loader/arch/riscv32/Jamfile @@ -0,0 +1,22 @@ +SubDir HAIKU_TOP src system runtime_loader arch riscv32 ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup riscv32 ] { + 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 + : + thread.o + + arch_string.o + memset.o + ; + } +} diff --git a/src/system/runtime_loader/arch/riscv32/arch_relocate.cpp b/src/system/runtime_loader/arch/riscv32/arch_relocate.cpp new file mode 100644 index 0000000000..3a57919364 --- /dev/null +++ b/src/system/runtime_loader/arch/riscv32/arch_relocate.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2018, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ithamar R. Adema + */ + +#include +#include +#include + +#include "runtime_loader_private.h" + +#include + +//#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; +} diff --git a/src/system/runtime_loader/arch/riscv64/Jamfile b/src/system/runtime_loader/arch/riscv64/Jamfile new file mode 100644 index 0000000000..16c9f534bf --- /dev/null +++ b/src/system/runtime_loader/arch/riscv64/Jamfile @@ -0,0 +1,22 @@ +SubDir HAIKU_TOP src system runtime_loader arch riscv64 ; + +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup riscv64 ] { + 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 + : + thread.o + + arch_string.o + memset.o + ; + } +} diff --git a/src/system/runtime_loader/arch/riscv64/arch_relocate.cpp b/src/system/runtime_loader/arch/riscv64/arch_relocate.cpp new file mode 100644 index 0000000000..3a57919364 --- /dev/null +++ b/src/system/runtime_loader/arch/riscv64/arch_relocate.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2018, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ithamar R. Adema + */ + +#include +#include +#include + +#include "runtime_loader_private.h" + +#include + +//#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; +}