mirror of https://github.com/deadw00d/AROS.git
use a syscall to halt the system, so that it can issue halts to additional cores on smp systems.
This commit is contained in:
parent
900950b844
commit
550f21cde2
|
@ -154,7 +154,7 @@ BOOL core_SetIDTGate(x86vectgate_t *IGATES, int vect, uintptr_t gate, BOOL enabl
|
|||
}
|
||||
else
|
||||
{
|
||||
bug("[Kernel]" DEBUGCOLOR_SET " %s: Vector #%d gate already enabled!" DEBUGCOLOR_RESET "\n", __func__, vect);
|
||||
bug("[Kernel]" DEBUGCOLOR_SET " %s: 0x%p Vector #%d gate already enabled!" DEBUGCOLOR_RESET "\n", __func__, IGATES, vect);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ void core_IRQHandle(struct ExceptionContext *regs, unsigned long error_code, uns
|
|||
if (pdata)
|
||||
{
|
||||
pdata->kb_PDFlags |= PLATFORMF_INIRQ;
|
||||
#if (0)
|
||||
#if defined(KERNEL_IRQSTORESSE)
|
||||
if (pdata->kb_FXCtx)
|
||||
{
|
||||
DIRQ(bug("[kernel]" DEBUGCOLOR_SET " %s(%d): saving to kb_FXCt @ 0x%p" DEBUGCOLOR_RESET "\n", __func__, int_number, pdata->kb_FXCtx);)
|
||||
|
@ -359,7 +359,7 @@ void core_IRQHandle(struct ExceptionContext *regs, unsigned long error_code, uns
|
|||
}
|
||||
if (pdata)
|
||||
{
|
||||
#if (0)
|
||||
#if defined(KERNEL_IRQSTORESSE)
|
||||
if (pdata->kb_FXCtx)
|
||||
{
|
||||
DIRQ(bug("[kernel]" DEBUGCOLOR_SET " %s(%d): Device IRQ - restoring fp state from kb_FXCt @ 0x%p" DEBUGCOLOR_RESET "\n", __func__, int_number, pdata->kb_FXCtx);)
|
||||
|
|
|
@ -103,9 +103,7 @@ void cpu_Trap(struct ExceptionContext *regs, unsigned long error_code, unsigned
|
|||
{
|
||||
bug("[Kernel] %s(%u) UNHANDLED EXCEPTION\n", __func__, irq_number);
|
||||
PrintContext(regs, error_code);
|
||||
|
||||
//TODO: Stop other cores on SMP systems....
|
||||
while (1) asm volatile ("hlt");
|
||||
X86_HandleSysHaltSC(regs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 1995-2014, The AROS Development Team. All rights reserved.
|
||||
Copyright (C) 1995-2023, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <aros/kernel.h>
|
||||
|
@ -30,7 +30,8 @@ AROS_LH2(void, KrnDisplayAlert,
|
|||
* Unfortunately we have no input yet, so just stop.
|
||||
*/
|
||||
PrintString("\nSystem halted. Reset the machine.", KernelBase);
|
||||
for(;;);
|
||||
|
||||
krnSysCallSystemHalt();
|
||||
}
|
||||
|
||||
/* Recoverable alerts don't halt the machine. They are just dropped to debug log. */
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "apic.h"
|
||||
#include "smp.h"
|
||||
|
||||
#include "x86_syscalls.h"
|
||||
|
||||
#define D(x)
|
||||
//#define TEST_SMP_IPI
|
||||
|
||||
|
@ -116,9 +118,6 @@ const struct Resident kernelpost_romtag =
|
|||
(APTR)KernelPost
|
||||
};
|
||||
|
||||
extern struct syscallx86_Handler x86_SCRebootHandler;
|
||||
extern struct syscallx86_Handler x86_SCChangePMStateHandler;
|
||||
|
||||
#if defined(TEST_SMP_IPI)
|
||||
struct Hook test_ipi;
|
||||
|
||||
|
@ -166,6 +165,7 @@ static AROS_UFH3 (APTR, KernelPost,
|
|||
Disable();
|
||||
|
||||
// Add the default reboot/shutdown handlers if ACPI ones haven't been registered
|
||||
krnAddSysCallHandler(pdata, &x86_SCSysHaltHandler, TRUE, FALSE);
|
||||
krnAddSysCallHandler(pdata, &x86_SCRebootHandler, TRUE, FALSE);
|
||||
krnAddSysCallHandler(pdata, &x86_SCChangePMStateHandler, TRUE, FALSE);
|
||||
|
||||
|
|
|
@ -154,6 +154,27 @@ struct syscallx86_Handler x86_SCChangePMStateHandler =
|
|||
(APTR)X86_HandleChangePMStateSC
|
||||
};
|
||||
|
||||
void X86_HandleSysHaltSC(struct ExceptionContext *regs)
|
||||
{
|
||||
D(bug("[Kernel] %s()\n", __func__));
|
||||
#if defined(__AROSEXEC_SMP__)
|
||||
//TODO: Halt other CPU cores.
|
||||
#endif
|
||||
for(;;)
|
||||
{
|
||||
__asm__ __volatile__("cli; hlt;");
|
||||
}
|
||||
}
|
||||
|
||||
struct syscallx86_Handler x86_SCSysHaltHandler =
|
||||
{
|
||||
{
|
||||
.ln_Name = (APTR)SC_X86SYSHALT
|
||||
},
|
||||
(APTR)X86_HandleSysHaltSC
|
||||
};
|
||||
|
||||
|
||||
/* Generic warm-reset handler */
|
||||
|
||||
void X86_HandleRebootSC()
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
#define SC_X86CPUSPINLOCK 0xFD
|
||||
#define SC_X86SWITCH 0xFC
|
||||
#define SC_X86RESCHEDTASK 0xFB
|
||||
#define SC_X86SYSHALT 0xFA
|
||||
|
||||
#define krnSysCallSystemHalt() \
|
||||
({ \
|
||||
__asm__ __volatile__ ("int $0xfe"::"a"(SC_X86SYSHALT):"memory"); \
|
||||
})
|
||||
|
||||
#define krnSysCallSwitch() \
|
||||
({ \
|
||||
|
@ -43,4 +49,9 @@
|
|||
__value; \
|
||||
})
|
||||
|
||||
extern void X86_HandleSysHaltSC(struct ExceptionContext *regs);
|
||||
extern struct syscallx86_Handler x86_SCRebootHandler;
|
||||
extern struct syscallx86_Handler x86_SCChangePMStateHandler;
|
||||
extern struct syscallx86_Handler x86_SCSysHaltHandler;
|
||||
|
||||
#endif /* !X86_SYSCALLS_H */
|
||||
|
|
Loading…
Reference in New Issue