We will need the hartid for the linux-loader later.

Signed-off-by: Ralf Ramsauer <ralf.ramsa...@oth-regensburg.de>
---
 inmates/lib/riscv/header.S         | 3 +++
 inmates/lib/riscv/include/inmate.h | 2 ++
 inmates/lib/riscv/setup.c          | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/inmates/lib/riscv/header.S b/inmates/lib/riscv/header.S
index 5ddffe79..e4b21ce5 100644
--- a/inmates/lib/riscv/header.S
+++ b/inmates/lib/riscv/header.S
@@ -58,6 +58,9 @@ __reset_entry:
        la      a5, exception_handler
        csrw    stvec, a5
 
+       la      a5, hart_id
+       sd      a0, 0(a5)
+
        j       c_entry
 
 .text
diff --git a/inmates/lib/riscv/include/inmate.h 
b/inmates/lib/riscv/include/inmate.h
index 57338d25..468d2218 100644
--- a/inmates/lib/riscv/include/inmate.h
+++ b/inmates/lib/riscv/include/inmate.h
@@ -58,6 +58,8 @@ typedef unsigned int u32;
 typedef signed long long s64;
 typedef unsigned long long u64;
 
+extern unsigned long hart_id;
+
 #define SR_SIE 0x00000002UL
 
 #define IRQ_S_TIMER    5
diff --git a/inmates/lib/riscv/setup.c b/inmates/lib/riscv/setup.c
index 705c5630..a87e8c50 100644
--- a/inmates/lib/riscv/setup.c
+++ b/inmates/lib/riscv/setup.c
@@ -38,6 +38,8 @@
 
 #include <inmate.h>
 
+unsigned long hart_id;
+
 void arch_init_early(void)
 {
 }
-- 
2.36.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20220627132905.4338-33-ralf.ramsauer%40oth-regensburg.de.

Reply via email to