aboutsummaryrefslogtreecommitdiff
path: root/dummy_payload
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-02-17 01:54:41 -0800
committerAndrew Waterman <andrew@sifive.com>2017-02-17 01:54:41 -0800
commit926b360655fd7a22413c7732faceeea21a224aa1 (patch)
treea0fe50446c5ccbdb2aecd7945aa7025804c655e7 /dummy_payload
parent611290ccde8d76c1973a37d82a5d4b3e4b7b90c4 (diff)
downloadpk-926b360655fd7a22413c7732faceeea21a224aa1.zip
pk-926b360655fd7a22413c7732faceeea21a224aa1.tar.gz
pk-926b360655fd7a22413c7732faceeea21a224aa1.tar.bz2
WIP towards ECALL interface for SBI
Diffstat (limited to 'dummy_payload')
-rw-r--r--dummy_payload/dummy_entry.S22
-rw-r--r--dummy_payload/dummy_payload.c21
-rw-r--r--dummy_payload/dummy_payload.lds4
-rw-r--r--dummy_payload/dummy_payload.mk.in2
l---------dummy_payload/dummy_sbi.S1
5 files changed, 27 insertions, 23 deletions
diff --git a/dummy_payload/dummy_entry.S b/dummy_payload/dummy_entry.S
new file mode 100644
index 0000000..46c0b7f
--- /dev/null
+++ b/dummy_payload/dummy_entry.S
@@ -0,0 +1,22 @@
+#include "mcall.h"
+
+ .section ".text.init"
+ .globl _start
+_start:
+ la s0, str
+1:
+ lbu a0, (s0)
+ beqz a0, 1f
+ li a7, MCALL_CONSOLE_PUTCHAR
+ ecall
+ add s0, s0, 1
+ j 1b
+
+1:
+ li a7, MCALL_SHUTDOWN
+ ecall
+
+ .data
+str:
+ .asciz "This is bbl's dummy_payload. To boot a real kernel, reconfigure\n\
+bbl with the flag --with-payload=PATH, then rebuild bbl.\n"
diff --git a/dummy_payload/dummy_payload.c b/dummy_payload/dummy_payload.c
index 61ed59a..e69de29 100644
--- a/dummy_payload/dummy_payload.c
+++ b/dummy_payload/dummy_payload.c
@@ -1,21 +0,0 @@
-#include <stdint.h>
-#include "sbi.h"
-
-asm (".globl _start\n\
- _start: la sp, stack\n\
- j entry\n\
- .pushsection .rodata\n\
- .align 4\n\
- .skip 4096\n\
- stack:\n\
- .popsection");
-
-void entry()
-{
- const char* message =
-"This is bbl's dummy_payload. To boot a real kernel, reconfigure\n\
-bbl with the flag --with-payload=PATH, then rebuild bbl.\n";
- while (*message)
- sbi_console_putchar(*message++);
- sbi_shutdown();
-}
diff --git a/dummy_payload/dummy_payload.lds b/dummy_payload/dummy_payload.lds
index ee9410b..0506a8d 100644
--- a/dummy_payload/dummy_payload.lds
+++ b/dummy_payload/dummy_payload.lds
@@ -1,3 +1,7 @@
+ENTRY(_start)
+
SECTIONS {
. = -0x80000000;
+
+ .text.init : { *(.text.init) }
}
diff --git a/dummy_payload/dummy_payload.mk.in b/dummy_payload/dummy_payload.mk.in
index b1d4ac7..4a133be 100644
--- a/dummy_payload/dummy_payload.mk.in
+++ b/dummy_payload/dummy_payload.mk.in
@@ -5,7 +5,7 @@ dummy_payload_hdrs = \
dummy_payload_c_srcs = \
dummy_payload_asm_srcs = \
- dummy_sbi.S \
+ dummy_entry.S \
dummy_payload_test_srcs =
diff --git a/dummy_payload/dummy_sbi.S b/dummy_payload/dummy_sbi.S
deleted file mode 120000
index 2978a97..0000000
--- a/dummy_payload/dummy_sbi.S
+++ /dev/null
@@ -1 +0,0 @@
-../machine/sbi.S \ No newline at end of file