2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: Install default reset handlers
9 #include <exec/interrupts.h>
10 #include <aros/symbolsets.h>
13 #include <proto/exec.h>
15 #include "exec_intern.h"
17 /* This reset handler is called if more modern system reset mechanisms fail
18 * or are not available */
19 AROS_INTH1(static ColdResetHandler
, struct Interrupt
*, handler
)
23 UBYTE action
= handler
->is_Node
.ln_Type
;
25 if (action
== SD_ACTION_COLDREBOOT
)
30 * On some machines (new PCs without a PS/2 controller), this might
31 * not work. So we need to be able to return cleanly.
40 /* This reset handler is called for ColdReboot() */
41 AROS_INTH1(static WarmResetHandler
, struct Interrupt
*, handler
)
45 UBYTE action
= handler
->is_Node
.ln_Type
;
47 if (action
== SD_ACTION_WARMREBOOT
)
49 /* Tell kernel to reboot */
50 __asm__
__volatile__ ("int $0x80"::"a"(0x100));
53 /* We really should not return from that */
59 /* This reset handler is called if software power-off or reboot has not
60 * occurred. It is called after the shutdown screen is shown so that the
61 * system isn't still alive in the background */
62 AROS_INTH1(static ShutdownHandler
, struct Interrupt
*, handler
)
67 while (TRUE
) asm volatile("hlt");
69 /* We really should not return from that */
75 /* Install handlers */
76 int Exec_ResetInit(struct IntExecBase
*SysBase
)
78 SysBase
->ColdResetHandler
.is_Node
.ln_Pri
= -64;
79 SysBase
->ColdResetHandler
.is_Node
.ln_Name
= "keyboard controller reset";
80 SysBase
->ColdResetHandler
.is_Code
= (VOID_FUNC
)ColdResetHandler
;
81 SysBase
->ColdResetHandler
.is_Data
= &SysBase
->ColdResetHandler
;
82 AddResetCallback(&SysBase
->ColdResetHandler
);
84 SysBase
->WarmResetHandler
.is_Node
.ln_Pri
= -64;
85 SysBase
->WarmResetHandler
.is_Node
.ln_Name
= "kernel reset";
86 SysBase
->WarmResetHandler
.is_Code
= (VOID_FUNC
)WarmResetHandler
;
87 SysBase
->WarmResetHandler
.is_Data
= &SysBase
->WarmResetHandler
;
88 AddResetCallback(&SysBase
->WarmResetHandler
);
90 SysBase
->ShutdownHandler
.is_Node
.ln_Pri
= -128;
91 SysBase
->ShutdownHandler
.is_Node
.ln_Name
= "HLT shutdown";
92 SysBase
->ShutdownHandler
.is_Code
= (VOID_FUNC
)ShutdownHandler
;
93 SysBase
->ShutdownHandler
.is_Data
= &SysBase
->ShutdownHandler
;
94 AddResetCallback(&SysBase
->ShutdownHandler
);
99 ADD2INITLIB(Exec_ResetInit
, 0)