aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--scripts/makefile22
-rw-r--r--src/bits.c15
3 files changed, 29 insertions, 13 deletions
diff --git a/TODO b/TODO
index 9a987ed..cdfeb61 100644
--- a/TODO
+++ b/TODO
@@ -52,6 +52,11 @@ associated program. Easy. (started)
be visible from cur_tcb() when in an RPC? should I use some kind
of effective tid instead of cur_tcb()?)
+ Export VM flags to userspace, separate header or something?
++ Get core count? It's technically speaking available from the fdt but could be
+limited by the NR_CPUS macro, so it might be a good idea to export as a CONF_*
++ The node subsystem might benefit from larger-than-base-page sizes, for example
+ the RISC-V V extension allows up to 262 144 bytes of register space (though it
+ seems unlikely that anyone actually uses that many but still)
!!! FUTURE:
+ Cache locality?
diff --git a/scripts/makefile b/scripts/makefile
index aa0bcac..da0afa0 100644
--- a/scripts/makefile
+++ b/scripts/makefile
@@ -1,33 +1,29 @@
# this could be done better
-RELEASE ?= 0
-OPTFLAGS != [ "$(RELEASE)" != "0" ] \
+CFLAGS ?=
+
+OPTFLAGS != [ "$(RELEASE)" -a "$(RELEASE)" != "0" ] \
&& echo "-O2 -flto=auto" \
|| echo "-O0"
-DEBUG ?= 1
DEBUGFLAGS != [ "$(DEBUG)" != "0" ] \
&& echo "-DDEBUG=1" \
|| echo "-DNDEBUG=1"
-GENERIC_UBOOT ?= 0
-UBOOTFLAGS != [ "$(GENERIC_UBOOT)" != "0" ] \
+UBOOTFLAGS != [ "$(GENERIC_UBOOT)" -a "$(GENERIC_UBOOT)" != "0" ] \
&& echo "-DGENERIC_UBOOT=1" \
|| echo
-ASSERT ?= 1
ASSERTFLAGS != [ "$(ASSERT)" != "0" ] \
&& echo "-DASSERT=1" \
|| echo
+USE_LLVM != [ "$(LLVM)" -a "$(LLVM)" != "0" ] \
+ && echo "1"
+
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
LINTFLAGS = -fsyntax-only
PREPROCESS = -E
-LLVM ?= 0
-LDFLAGS != [ "$(LLVM)" = "0" ] \
- && echo -static-libgcc -lgcc \
- || echo
-
BUILD = build
ARCH_KERN_BUILD = $(BUILD)/kernel/arch/$(ARCH)
ARCH_SOURCE = arch/$(ARCH)
@@ -38,11 +34,11 @@ all: kmi.bin
ARCH ?= riscv64
CROSS_COMPILE ?= $(ARCH)-unknown-elf-
-OBJCOPY != [ "$(LLVM)" != "0" ] \
+OBJCOPY != [ "$(USE_LLVM)" ] \
&& echo llvm-objcopy \
|| echo $(CROSS_COMPILE)objcopy
-COMPILER != [ "$(LLVM)" != "0" ] \
+COMPILER != [ "$(USE_LLVM)" ] \
&& echo clang --target="$(CROSS_COMPILE)" \
|| echo $(CROSS_COMPILE)gcc
diff --git a/src/bits.c b/src/bits.c
index 6462d21..6bc3032 100644
--- a/src/bits.c
+++ b/src/bits.c
@@ -17,6 +17,11 @@ __weak uint16_t __bswap16(const uint16_t u)
return (u & 0xff00) >> 8 | (u & 0x00ff) << 8;
}
+uint16_t __bswaphi2(uint16_t u)
+{
+ return __bswap16(u);
+}
+
#undef __bswap32
__weak uint32_t __bswap32(const uint32_t u)
{
@@ -24,6 +29,11 @@ __weak uint32_t __bswap32(const uint32_t u)
(u & 0x0000ff00) << 8 | (u & 0x000000ff) << 24;
}
+uint32_t __bswapsi2(uint32_t u)
+{
+ return __bswap32(u);
+}
+
#undef __bswap64
__weak uint64_t __bswap64(const uint64_t u)
{
@@ -37,6 +47,11 @@ __weak uint64_t __bswap64(const uint64_t u)
(u & 0x00000000000000ffULL) << 56;
}
+uint64_t __bswapdi2(uint64_t u)
+{
+ return __bswap64(u);
+}
+
#undef ffs
__weak int ffs(int v)
{