mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 14:37:50 +00:00
parent
890842dce2
commit
7c976a83e0
@ -18,6 +18,10 @@ ifeq ($(filter-out $(SPECS),arm_64),)
|
||||
LIBC_ARCH_INC_DIR := include/spec/arm_64/libc
|
||||
endif # ARM64
|
||||
|
||||
ifeq ($(filter-out $(SPECS),riscv),)
|
||||
LIBC_ARCH_INC_DIR := include/spec/riscv/libc
|
||||
endif # RISC-V
|
||||
|
||||
#
|
||||
# If we found no valid include path for the configured target platform,
|
||||
# we have to prevent the build system from building the target. This is
|
||||
|
23
repos/libports/lib/mk/spec/riscv/libc-gen.mk
Normal file
23
repos/libports/lib/mk/spec/riscv/libc-gen.mk
Normal file
@ -0,0 +1,23 @@
|
||||
include $(REP_DIR)/lib/mk/libc-gen.inc
|
||||
|
||||
LIBC_GEN_RISCV_DIR = $(LIBC_DIR)/lib/libc/riscv/gen
|
||||
|
||||
SRC_S += _ctx_start.S sigsetjmp.S
|
||||
SRC_C += flt_rounds.c fpgetmask.c fpsetmask.c infinity.c makecontext.c
|
||||
|
||||
#
|
||||
# Fix missing include prefix for 'ucontext.h', should be 'sys/ucontext.h'
|
||||
#
|
||||
# The first path is in effect when using the regular build system. The second
|
||||
# path is in effect when building the libc from a source archive (where the
|
||||
# ucontext.h header is taken from the libc API archive).
|
||||
#
|
||||
CC_OPT_makecontext = -I$(call select_from_ports,libc)/include/libc/sys \
|
||||
$(addprefix -I,$(call select_from_repositories,/include/libc/sys))
|
||||
|
||||
CC_OPT += -DSOFTFLOAT_FOR_GCC
|
||||
|
||||
vpath fpgetmask.c $(LIBC_DIR)/lib/libc/softfloat
|
||||
vpath fpsetmask.c $(LIBC_DIR)/lib/libc/softfloat
|
||||
vpath %.c $(LIBC_GEN_RISCV_DIR)
|
||||
vpath %.S $(LIBC_GEN_RISCV_DIR)
|
9
repos/libports/lib/mk/spec/riscv/libc-setjmp.mk
Normal file
9
repos/libports/lib/mk/spec/riscv/libc-setjmp.mk
Normal file
@ -0,0 +1,9 @@
|
||||
LIBC_GEN_RISCV_DIR = $(LIBC_DIR)/lib/libc/riscv/gen
|
||||
|
||||
SRC_S = _setjmp.S setjmp.S
|
||||
|
||||
include $(REP_DIR)/lib/mk/libc-common.inc
|
||||
|
||||
vpath %.S $(LIBC_GEN_RISCV_DIR)
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
8
repos/libports/lib/mk/spec/riscv/libc.mk
Normal file
8
repos/libports/lib/mk/spec/riscv/libc.mk
Normal file
@ -0,0 +1,8 @@
|
||||
include $(REP_DIR)/lib/mk/libc.mk
|
||||
|
||||
SRC_CC += fenv-softfloat.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/libc/spec/riscv
|
||||
INC_DIR += $(LIBC_DIR)/include/spec/riscv
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1 +1 @@
|
||||
1153300b5549eec9d7d3b171b7263d59b587b1ec
|
||||
130633868713e5f3e0dac32775bfcb8a1731f6ad
|
||||
|
@ -221,6 +221,23 @@ DIR_CONTENT(include/spec/arm_64/libc/machine) := \
|
||||
$(addprefix $(D)/sys/arm64/include/, armreg.h)
|
||||
|
||||
|
||||
#
|
||||
# RISC-V-specific headers
|
||||
#
|
||||
DIRS += include/spec/riscv/libc
|
||||
DIR_CONTENT(include/spec/riscv/libc) := \
|
||||
$(call common_include_libc_arch_content,riscv,riscv) \
|
||||
$(D)/lib/msun/riscv/fenv.h \
|
||||
$(addprefix $(D)/lib/libc/softfloat/, softfloat-for-gcc.h) \
|
||||
$(addprefix $(D)/lib/libc/riscv/softfloat/, milieu.h riscv-gcc.h \
|
||||
softfloat.h)
|
||||
|
||||
DIRS += include/spec/riscv/libc/machine
|
||||
DIR_CONTENT(include/spec/riscv/libc/machine) := \
|
||||
$(call common_include_libc_arch_machine_content,riscv) \
|
||||
$(addprefix $(D)/sys/riscv/include/, riscvreg.h)
|
||||
|
||||
|
||||
#
|
||||
# Rules for generating files
|
||||
#
|
||||
|
@ -18,7 +18,7 @@ include/libc-plugin include/libc/sys/ucontext.h:
|
||||
lib/mk:
|
||||
mkdir -p $@
|
||||
cp $(addprefix $(REP_DIR)/$@/,libc.mk libc-* libm.inc) $@
|
||||
for spec in x86_32 x86_64 arm arm_64; do \
|
||||
for spec in x86_32 x86_64 arm arm_64 riscv; do \
|
||||
mkdir -p $@/spec/$$spec; \
|
||||
cp $(addprefix $(REP_DIR)/$@/spec/$$spec/,libc-* libc.mk libm.mk) $@/spec/$$spec/; done
|
||||
|
||||
|
18
repos/libports/src/lib/libc/fenv-softfloat.cc
Normal file
18
repos/libports/src/lib/libc/fenv-softfloat.cc
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* \brief Soft float support
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2021-06-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
int __softfloat_float_rounding_mode;
|
||||
int __softfloat_float_exception_mask;
|
||||
int __softfloat_float_exception_flags;
|
||||
}
|
11
repos/libports/src/lib/libc/patches/ieeefp_riscv.patch
Normal file
11
repos/libports/src/lib/libc/patches/ieeefp_riscv.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff --git a/src/lib/libc/sys/riscv/include/ieeefp.h b/src/lib/libc/sys/riscv/include/ieeefp.h
|
||||
index ed7381d..44a1c00 100644
|
||||
--- src/lib/libc/sys/riscv/include/ieeefp.h
|
||||
+++ src/lib/libc/sys/riscv/include/ieeefp.h
|
||||
@@ -4,5 +4,6 @@
|
||||
#define _MACHINE_IEEEFP_H_
|
||||
|
||||
/* TODO */
|
||||
+typedef int fp_except;
|
||||
|
||||
#endif /* _MACHINE_IEEEFP_H_ */
|
35
repos/libports/src/lib/libc/spec/riscv/internal/call_func.h
Normal file
35
repos/libports/src/lib/libc/spec/riscv/internal/call_func.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* \brief User-level task helpers (riscv)
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2021-06-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__RISCV__INTERNAL__CALL_FUNC_H_
|
||||
#define _INCLUDE__SPEC__RISCV__INTERNAL__CALL_FUNC_H_
|
||||
|
||||
/* Libc includes */
|
||||
#include <setjmp.h> /* _setjmp() as we don't care about signal state */
|
||||
|
||||
|
||||
/**
|
||||
* Call function with a new stack
|
||||
*/
|
||||
[[noreturn]] inline void call_func(void *sp, void *func, void *arg)
|
||||
{
|
||||
asm volatile ("mv a0, %2\n" /* set arg */
|
||||
"mv sp, %0\n" /* set stack */
|
||||
"mv fp, x0\n" /* clear frame pointer */
|
||||
"jalr %1\n" /* call func */
|
||||
""
|
||||
: : "r"(sp), "r"(func), "r"(arg) : "a0");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__RISCV__INTERNAL__CALL_FUNC_H_ */
|
Loading…
Reference in New Issue
Block a user