aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@ubuntu.(none)>2010-08-22 21:25:41 -0700
committerAndrew Waterman <waterman@ubuntu.(none)>2010-08-22 21:25:41 -0700
commit79a84855df0e7cc1aeba886d8e1d21487af6a3c1 (patch)
treeb44859bb1fd2110d18b96f940aa7d41ac4e00d9a /pk
parent29cc0dc9854c66f12bd65e12516f68ccd9a741da (diff)
downloadpk-79a84855df0e7cc1aeba886d8e1d21487af6a3c1.zip
pk-79a84855df0e7cc1aeba886d8e1d21487af6a3c1.tar.gz
pk-79a84855df0e7cc1aeba886d8e1d21487af6a3c1.tar.bz2
[pk] Fixed broken PK build process (moved boot into a .c file)
Diffstat (limited to 'pk')
-rw-r--r--pk/boot.S23
-rw-r--r--pk/entry.S4
-rw-r--r--pk/pcr.h3
-rw-r--r--pk/pk.ld2
-rw-r--r--pk/pk.mk.in1
-rw-r--r--pk/riscv-pk.c21
6 files changed, 24 insertions, 30 deletions
diff --git a/pk/boot.S b/pk/boot.S
deleted file mode 100644
index 0619671..0000000
--- a/pk/boot.S
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "pcr.h"
-
- .section boottext
- .global __start
- .ent __start
-__start:
-
- # set up SR
- li $t0, SR_S | SR_PS | SR_ET | SR_UX | SR_KX
- mtpcr $t0, $0
-
- # set up trap table
- la $t0, trap_table
- mtpcr $t0, $3
-
- # set up stack
- la $sp,stack_top-64
-
- # call into kernel
- la $t0, boot
- jr $t0
-
- .end __start
diff --git a/pk/entry.S b/pk/entry.S
index db49a98..b52ff15 100644
--- a/pk/entry.S
+++ b/pk/entry.S
@@ -90,8 +90,10 @@ pop_tf: # write the trap frame onto the stack
#define TRAP_TABLE_ENTRY(x) \
.align 7; \
- move $k0,$ra; \
+ .set at=$k0; \
la $k1,stack_top-320; \
+ .set noat; \
+ move $k0,$ra; \
jal save_tf; \
move $sp,$k1; \
move $a0,$k1; \
diff --git a/pk/pcr.h b/pk/pcr.h
index 23e6185..2014dfc 100644
--- a/pk/pcr.h
+++ b/pk/pcr.h
@@ -9,6 +9,9 @@
#define SR_KX 0x0000000000000040
#define SR_IM 0x000000000000FF00
+#define PCR_SR 0
+#define PCR_TBR 3
+
#ifndef __ASSEMBLER__
#define mtpcr(val,reg) ({ long __tmp = (long)(val); \
diff --git a/pk/pk.ld b/pk/pk.ld
index f1ec715..5dd3ce4 100644
--- a/pk/pk.ld
+++ b/pk/pk.ld
@@ -16,7 +16,7 @@ SECTIONS
. = 0x00000000;
.boottext :
{
- *(.boottext)
+ riscv-pk.o(.boottext)
}
. = 0x70000000;
diff --git a/pk/pk.mk.in b/pk/pk.mk.in
index a89ee2b..a9957ed 100644
--- a/pk/pk.mk.in
+++ b/pk/pk.mk.in
@@ -12,7 +12,6 @@ pk_srcs = \
pk_asm_srcs = \
entry.S \
- boot.S \
pk_test_srcs =
diff --git a/pk/riscv-pk.c b/pk/riscv-pk.c
index b25b339..dfcc71d 100644
--- a/pk/riscv-pk.c
+++ b/pk/riscv-pk.c
@@ -1,6 +1,19 @@
-// force the linker to pull in our __start from boot.S.
-void* dummy()
+#include "pcr.h"
+
+void __attribute__((section(".boottext"))) __start()
{
- extern void __start();
- return &__start;
+ extern char stack_top;
+ asm("move $sp,%0" : : "r"(&stack_top-64));
+
+ register long sr0 = SR_S | SR_PS | SR_ET | SR_UX | SR_KX;
+ mtpcr(sr0,PCR_SR);
+
+ extern char trap_table;
+ register void* tt = &trap_table;
+ mtpcr(tt,PCR_TBR);
+
+ extern void boot();
+ register void (*boot_p)() = &boot;
+ asm("" : "=r"(boot_p) : "0"(boot_p));
+ boot_p();
}