summaryrefslogtreecommitdiff
path: root/sys/src/boot/alphapc/exec.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/boot/alphapc/exec.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/boot/alphapc/exec.c')
-rwxr-xr-xsys/src/boot/alphapc/exec.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/src/boot/alphapc/exec.c b/sys/src/boot/alphapc/exec.c
new file mode 100755
index 000000000..9bc626f8c
--- /dev/null
+++ b/sys/src/boot/alphapc/exec.c
@@ -0,0 +1,40 @@
+#include "u.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "lib.h"
+
+uchar pcbpage[64*1024+sizeof(PCB)];
+PCB *pcb;
+
+void (*kentry)(Bootconf*);
+
+void
+gokernel(void)
+{
+ (*kentry)(&conf);
+}
+
+void
+kexec(ulong entry)
+{
+ uvlong pcbb, paltype;
+
+ pcb = (PCB*)(((ulong)pcbpage+0xffff) & ~0xffff); /* page align, even on 64K page Alphas */
+ memset(pcb, 0, sizeof(PCB));
+ pcb->ksp = (uvlong)&entry;
+ pcb->ptbr = getptbr();
+ pcb->fen = 1;
+ conf.pcb = pcb;
+ pcbb = paddr((uvlong)pcb);
+ kentry = (void(*)(Bootconf*))entry;
+ paltype = 2; /* OSF/1 please */
+ switch (swppal(paltype, (uvlong)gokernel, pcbb, hwrpb->vptb, pcb->ksp)) {
+ case 1:
+ panic("unknown PALcode variant");
+ case 2:
+ panic("PALcode variant not loaded");
+ default:
+ panic("weird return status from swppal");
+ }
+}