1
0
mirror of https://github.com/deadw00d/AROS.git synced 2025-10-26 21:18:42 +00:00
Files
AROS-v0/arch/all-pc/exec/powerstate_handlers.c
deadwood 1ebb5df920 Introduce EMERGENCY flag for ShutdownA
This flag indicates that something has already gone wrong and least
amount of code should be used to do reboot or shutdown. This means
not running non-critical reset handlers. Note that the handler itself
needs to decide whethere it is critical or not.
2022-01-16 10:28:06 +01:00

76 lines
1.6 KiB
C

/*
Copyright (C) 1995-2017, The AROS Development Team. All rights reserved.
Desc: default x86 power state handlers
*/
#include <exec/interrupts.h>
#include <asm/io.h>
#include <proto/exec.h>
#define __AROS_KERNEL__
#include "exec_intern.h"
/* Call the kernel to perform a Cold Reset */
AROS_INTH1(Exec_X86ColdResetHandler, struct Interrupt *, handler)
{
AROS_INTFUNC_INIT
UBYTE action = handler->is_Node.ln_Type & SD_ACTION_MASK;
if (action == SD_ACTION_COLDREBOOT)
{
krnSysCallChangePMState(0xFF);
}
return FALSE;
AROS_INTFUNC_EXIT
}
/* Call the kernel to perform a Warm Reset */
AROS_INTH1(Exec_X86WarmResetHandler, struct Interrupt *, handler)
{
AROS_INTFUNC_INIT
UBYTE action = handler->is_Node.ln_Type & SD_ACTION_MASK;
if (action == SD_ACTION_WARMREBOOT)
{
/* Tell kernel to reboot */
__asm__ __volatile__ ("int $0xfe"::"a"(0x100));
}
/* We really should not return from that */
return FALSE;
AROS_INTFUNC_EXIT
}
/* This reset handler is called at the end of the shut down
* chain (after the power-off screen), and calls the kernel
* provided routine to power off the hardware if possible.
*/
AROS_INTH1(Exec_X86ShutdownHandler, struct Interrupt *, handler)
{
AROS_INTFUNC_INIT
SuperState();
while (TRUE)
{
/*
* Either we will forever loop looking for a
* syscall shutdown handler, or call an appropriate one =)
*/
krnSysCallChangePMState(0);
};
/* We really should not return from that */
return FALSE;
AROS_INTFUNC_EXIT
}