summaryrefslogtreecommitdiff
path: root/sys/arch/aviion
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-09-28 19:56:48 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-09-28 19:56:48 +0000
commit4c20506fef90ef3b025a656e32f91d45c658b635 (patch)
tree7082659767c47590d99cec8a05b0e34b9a4528ca /sys/arch/aviion
parent56dfcffca0f05672d031f33b28e6c3a3fa199aa9 (diff)
Make sure the stack is 1:1 mapped before attempting to give control back
to the PROM at halt/reboot time; this lets systems reboot again.
Diffstat (limited to 'sys/arch/aviion')
-rw-r--r--sys/arch/aviion/aviion/locore.S10
-rw-r--r--sys/arch/aviion/aviion/machdep.c7
-rw-r--r--sys/arch/aviion/aviion/prom.c6
3 files changed, 20 insertions, 3 deletions
diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S
index 281ab70808f..ab7c2535b5b 100644
--- a/sys/arch/aviion/aviion/locore.S
+++ b/sys/arch/aviion/aviion/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.17 2013/01/05 11:20:55 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.18 2013/09/28 19:56:46 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -292,6 +292,14 @@ GLOBAL(delay)
2:
jmp %r1
+/*
+ * Switch to a 1:1 mapped stack at shutdown/reboot time.
+ */
+GLOBAL(bootstack)
+ or.u %r31, %r0, %hi16(_ASM_LABEL(initstack_end))
+ jmp.n %r1
+ or %r31, %r31, %lo16(_ASM_LABEL(initstack_end))
+
/*****************************************************************************/
.data
diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c
index 88349d59f5c..7700d677aab 100644
--- a/sys/arch/aviion/aviion/machdep.c
+++ b/sys/arch/aviion/aviion/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.52 2013/09/28 12:40:29 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.53 2013/09/28 19:56:47 miod Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
*
@@ -123,6 +123,8 @@ void savectx(struct pcb *);
void secondary_main(void);
vaddr_t secondary_pre_main(void);
+extern void bootstack(void);
+
int physmem; /* available physical memory, in pages */
struct vm_map *exec_map = NULL;
@@ -280,7 +282,9 @@ cpu_startup()
__dead void
doboot()
{
+
printf("Rebooting system...\n\n");
+ bootstack();
cmmu_shutdown();
scm_reboot(NULL);
/*NOTREACHED*/
@@ -332,6 +336,7 @@ haltsys:
if (howto & RB_HALT) {
printf("System halted.\n\n");
+ bootstack();
cmmu_shutdown();
scm_halt();
}
diff --git a/sys/arch/aviion/aviion/prom.c b/sys/arch/aviion/aviion/prom.c
index 67a902ffa9e..1c79ecb6f62 100644
--- a/sys/arch/aviion/aviion/prom.c
+++ b/sys/arch/aviion/aviion/prom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prom.c,v 1.5 2013/01/05 11:20:55 miod Exp $ */
+/* $OpenBSD: prom.c,v 1.6 2013/09/28 19:56:47 miod Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat.
@@ -155,9 +155,11 @@ scm_halt()
SCM_CONTEXT();
SCM_VBR();
SCM_CALL(SCM_HALT);
+#if 0
OS_CONTEXT();
OS_VBR();
set_psr(psr);
+#endif
for (;;) ;
}
@@ -262,9 +264,11 @@ scm_reboot(const char *cmdline)
SCM_VBR();
__asm__ __volatile__ ("or %%r2, %%r0, %0" : : "r" (cmdline));
SCM_CALL(SCM_REBOOT);
+#if 0
OS_CONTEXT();
OS_VBR();
set_psr(psr);
+#endif
for (;;) ;
}