We need to call HalReleaseDisplayOwnership before killing all running processes.
[reactos.git] / reactos / hal / halx86 / generic / reboot.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/hal/x86/reboot.c
6 * PURPOSE: Reboot functions.
7 * PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
8 * UPDATE HISTORY:
9 * Created 11/10/99
10 */
11
12 #include <hal.h>
13 #define NDEBUG
14 #include <debug.h>
15
16
17 static VOID
18 HalReboot (VOID)
19 {
20 char data;
21 extern PVOID HalpZeroPageMapping;
22
23 /* enable warm reboot */
24 ((PUCHAR)HalpZeroPageMapping)[0x472] = 0x34;
25 ((PUCHAR)HalpZeroPageMapping)[0x473] = 0x12;
26
27 /* disable interrupts */
28 Ki386DisableInterrupts();
29
30
31 /* disable periodic interrupt (RTC) */
32 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0b);
33 data = READ_PORT_UCHAR((PUCHAR)0x71);
34 WRITE_PORT_UCHAR((PUCHAR)0x71, (UCHAR)(data & 0xbf));
35
36 /* */
37 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0a);
38 data = READ_PORT_UCHAR((PUCHAR)0x71);
39 WRITE_PORT_UCHAR((PUCHAR)0x71, (UCHAR)((data & 0xf0) | 0x06));
40
41 /* */
42 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x15);
43
44 /* generate RESET signal via keyboard controller */
45 WRITE_PORT_UCHAR((PUCHAR)0x64, 0xfe);
46
47 /* stop the processor */
48 #if 1
49 Ki386HaltProcessor();
50 for(;;);
51 #endif
52 }
53
54
55 VOID STDCALL
56 HalReturnToFirmware (
57 FIRMWARE_REENTRY Action
58 )
59 {
60 if (Action == HalHaltRoutine)
61 {
62 DbgPrint ("HalReturnToFirmware called!\n");
63 DbgBreakPoint ();
64 }
65 else if (Action == HalRebootRoutine)
66 {
67 HalReboot ();
68 }
69 }
70
71 /* EOF */