mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 13:11:22 +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;
|
||||
}
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
FrLdrBugCheckWithMessage(
|
||||
ULONG BugCode,
|
||||
|
|
|
@ -12,25 +12,25 @@ typedef struct _FRAME
|
|||
|
||||
static const CHAR *i386ExceptionDescriptionText[] =
|
||||
{
|
||||
"Exception 00: DIVIDE BY ZERO",
|
||||
"Exception 01: DEBUG EXCEPTION",
|
||||
"Exception 02: NON-MASKABLE INTERRUPT EXCEPTION",
|
||||
"Exception 03: BREAKPOINT (INT 3)",
|
||||
"Exception 04: OVERFLOW",
|
||||
"Exception 05: BOUND EXCEPTION",
|
||||
"Exception 06: INVALID OPCODE",
|
||||
"Exception 07: FPU NOT AVAILABLE",
|
||||
"Exception 08: DOUBLE FAULT",
|
||||
"Exception 09: COPROCESSOR SEGMENT OVERRUN",
|
||||
"Exception 0A: INVALID TSS",
|
||||
"Exception 0B: SEGMENT NOT PRESENT",
|
||||
"Exception 0C: STACK EXCEPTION",
|
||||
"Exception 0D: GENERAL PROTECTION FAULT",
|
||||
"Exception 0E: PAGE FAULT",
|
||||
"Exception 0F: Reserved",
|
||||
"Exception 10: COPROCESSOR ERROR",
|
||||
"Exception 11: ALIGNMENT CHECK",
|
||||
"Exception 12: MACHINE CHECK"
|
||||
"DIVIDE BY ZERO",
|
||||
"DEBUG EXCEPTION",
|
||||
"NON-MASKABLE INTERRUPT EXCEPTION",
|
||||
"BREAKPOINT (INT 3)",
|
||||
"OVERFLOW",
|
||||
"BOUND EXCEPTION",
|
||||
"INVALID OPCODE",
|
||||
"FPU NOT AVAILABLE",
|
||||
"DOUBLE FAULT",
|
||||
"COPROCESSOR SEGMENT OVERRUN",
|
||||
"INVALID TSS",
|
||||
"SEGMENT NOT PRESENT",
|
||||
"STACK EXCEPTION",
|
||||
"GENERAL PROTECTION FAULT",
|
||||
"PAGE FAULT",
|
||||
"Reserved",
|
||||
"COPROCESSOR ERROR",
|
||||
"ALIGNMENT CHECK",
|
||||
"MACHINE CHECK"
|
||||
};
|
||||
|
||||
#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"
|
||||
"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
|
||||
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]);
|
||||
}
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
FrLdrBugCheckWithMessage(
|
||||
ULONG BugCode,
|
||||
|
@ -227,8 +231,9 @@ FrLdrBugCheckWithMessage(
|
|||
for (;;);
|
||||
}
|
||||
|
||||
static
|
||||
DECLSPEC_NORETURN
|
||||
void
|
||||
NTAPI
|
||||
FrLdrBugCheckEx(
|
||||
ULONG BugCode,
|
||||
PCHAR File,
|
||||
|
@ -256,6 +261,7 @@ FrLdrBugCheckEx(
|
|||
for (;;);
|
||||
}
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
void
|
||||
NTAPI
|
||||
FrLdrBugCheck(ULONG BugCode)
|
||||
|
|
|
@ -142,6 +142,7 @@ TRAP_STUB _i386AlignmentCheck, 17
|
|||
TRAP_STUB _i386MachineCheck, 18
|
||||
TRAP_STUB _i386SimdFloatError, 19
|
||||
|
||||
#if DBG
|
||||
/************************************************************************
|
||||
* 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 _MEMORY_READWRITE_BREAKPOINT4, HEX(00fffffff), HEX(0300003c0)
|
||||
BREAKPOINT_TEMPLATE _MEMORY_WRITE_BREAKPOINT4, HEX(00fffffff), HEX(0100003c0)
|
||||
#endif // DBG
|
||||
|
||||
END
|
||||
|
|
|
@ -80,6 +80,7 @@ ExecuteLoaderCleanly(PVOID PreviousStack)
|
|||
}
|
||||
|
||||
#ifndef _M_ARM
|
||||
DECLSPEC_NORETURN
|
||||
VOID __cdecl Reboot(VOID)
|
||||
{
|
||||
//TODO: Replace with a true firmware reboot eventually
|
||||
|
|
|
@ -34,6 +34,7 @@ extern ULONG gDiskReadBuffer, gFileSysBuffer;
|
|||
|
||||
#define DriveMapGetBiosDriveNumber(DeviceName) 0
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
FORCEINLINE VOID Reboot(VOID)
|
||||
{
|
||||
DbgBreakPoint();
|
||||
|
|
|
@ -23,6 +23,17 @@
|
|||
#define TAG_HW_RESOURCE_LIST 'lRwH'
|
||||
#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 ***************************************************************/
|
||||
|
||||
/* hardware.c */
|
||||
|
|
|
@ -182,6 +182,7 @@ VOID __cdecl ChainLoadBiosBootSectorCode(
|
|||
IN UCHAR BootDrive OPTIONAL,
|
||||
IN ULONG BootPartition OPTIONAL);
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID __cdecl Relocator16Boot(
|
||||
IN REGS* In,
|
||||
IN USHORT StackSegment,
|
||||
|
@ -189,7 +190,9 @@ VOID __cdecl Relocator16Boot(
|
|||
IN USHORT CodeSegment,
|
||||
IN USHORT CodePointer);
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID __cdecl Reboot(VOID);
|
||||
|
||||
VOID DetectHardware(VOID);
|
||||
|
||||
#endif /* ! __ASM__ */
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
//
|
||||
// You may have as many BREAKPOINT()'s as you like but you may only
|
||||
// have up to four of any of the others.
|
||||
#define BREAKPOINT() __asm__ ("int $3");
|
||||
#define BREAKPOINT() __debugbreak()
|
||||
void INSTRUCTION_BREAKPOINT1(unsigned long addr);
|
||||
void MEMORY_READWRITE_BREAKPOINT1(unsigned long addr);
|
||||
void MEMORY_WRITE_BREAKPOINT1(unsigned long addr);
|
||||
|
@ -125,10 +125,12 @@ void MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
|
|||
|
||||
#endif // DBG
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
void
|
||||
NTAPI
|
||||
FrLdrBugCheck(ULONG BugCode);
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
FrLdrBugCheckWithMessage(
|
||||
ULONG BugCode,
|
||||
|
|
|
@ -129,6 +129,7 @@ typedef struct
|
|||
#include <poppack.h>
|
||||
|
||||
// Implemented in linux.S
|
||||
DECLSPEC_NORETURN
|
||||
VOID __cdecl
|
||||
BootLinuxKernel(
|
||||
_In_ ULONG KernelSize,
|
||||
|
|
|
@ -588,6 +588,20 @@ HalInitializeBios(
|
|||
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
||||
#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 ADDRESS_USAGE HalpDefaultIoSpace;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
add_definitions(-D_MINIHAL_)
|
||||
|
||||
list(APPEND MINI_HAL_SOURCE
|
||||
../generic/portio.c
|
||||
../legacy/bus/bushndlr.c
|
||||
../legacy/bus/cmosbus.c
|
||||
../legacy/bus/isabus.c
|
||||
|
|
Loading…
Reference in a new issue