riscv32/64: Stub out some core architecture code

Change-Id: I437dff816e87ec5692cca0aaacaada27b43089ee
This commit is contained in:
Alexander von Gluck IV
2018-12-05 10:14:18 -06:00
parent e28abad762
commit 7dcd941df2
16 changed files with 290 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
SubDir HAIKU_TOP src add-ons kernel cpu riscv32 ;
+2
View File
@@ -0,0 +1,2 @@
SubDir HAIKU_TOP src add-ons kernel cpu risc64 ;
+21
View File
@@ -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 ;
}
}
}
+30
View File
@@ -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
+19
View File
@@ -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
+21
View File
@@ -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 ;
}
}
}
+30
View File
@@ -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
+19
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
SubDir HAIKU_TOP src system kernel arch riscv32 ;
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
UsePrivateKernelHeaders ;
+4
View File
@@ -0,0 +1,4 @@
SubDir HAIKU_TOP src system kernel arch riscv64 ;
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
UsePrivateKernelHeaders ;
@@ -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
;
}
}
@@ -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
;
}
}
@@ -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
:
<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,30 @@
/*
* Copyright 2012-2018, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ithamar R. Adema <[email protected]>
*/
#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;
}
@@ -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
:
<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,30 @@
/*
* Copyright 2012-2018, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ithamar R. Adema <[email protected]>
*/
#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;
}