aboutsummaryrefslogtreecommitdiff
path: root/pk/riscv-pk.c
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/riscv-pk.c
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/riscv-pk.c')
-rw-r--r--pk/riscv-pk.c21
1 files changed, 17 insertions, 4 deletions
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();
}