Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/21689
Change subject: arch/riscv: Use a separate trap stack
......................................................................
arch/riscv: Use a separate trap stack
This is the lazy solution, as explained in the comment, but it works for
now.
Change-Id: I46e18b6d633280d6409e42462500fbe7c6823b4d
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
M src/arch/riscv/trap_util.S
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/21689/1
diff --git a/src/arch/riscv/trap_util.S b/src/arch/riscv/trap_util.S
index ae32379..7af4fe1 100644
--- a/src/arch/riscv/trap_util.S
+++ b/src/arch/riscv/trap_util.S
@@ -128,10 +128,14 @@
.Lsmp_hang:
bnez sp, .Lsmp_hang
- # TODO: Use the old stack pointer (plus an offset) for exceptions in machine
- # mode, to avoid overwriting stack data.
- la sp, _estack
- addi sp,sp,-MENTRY_FRAME_SIZE
+ # Use a different stack than in the main context, to to avoid overwriting
+ # stack data.
+ # TODO: Maybe use the old stack pointer (plus an offset) instead. But only if
+ # the previous mode was M, because it would be a very bad idea to use a stack
+ # pointer provided by unprivileged code!
+ la sp, _estack
+ addi sp, sp, -2048 # 2 KiB is half of the stack space
+ addi sp, sp, -MENTRY_FRAME_SIZE
save_tf
move a0,sp
--
To view, visit https://review.coreboot.org/21689
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I46e18b6d633280d6409e42462500fbe7c6823b4d
Gerrit-Change-Number: 21689
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/21688
Change subject: arch/riscv: mprv_read_*: Mark result as earlyclobber
......................................................................
arch/riscv: mprv_read_*: Mark result as earlyclobber
This fixes a case of mstatus corruption, where GCC generated code that
used the same register for the mprv bit and the result.
GCC inline assembly register modifiers are documented here:
https://gcc.gnu.org/onlinedocs/gcc/Modifiers.html
Change-Id: I2c563d171892c2e22ac96b34663aa3965553ceb3
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
M src/arch/riscv/include/vm.h
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/21688/1
diff --git a/src/arch/riscv/include/vm.h b/src/arch/riscv/include/vm.h
index a65aba9..af90e14 100644
--- a/src/arch/riscv/include/vm.h
+++ b/src/arch/riscv/include/vm.h
@@ -73,7 +73,7 @@
"csrs mstatus, %1\n" \
STRINGIFY(insn) " %0, 0(%2)\n" \
"csrc mstatus, %1\n" \
- : "=r"(value) : "r"(mprv), "r"(p) : "memory" \
+ : "=&r"(value) : "r"(mprv), "r"(p) : "memory" \
); \
return value; \
}
--
To view, visit https://review.coreboot.org/21688
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c563d171892c2e22ac96b34663aa3965553ceb3
Gerrit-Change-Number: 21688
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/21687
Change subject: arch/riscv: gettimer: Don't use the config string
......................................................................
arch/riscv: gettimer: Don't use the config string
Accessing the config string doesn't work anymore on current versions of
spike. Thus return dummy pointers until we have a better solution.
Change-Id: I684fc51dc0916f2235e57e36b913d363e1cb02b1
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
M src/arch/riscv/trap_handler.c
1 file changed, 9 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/21687/1
diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c
index ca4954f..54cd7e7 100644
--- a/src/arch/riscv/trap_handler.c
+++ b/src/arch/riscv/trap_handler.c
@@ -125,17 +125,19 @@
static void gettimer(void)
{
- query_result res;
- const char *config;
+ /*
+ * FIXME: This hard-coded value (currently) works on spike, but we
+ * should really read it from the device tree.
+ */
+ uintptr_t clint = 0x02000000;
- config = configstring();
- query_rtc(config, (uintptr_t *)&time);
+ time = (void *)(clint + 0xbff8);
+ timecmp = (void *)(clint + 0x4000);
+
if (!time)
die("Got timer interrupt but found no timer.");
- res = query_config_string(config, "core{0{0{timecmp");
- timecmp = (void *)get_uint(res);
if (!timecmp)
- die("Got a timer interrupt but found no timecmp.");
+ die("Got timer interrupt but found no timecmp.");
}
static void interrupt_handler(trapframe *tf)
--
To view, visit https://review.coreboot.org/21687
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I684fc51dc0916f2235e57e36b913d363e1cb02b1
Gerrit-Change-Number: 21687
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/21686
Change subject: [HACK] arch/riscv: build the code without RVC
......................................................................
[HACK] arch/riscv: build the code without RVC
RVC (the RISC-V Compressed extension) cases problems for
handle_misaligned_{load,store}, but I feel there should be a better
solution than simply hard-coding the architecture variant that I'm
currently testing against.
IOW: Do not merge, for now.
Change-Id: Iea8fc6657c196f8580a51f0cb75d5532254bd7c2
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
M src/arch/riscv/Makefile.inc
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/21686/1
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index c68fd1e..47dbe7a 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -15,9 +15,9 @@
##
################################################################################
-riscv_flags = -I$(src)/arch/riscv/ -mcmodel=medany
+riscv_flags = -I$(src)/arch/riscv/ -mcmodel=medany -march=rv64imafd
-riscv_asm_flags =
+riscv_asm_flags = -march=rv64imafd
ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
check-ramstage-overlap-regions += stack
--
To view, visit https://review.coreboot.org/21686
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea8fc6657c196f8580a51f0cb75d5532254bd7c2
Gerrit-Change-Number: 21686
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>