From c185965bc6cd4f96c4dcfde880d1af639c4bf43d Mon Sep 17 00:00:00 2001 From: NicJA Date: Mon, 14 Jan 2013 13:23:21 +0000 Subject: [PATCH] add coldreboot by jumping to the reset vector. push boot tasks 'real' stack into exec. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@46269 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/arm-raspi/exec/coldreboot.c | 57 +++++++++++++++++++++++++++++++++++++ arch/arm-raspi/exec/mmakefile.src | 2 +- arch/arm-raspi/exec/platform_init.c | 43 ++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 arch/arm-raspi/exec/coldreboot.c create mode 100644 arch/arm-raspi/exec/platform_init.c diff --git a/arch/arm-raspi/exec/coldreboot.c b/arch/arm-raspi/exec/coldreboot.c new file mode 100644 index 0000000000..6a8b903524 --- /dev/null +++ b/arch/arm-raspi/exec/coldreboot.c @@ -0,0 +1,57 @@ +/* + Copyright © 2013, The AROS Development Team. All rights reserved. + $Id$ + + Desc: ColdReboot() - Reboot the computer. + Lang: english +*/ + +#include +#include +#include +#include + +#include + +#include "exec_intern.h" +#include "exec_util.h" + +/***************************************************************************** + + NAME */ + + AROS_LH0(void, ColdReboot, + +/* LOCATION */ + struct ExecBase *, SysBase, 121, Exec) + +/* FUNCTION + This function will reboot the computer. + + INPUTS + None. + + RESULT + This function does not return. + + NOTES + It can be quite harmful to call this function. It may be possible that + you will lose data from other tasks not having saved, or disk buffers + not being flushed. Plus you could annoy the (other) users. + + EXAMPLE + + BUGS + + SEE ALSO + +******************************************************************************/ +{ + AROS_LIBFUNC_INIT + + Exec_DoResetCallbacks((struct IntExecBase *)SysBase, SD_ACTION_WARMREBOOT); + + asm volatile("mov pc,#0;"); + + AROS_LIBFUNC_EXIT +} diff --git a/arch/arm-raspi/exec/mmakefile.src b/arch/arm-raspi/exec/mmakefile.src index cf1014ae8a..105133c5ec 100644 --- a/arch/arm-raspi/exec/mmakefile.src +++ b/arch/arm-raspi/exec/mmakefile.src @@ -10,7 +10,7 @@ ifneq ($(AROS_TARGET_VARIANT),) endif CFILES := \ - superstate userstate + platform_init superstate userstate coldreboot ##exec_init diff --git a/arch/arm-raspi/exec/platform_init.c b/arch/arm-raspi/exec/platform_init.c new file mode 100644 index 0000000000..62fec7b776 --- /dev/null +++ b/arch/arm-raspi/exec/platform_init.c @@ -0,0 +1,43 @@ +/* + Copyright © 2013, The AROS Development Team. All rights reserved. + $Id$ +*/ + +#define DEBUG 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Linked from kernel.resource, + * need to retrieve in a cleaner fashion .. */ +extern IPTR stack[]; + +static int PlatformInit(struct ExecBase *SysBase) +{ + D(bug("[Exec] PlatformInit()\n")); + + struct Task *BootTask = SysBase->ThisTask; + D(bug("[Exec] PlatformInit: Boot Task @ 0x%p\n", BootTask)); + + /* for our sanity we will tell exec about the correct stack for the boot task */ + BootTask->tc_SPLower = stack; + BootTask->tc_SPUpper = stack + STACK_SIZE; +#if (1) + // Temp Hack + BootTask->tc_SPReg = BootTask->tc_SPUpper - sizeof(IPTR); +#endif + + return TRUE; +} + +ADD2INITLIB(PlatformInit, 0) -- 2.11.4.GIT