[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen/riscv: read hart_id and dtb_base passed by bootloader



Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/arch/riscv/setup.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index b3f8b10f71..154bf3a0bc 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -26,6 +26,18 @@ static void test_macros_from_bug_h(void)
 
 void __init noreturn start_xen(void)
 {
+    /*
+     * The following things are passed by bootloader:
+     *   a0 -> hart_id
+     *   a1 -> dtb_base
+    */
+    register unsigned long hart_id  asm("a0");
+    register unsigned long dtb_base asm("a1");
+
+    asm volatile( "mv %0, a0" : "=r" (hart_id) );
+
+    asm volatile( "mv %0, a1" : "=r" (dtb_base) );
+
     early_printk("Hello from C env\n");
 
     trap_init();
-- 
2.39.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.