aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/supervisor/hsm/hsm.ld.S
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-05 15:34:33 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-05 16:02:51 +0100
commit76169cd214e4830a523c8c2ee7bbddc04b4253df (patch)
tree54d754426ca41729414e7f7ddb9427a61594f464 /arch/riscv/supervisor/hsm/hsm.ld.S
parentf463d544793ff83efd8b95d0bce5ec80fd8170f3 (diff)
downloadfarga-76169cd214e4830a523c8c2ee7bbddc04b4253df.tar.gz
farga-76169cd214e4830a523c8c2ee7bbddc04b4253df.zip
supervisor: Add an example on the HSM extension
The HSM extension from SBI v2.0 allows a supervisor to manage the state of harts on the system. Moreover, it also guarantees that only one hart makes it into the booting stages of the supervisor, and it's up to the supervisor to wake up the rest through the HSM extension. I have added an example which showcases this extension in different ways, and it finally shuts down the machine. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'arch/riscv/supervisor/hsm/hsm.ld.S')
-rw-r--r--arch/riscv/supervisor/hsm/hsm.ld.S48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/riscv/supervisor/hsm/hsm.ld.S b/arch/riscv/supervisor/hsm/hsm.ld.S
new file mode 100644
index 0000000..db83dc9
--- /dev/null
+++ b/arch/riscv/supervisor/hsm/hsm.ld.S
@@ -0,0 +1,48 @@
+#define PAGE_SIZE 0x1000
+#define STACK_SIZE PAGE_SIZE
+
+#define LOAD_BASE_ADDR 0x80000000
+#define LOAD_BASE_OFFSET 0x00200000
+#define LOAD_OFFSET (LOAD_BASE_ADDR + LOAD_BASE_OFFSET)
+
+OUTPUT_ARCH(riscv)
+ENTRY(_start)
+
+SECTIONS {
+ . = LOAD_OFFSET;
+ _start = .;
+ . = ALIGN(PAGE_SIZE);
+
+ .text : {
+ _text = .;
+ KEEP(*(.head.text))
+ . = ALIGN(PAGE_SIZE);
+ *(.text)
+ }
+ . = ALIGN(PAGE_SIZE);
+
+ .data : {
+ *(.data)
+ }
+ . = ALIGN(8);
+
+ .rodata : {
+ *(.rodata)
+ }
+ . = ALIGN(8);
+
+ .sdata : {
+ *(.sdata*)
+ }
+ . = ALIGN(8);
+
+ .bss : {
+ *(.bss)
+ }
+
+ . = ALIGN(8);
+ . = . + STACK_SIZE;
+ _STACK_PTR = .;
+
+ _end = .;
+}