mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:02:56 +00:00
[MINIHAL] Minor improvements (#7398)
* [FREELDR] Mark noreturn functions * [FREELDR] Compile hw debugging support code only in debug builds - Make BREAKPOINT() portable * [FREELDR] Consolidate identical names into a single string * [FREELDR] Use intrinsics for string I/O operations on x86 and x64 Stop them being pulled in from a static minihal library * [MINIHAL] Exclude unnecessary portio dependency
This commit is contained in:
parent
0089017d54
commit
029e53ddb5
11 changed files with 64 additions and 23 deletions
|
@ -24,6 +24,7 @@ Rs232PortPutByte(UCHAR ByteToSend)
|
||||||
*UART0DR = ByteToSend;
|
*UART0DR = ByteToSend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID
|
VOID
|
||||||
FrLdrBugCheckWithMessage(
|
FrLdrBugCheckWithMessage(
|
||||||
ULONG BugCode,
|
ULONG BugCode,
|
||||||
|
|
|
@ -12,25 +12,25 @@ typedef struct _FRAME
|
||||||
|
|
||||||
static const CHAR *i386ExceptionDescriptionText[] =
|
static const CHAR *i386ExceptionDescriptionText[] =
|
||||||
{
|
{
|
||||||
"Exception 00: DIVIDE BY ZERO",
|
"DIVIDE BY ZERO",
|
||||||
"Exception 01: DEBUG EXCEPTION",
|
"DEBUG EXCEPTION",
|
||||||
"Exception 02: NON-MASKABLE INTERRUPT EXCEPTION",
|
"NON-MASKABLE INTERRUPT EXCEPTION",
|
||||||
"Exception 03: BREAKPOINT (INT 3)",
|
"BREAKPOINT (INT 3)",
|
||||||
"Exception 04: OVERFLOW",
|
"OVERFLOW",
|
||||||
"Exception 05: BOUND EXCEPTION",
|
"BOUND EXCEPTION",
|
||||||
"Exception 06: INVALID OPCODE",
|
"INVALID OPCODE",
|
||||||
"Exception 07: FPU NOT AVAILABLE",
|
"FPU NOT AVAILABLE",
|
||||||
"Exception 08: DOUBLE FAULT",
|
"DOUBLE FAULT",
|
||||||
"Exception 09: COPROCESSOR SEGMENT OVERRUN",
|
"COPROCESSOR SEGMENT OVERRUN",
|
||||||
"Exception 0A: INVALID TSS",
|
"INVALID TSS",
|
||||||
"Exception 0B: SEGMENT NOT PRESENT",
|
"SEGMENT NOT PRESENT",
|
||||||
"Exception 0C: STACK EXCEPTION",
|
"STACK EXCEPTION",
|
||||||
"Exception 0D: GENERAL PROTECTION FAULT",
|
"GENERAL PROTECTION FAULT",
|
||||||
"Exception 0E: PAGE FAULT",
|
"PAGE FAULT",
|
||||||
"Exception 0F: Reserved",
|
"Reserved",
|
||||||
"Exception 10: COPROCESSOR ERROR",
|
"COPROCESSOR ERROR",
|
||||||
"Exception 11: ALIGNMENT CHECK",
|
"ALIGNMENT CHECK",
|
||||||
"Exception 12: MACHINE CHECK"
|
"MACHINE CHECK"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SCREEN_ATTR 0x1F // Bright white on blue background
|
#define SCREEN_ATTR 0x1F // Bright white on blue background
|
||||||
|
@ -118,7 +118,10 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
|
||||||
|
|
||||||
PrintText("FreeLdr " KERNEL_VERSION_STR " " KERNEL_VERSION_BUILD_STR "\n"
|
PrintText("FreeLdr " KERNEL_VERSION_STR " " KERNEL_VERSION_BUILD_STR "\n"
|
||||||
"Report this error on the ReactOS Bug Tracker: https://jira.reactos.org\n\n"
|
"Report this error on the ReactOS Bug Tracker: https://jira.reactos.org\n\n"
|
||||||
"0x%02lx: %s\n\n", TrapIndex, i386ExceptionDescriptionText[TrapIndex]);
|
"0x%02lx: Exception %02X: %s\n\n",
|
||||||
|
TrapIndex,
|
||||||
|
TrapIndex,
|
||||||
|
i386ExceptionDescriptionText[TrapIndex]);
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
PrintText("EAX: %.8lx ESP: %.8lx CR0: %.8lx DR0: %.8lx\n",
|
PrintText("EAX: %.8lx ESP: %.8lx CR0: %.8lx DR0: %.8lx\n",
|
||||||
|
@ -194,6 +197,7 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
|
||||||
InstructionPointer[6], InstructionPointer[7]);
|
InstructionPointer[6], InstructionPointer[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID
|
VOID
|
||||||
FrLdrBugCheckWithMessage(
|
FrLdrBugCheckWithMessage(
|
||||||
ULONG BugCode,
|
ULONG BugCode,
|
||||||
|
@ -227,8 +231,9 @@ FrLdrBugCheckWithMessage(
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
DECLSPEC_NORETURN
|
||||||
void
|
void
|
||||||
NTAPI
|
|
||||||
FrLdrBugCheckEx(
|
FrLdrBugCheckEx(
|
||||||
ULONG BugCode,
|
ULONG BugCode,
|
||||||
PCHAR File,
|
PCHAR File,
|
||||||
|
@ -256,6 +261,7 @@ FrLdrBugCheckEx(
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
void
|
void
|
||||||
NTAPI
|
NTAPI
|
||||||
FrLdrBugCheck(ULONG BugCode)
|
FrLdrBugCheck(ULONG BugCode)
|
||||||
|
|
|
@ -142,6 +142,7 @@ TRAP_STUB _i386AlignmentCheck, 17
|
||||||
TRAP_STUB _i386MachineCheck, 18
|
TRAP_STUB _i386MachineCheck, 18
|
||||||
TRAP_STUB _i386SimdFloatError, 19
|
TRAP_STUB _i386SimdFloatError, 19
|
||||||
|
|
||||||
|
#if DBG
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* DEBUGGING SUPPORT FUNCTIONS
|
* DEBUGGING SUPPORT FUNCTIONS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -176,5 +177,6 @@ BREAKPOINT_TEMPLATE _MEMORY_WRITE_BREAKPOINT3, HEX(0f0ffffff), HEX(001000330)
|
||||||
BREAKPOINT_TEMPLATE _INSTRUCTION_BREAKPOINT4, HEX(00fffffff), HEX(0000003c0)
|
BREAKPOINT_TEMPLATE _INSTRUCTION_BREAKPOINT4, HEX(00fffffff), HEX(0000003c0)
|
||||||
BREAKPOINT_TEMPLATE _MEMORY_READWRITE_BREAKPOINT4, HEX(00fffffff), HEX(0300003c0)
|
BREAKPOINT_TEMPLATE _MEMORY_READWRITE_BREAKPOINT4, HEX(00fffffff), HEX(0300003c0)
|
||||||
BREAKPOINT_TEMPLATE _MEMORY_WRITE_BREAKPOINT4, HEX(00fffffff), HEX(0100003c0)
|
BREAKPOINT_TEMPLATE _MEMORY_WRITE_BREAKPOINT4, HEX(00fffffff), HEX(0100003c0)
|
||||||
|
#endif // DBG
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -80,6 +80,7 @@ ExecuteLoaderCleanly(PVOID PreviousStack)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _M_ARM
|
#ifndef _M_ARM
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID __cdecl Reboot(VOID)
|
VOID __cdecl Reboot(VOID)
|
||||||
{
|
{
|
||||||
//TODO: Replace with a true firmware reboot eventually
|
//TODO: Replace with a true firmware reboot eventually
|
||||||
|
|
|
@ -34,6 +34,7 @@ extern ULONG gDiskReadBuffer, gFileSysBuffer;
|
||||||
|
|
||||||
#define DriveMapGetBiosDriveNumber(DeviceName) 0
|
#define DriveMapGetBiosDriveNumber(DeviceName) 0
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
FORCEINLINE VOID Reboot(VOID)
|
FORCEINLINE VOID Reboot(VOID)
|
||||||
{
|
{
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
|
|
|
@ -23,6 +23,17 @@
|
||||||
#define TAG_HW_RESOURCE_LIST 'lRwH'
|
#define TAG_HW_RESOURCE_LIST 'lRwH'
|
||||||
#define TAG_HW_DISK_CONTEXT 'cDwH'
|
#define TAG_HW_DISK_CONTEXT 'cDwH'
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These aren't defined in the ioaccess.h header.
|
||||||
|
* Because of that we manually define the symbols we need to make use of I/O ports.
|
||||||
|
*/
|
||||||
|
#define READ_PORT_BUFFER_UCHAR(port, buffer, count) __inbytestring(H2I(port), buffer, count)
|
||||||
|
#define READ_PORT_BUFFER_USHORT(port, buffer, count) __inwordstring(H2I(port), buffer, count)
|
||||||
|
#define READ_PORT_BUFFER_ULONG(port, buffer, count) __indwordstring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_UCHAR(port, buffer, count) __outbytestring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_USHORT(port, buffer, count) __outwordstring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_ULONG(port, buffer, count) __outdwordstring(H2I(port), buffer, count)
|
||||||
|
|
||||||
/* PROTOTYPES ***************************************************************/
|
/* PROTOTYPES ***************************************************************/
|
||||||
|
|
||||||
/* hardware.c */
|
/* hardware.c */
|
||||||
|
|
|
@ -182,6 +182,7 @@ VOID __cdecl ChainLoadBiosBootSectorCode(
|
||||||
IN UCHAR BootDrive OPTIONAL,
|
IN UCHAR BootDrive OPTIONAL,
|
||||||
IN ULONG BootPartition OPTIONAL);
|
IN ULONG BootPartition OPTIONAL);
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID __cdecl Relocator16Boot(
|
VOID __cdecl Relocator16Boot(
|
||||||
IN REGS* In,
|
IN REGS* In,
|
||||||
IN USHORT StackSegment,
|
IN USHORT StackSegment,
|
||||||
|
@ -189,7 +190,9 @@ VOID __cdecl Relocator16Boot(
|
||||||
IN USHORT CodeSegment,
|
IN USHORT CodeSegment,
|
||||||
IN USHORT CodePointer);
|
IN USHORT CodePointer);
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID __cdecl Reboot(VOID);
|
VOID __cdecl Reboot(VOID);
|
||||||
|
|
||||||
VOID DetectHardware(VOID);
|
VOID DetectHardware(VOID);
|
||||||
|
|
||||||
#endif /* ! __ASM__ */
|
#endif /* ! __ASM__ */
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
//
|
//
|
||||||
// You may have as many BREAKPOINT()'s as you like but you may only
|
// You may have as many BREAKPOINT()'s as you like but you may only
|
||||||
// have up to four of any of the others.
|
// have up to four of any of the others.
|
||||||
#define BREAKPOINT() __asm__ ("int $3");
|
#define BREAKPOINT() __debugbreak()
|
||||||
void INSTRUCTION_BREAKPOINT1(unsigned long addr);
|
void INSTRUCTION_BREAKPOINT1(unsigned long addr);
|
||||||
void MEMORY_READWRITE_BREAKPOINT1(unsigned long addr);
|
void MEMORY_READWRITE_BREAKPOINT1(unsigned long addr);
|
||||||
void MEMORY_WRITE_BREAKPOINT1(unsigned long addr);
|
void MEMORY_WRITE_BREAKPOINT1(unsigned long addr);
|
||||||
|
@ -125,10 +125,12 @@ void MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
|
||||||
|
|
||||||
#endif // DBG
|
#endif // DBG
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
void
|
void
|
||||||
NTAPI
|
NTAPI
|
||||||
FrLdrBugCheck(ULONG BugCode);
|
FrLdrBugCheck(ULONG BugCode);
|
||||||
|
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID
|
VOID
|
||||||
FrLdrBugCheckWithMessage(
|
FrLdrBugCheckWithMessage(
|
||||||
ULONG BugCode,
|
ULONG BugCode,
|
||||||
|
|
|
@ -129,6 +129,7 @@ typedef struct
|
||||||
#include <poppack.h>
|
#include <poppack.h>
|
||||||
|
|
||||||
// Implemented in linux.S
|
// Implemented in linux.S
|
||||||
|
DECLSPEC_NORETURN
|
||||||
VOID __cdecl
|
VOID __cdecl
|
||||||
BootLinuxKernel(
|
BootLinuxKernel(
|
||||||
_In_ ULONG KernelSize,
|
_In_ ULONG KernelSize,
|
||||||
|
|
|
@ -588,6 +588,20 @@ HalInitializeBios(
|
||||||
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
||||||
#endif // _M_AMD64
|
#endif // _M_AMD64
|
||||||
|
|
||||||
|
#ifdef _MINIHAL_
|
||||||
|
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||||
|
/* Use intrinsics for IA-32 and amd64 */
|
||||||
|
#include <ioaccess.h>
|
||||||
|
|
||||||
|
#define READ_PORT_BUFFER_UCHAR(port, buffer, count) __inbytestring(H2I(port), buffer, count)
|
||||||
|
#define READ_PORT_BUFFER_USHORT(port, buffer, count) __inwordstring(H2I(port), buffer, count)
|
||||||
|
#define READ_PORT_BUFFER_ULONG(port, buffer, count) __indwordstring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_UCHAR(port, buffer, count) __outbytestring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_USHORT(port, buffer, count) __outwordstring(H2I(port), buffer, count)
|
||||||
|
#define WRITE_PORT_BUFFER_ULONG(port, buffer, count) __outdwordstring(H2I(port), buffer, count)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
extern BOOLEAN HalpNMIInProgress;
|
extern BOOLEAN HalpNMIInProgress;
|
||||||
|
|
||||||
extern ADDRESS_USAGE HalpDefaultIoSpace;
|
extern ADDRESS_USAGE HalpDefaultIoSpace;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
add_definitions(-D_MINIHAL_)
|
add_definitions(-D_MINIHAL_)
|
||||||
|
|
||||||
list(APPEND MINI_HAL_SOURCE
|
list(APPEND MINI_HAL_SOURCE
|
||||||
../generic/portio.c
|
|
||||||
../legacy/bus/bushndlr.c
|
../legacy/bus/bushndlr.c
|
||||||
../legacy/bus/cmosbus.c
|
../legacy/bus/cmosbus.c
|
||||||
../legacy/bus/isabus.c
|
../legacy/bus/isabus.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue