10 Commits

22 changed files with 4183 additions and 4092 deletions

View File

@@ -1,20 +1,6 @@
## ExectOS Ideas ## ExectOS Ideas
This is a list of ideas that migh but not must be realized. This is a list of ideas that migh but not must be realized.
### SDK
- [ ] Currently XT Development Kit (XTDK) is a garbage. It should be cleaned up the way, it contains all structures
and definitions, as well as all routines that are exported and can be used by other components or software
dynamically linked. All other routines should be available as well in some form, as some libraries can share
code with others (eg. XTLDR calls routines exported by XTOSKRNL). This is partially done, as XTDK has been
cleaned up, but still there are routines used by XTLDR.
### XTLDR
- [ ] Rewrite memory mapping and paging support in bootloader to make it more flexible and architecture independent.
This should support paging levels, thus allowing to make a use of PML5 on modern AMD64 processors and increasing
the addressable virtual memory from 256TB to 128PB. This is partially done.
- [ ] Implement editing boot menu entries directly from the boot menu. Changes should be runtime only (not stored on
disk).
### XTOSKRNL ### XTOSKRNL
- [ ] Implement mechanism for detecting CPU features and checking hardware requirements. If CPU does not meet - [ ] Implement mechanism for detecting CPU features and checking hardware requirements. If CPU does not meet
requirements, it should cause a kernel panic before any non-supported instruction is being used. requirements, it should cause a kernel panic before any non-supported instruction is being used.

View File

@@ -59,6 +59,34 @@ function(add_module_linker_flags MODULE FLAGS)
set_module_property(${MODULE} LINK_FLAGS ${FLAGS}) set_module_property(${MODULE} LINK_FLAGS ${FLAGS})
endfunction() endfunction()
# This function compiles an assembly bootsector file into a flat binary
function(compile_bootsector NAME SOURCE BASEADDR ENTRYPOINT)
set(BINARY_NAME "${NAME}.bin")
set(OBJECT_NAME "${NAME}.obj")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
COMMAND ${CMAKE_ASM_COMPILER}
/nologo
--target=i386-none-elf
/Fo${CMAKE_CURRENT_BINARY_DIR}/${OBJECT_NAME}
-c -- ${SOURCE}
COMMAND ${CMAKE_ASM_LINKER}
-m elf_i386
--image-base=0
--oformat binary
-Ttext=${BASEADDR}
--entry=_start${ENTRYPOINT}
-o ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
${CMAKE_CURRENT_BINARY_DIR}/${OBJECT_NAME}
DEPENDS ${SOURCE}
)
add_custom_target(${NAME} ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
)
endfunction()
# This function sets a property for specified module # This function sets a property for specified module
function(set_module_property MODULE PROPERTY FLAGS) function(set_module_property MODULE PROPERTY FLAGS)
if(NOT ${ARGC} EQUAL 3) if(NOT ${ARGC} EQUAL 3)

View File

@@ -3,8 +3,10 @@ set(CMAKE_SYSTEM_NAME Windows)
# Set toolchain compilers # Set toolchain compilers
set(CMAKE_ASM_COMPILER clang-cl) set(CMAKE_ASM_COMPILER clang-cl)
set(CMAKE_ASM_LINKER ld.lld)
set(CMAKE_C_COMPILER clang-cl) set(CMAKE_C_COMPILER clang-cl)
set(CMAKE_CXX_COMPILER clang-cl) set(CMAKE_CXX_COMPILER clang-cl)
set(CMAKE_LINKER lld-link)
set(CMAKE_MC_COMPILER wmc) set(CMAKE_MC_COMPILER wmc)
set(CMAKE_RC_COMPILER wrc) set(CMAKE_RC_COMPILER wrc)
set(CMAKE_SPEC_COMPILER xtcspecc) set(CMAKE_SPEC_COMPILER xtcspecc)

View File

@@ -15,14 +15,26 @@
#define XTCLINK extern "C" #define XTCLINK extern "C"
#define NULLPTR nullptr #define NULLPTR nullptr
/* C++ types */ /* C++ boolean type */
typedef bool BOOLEAN, *PBOOLEAN;
#define TRUE true
#define FALSE false
/* C++ widechar type */
typedef wchar_t wchar; typedef wchar_t wchar;
#else #else
/* C definitions */ /* C definitions */
#define XTCLINK #define XTCLINK
#define NULLPTR ((void *)0) #define NULLPTR ((void *)0)
/* C types */ /* C boolean type */
typedef enum _BOOLEAN
{
FALSE = 0,
TRUE = 1
} BOOLEAN, *PBOOLEAN;
/* C widechar type */
typedef unsigned short wchar; typedef unsigned short wchar;
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,6 @@
/* Enumeration lists forward references */ /* Enumeration lists forward references */
typedef enum _ADJUST_REASON ADJUST_REASON, *PADJUST_REASON; typedef enum _ADJUST_REASON ADJUST_REASON, *PADJUST_REASON;
typedef enum _BOOLEAN BOOLEAN, *PBOOLEAN;
typedef enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION, *PEXCEPTION_DISPOSITION; typedef enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION, *PEXCEPTION_DISPOSITION;
typedef enum _EFI_ALLOCATE_TYPE EFI_ALLOCATE_TYPE, *PEFI_ALLOCATE_TYPE; typedef enum _EFI_ALLOCATE_TYPE EFI_ALLOCATE_TYPE, *PEFI_ALLOCATE_TYPE;
typedef enum _EFI_FRAMEWORK_CPU_DESIGNATION EFI_FRAMEWORK_CPU_DESIGNATION, *PEFI_FRAMEWORK_CPU_DESIGNATION; typedef enum _EFI_FRAMEWORK_CPU_DESIGNATION EFI_FRAMEWORK_CPU_DESIGNATION, *PEFI_FRAMEWORK_CPU_DESIGNATION;

View File

@@ -150,13 +150,6 @@ typedef LPCWSTR PCTSTR, LPCTSTR;
typedef LPUWSTR PUTSTR, LPUTSTR; typedef LPUWSTR PUTSTR, LPUTSTR;
typedef LPCUWSTR PCUTSTR, LPCUTSTR; typedef LPCUWSTR PCUTSTR, LPCUTSTR;
/* Boolean type */
typedef enum _BOOLEAN
{
FALSE = 0,
TRUE = 1
} BOOLEAN, *PBOOLEAN;
/* 128-bit floats structure */ /* 128-bit floats structure */
typedef struct _FLOAT128 typedef struct _FLOAT128
{ {

View File

@@ -362,6 +362,13 @@ Configuration::InitializeBootMenuList(IN ULONG MaxNameLength,
return STATUS_EFI_SUCCESS; return STATUS_EFI_SUCCESS;
} }
/**
* Initializes the XTLDR configuration subsystem.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
Configuration::InitializeConfiguration() Configuration::InitializeConfiguration()

View File

@@ -387,9 +387,16 @@ Debug::PutChar(IN WCHAR Character)
return HL::ComPort::WriteComPort(&SerialPort, Buffer[0]); return HL::ComPort::WriteComPort(&SerialPort, Buffer[0]);
} }
/**
* Determines if the serial port has been successfully initialized and is ready for communication.
*
* @return This routine returns TRUE if the serial port is initialized and ready, FALSE otherwise.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
BOOLEAN BOOLEAN
Debug::SerialPortReady() Debug::SerialPortReady()
{ {
return (BOOLEAN)(SerialPort.Flags & COMPORT_FLAG_INIT); return (SerialPort.Flags & COMPORT_FLAG_INIT);
} }

View File

@@ -1,51 +0,0 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/includes/globals.hh
* DESCRIPTION: XTLDR global variables
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#ifndef __XTLDR_GLOBALS_HH
#define __XTLDR_GLOBALS_HH
#include <xtblapi.h>
/* XT Boot Loader registered boot protocol list */
EXTERN LIST_ENTRY BlpBootProtocols;
/* XT Boot Loader serial ports list */
EXTERN ULONG BlComPortList[COMPORT_COUNT];
/* XT Boot Loader configuration list */
EXTERN LIST_ENTRY BlpConfig;
/* XT Boot Loader loaded configuration */
EXTERN LIST_ENTRY BlpConfigSections;
/* List of user-editable boot options */
EXTERN PCWSTR BlpEditableConfigOptions[];
/* XT Boot Loader protocol */
EXTERN XTBL_LOADER_PROTOCOL BlpLdrProtocol;
/* XT Boot Loader loaded modules list */
EXTERN LIST_ENTRY BlpLoadedModules;
/* XT Boot Loader menu list */
EXTERN PLIST_ENTRY BlpMenuList;
/* XT Boot Loader status data */
EXTERN XTBL_STATUS BlpStatus;
/* List of available block devices */
EXTERN LIST_ENTRY EfiBlockDevices;
/* EFI Image Handle */
EXTERN EFI_HANDLE EfiImageHandle;
/* EFI System Table */
EXTERN PEFI_SYSTEM_TABLE EfiSystemTable;
#endif /* __XTLDR_GLOBALS_HH */

View File

@@ -13,7 +13,6 @@
#include <xtver.h> #include <xtver.h>
#include <libxtos.hh> #include <libxtos.hh>
#include <globals.hh>
class BootUtils class BootUtils

View File

@@ -9,6 +9,13 @@
#include <xtldr.hh> #include <xtldr.hh>
/**
* Disables access to EFI Boot Services.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
XtLoader::DisableBootServices() XtLoader::DisableBootServices()
@@ -17,6 +24,13 @@ XtLoader::DisableBootServices()
} }
/**
* Queries the availability of EFI Boot Services.
*
* @return This routine returns TRUE if EFI Boot Services are available, FALSE otherwise.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
BOOLEAN BOOLEAN
XtLoader::GetBootServicesStatus() XtLoader::GetBootServicesStatus()
@@ -24,6 +38,13 @@ XtLoader::GetBootServicesStatus()
return LoaderStatus.BootServices; return LoaderStatus.BootServices;
} }
/**
* Retrieves the EFI image handle.
*
* @return This routine returns a handle to the EFI-loaded image.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
EFI_HANDLE EFI_HANDLE
XtLoader::GetEfiImageHandle() XtLoader::GetEfiImageHandle()
@@ -31,6 +52,13 @@ XtLoader::GetEfiImageHandle()
return XtLoader::EfiImageHandle; return XtLoader::EfiImageHandle;
} }
/**
* Retrieves the EFI system table pointer.
*
* @return This routine returns a pointer to the EFI system table.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
PEFI_SYSTEM_TABLE PEFI_SYSTEM_TABLE
XtLoader::GetEfiSystemTable() XtLoader::GetEfiSystemTable()
@@ -38,6 +66,19 @@ XtLoader::GetEfiSystemTable()
return XtLoader::EfiSystemTable; return XtLoader::EfiSystemTable;
} }
/**
* Provides base address and size of the XTLDR image.
*
* @param LoaderBase
* Supplies a pointer to a variable that receives the base address of the XTLDR image.
*
* @param LoaderSize
* Supplies a pointer to a variable that receives the size of the XTLDR image.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
XtLoader::GetLoaderImageInformation(PVOID *LoaderBase, XtLoader::GetLoaderImageInformation(PVOID *LoaderBase,
@@ -47,6 +88,13 @@ XtLoader::GetLoaderImageInformation(PVOID *LoaderBase,
*LoaderSize = XtLoader::LoaderStatus.LoaderSize; *LoaderSize = XtLoader::LoaderStatus.LoaderSize;
} }
/**
* Retrieves the Secure Boot status.
*
* @return This routine returns SecureBoot status.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
INT_PTR INT_PTR
XtLoader::GetSecureBootStatus() XtLoader::GetSecureBootStatus()
@@ -143,6 +191,13 @@ XtLoader::RegisterBootMenu(IN PVOID BootMenuRoutine)
BootMenu = (PBL_XT_BOOT_MENU)BootMenuRoutine; BootMenu = (PBL_XT_BOOT_MENU)BootMenuRoutine;
} }
/**
* Invokes either a custom boot menu handler, if one has been registered, or displays the default boot menu.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
XtLoader::ShowBootMenu() XtLoader::ShowBootMenu()

View File

@@ -4,8 +4,8 @@ within the XTOS kernel space. It is responsible for various core services, such
management, and process scheduling. The kernel contains the scheduler (sometimes referred to as the Dispatcher), the management, and process scheduling. The kernel contains the scheduler (sometimes referred to as the Dispatcher), the
cache, object, and memory managers, the security manager, and other executive components described below. cache, object, and memory managers, the security manager, and other executive components described below.
All routines in the kernel are prefixed to indicate the subsystem they belong to, and their source code is organized The source code of the kernel is organized into subsystem-specific directories. Each directory name also defines the
into corresponding directories. These subsystems include: corresponding C++ namespace in which the subsystem's classes and routines reside. These subsystems include:
* Ar - Architecture-specific Library * Ar - Architecture-specific Library
* Ex - Kernel Executive * Ex - Kernel Executive
@@ -56,13 +56,20 @@ routines, for use by other kernel components.
## Function Naming Convention ## Function Naming Convention
All kernel functions adhere to a strict naming convention to enhance code readability and maintainability. The structure All kernel functions adhere to a strict naming convention to enhance code readability and maintainability. The structure
of a function name is generally composed of three parts: &lt;Prefix&gt;&lt;Operation&gt;&lt;Object&gt; of all public interfaces exposed by the kernel are generally composed of three parts:
&lt;Prefix&gt;&lt;Operation&gt;&lt;Object&gt;
The prefix identifies the component to which the function belongs. Additionally, the prefix indicates the function's The prefix identifies the component to which the function belongs. For example, consider the **KeInitializeThread()**
visibility. Private functions, which should not be called from outside their own module, have a 'p' appended to their routine:
prefix. * **Ke** - The prefix indicates a routine belonging to the Core Kernel Library (Ke).
For example, consider the **KepInitializeStack()** routine:
* **Kep** - The prefix indicates a private (p) routine belonging to the Core Kernel Library (Ke).
* **Initialize** - The operation performed by the function. * **Initialize** - The operation performed by the function.
* **Stack** - The object on which the operation is performed. * **Thread** - The object on which the operation is performed.
For all C++ code inside the kernel the naming model has evolved. Consider the **KE::KThread::InitializeThread()**
routine:
* **KE** - The namespace replaces the prefix and indicates the subsystem. Namespaces are written in uppercase and no
longer use the trailing p for private routines, because classes use C++ visibility to control access.
* **KThread** - Within each namespace, related functionality is grouped into classes, which encapsulate variables and
methods.
* **InitializeThread** - Method names follow the `<Operation><Object>` pattern.

View File

@@ -23,6 +23,25 @@ XTCDECL
VOID VOID
AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame) AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Caught trap: 0x%.2llX with error code: %.4llX at RIP: 0x%.16llX\n"
L"RAX: 0x%.16llX, RBX: 0x%.16llX, RCX: 0x%.16llX, RDX: 0x%.16llX\n"
L"R8: 0x%.16llX, R9: 0x%.16llX, R10: 0x%.16llX, R11: 0x%.16llX\n"
L"R12: 0x%.16llX, R13: 0x%.16llX, R14: 0x%.16llX, R15: 0x%.16llX\n"
L"RBP: 0x%.16llX, RSP: 0x%.16llX, RDI: 0x%.16llX, RSI: 0x%.16llX\n"
L"DR0: 0x%.16llX, DR1: 0x%.16llX, DR2: 0x%.16llX, DR3: 0x%.16llX\n"
L"DR6: 0x%.16llX, DR7: 0x%.16llX\n"
L"CR2: 0x%.16llX, CR3: 0x%.16llX, CS: 0x%.16llX, DS: 0x%.16hX\n"
L"ES: 0x%.16hX, FS: 0x%.16hX, GS: 0x%.16hX, SS: 0x%.16llX\n",
TrapFrame->Vector, TrapFrame->ErrorCode, TrapFrame->Rip,
TrapFrame->Rax, TrapFrame->Rbx, TrapFrame->Rcx, TrapFrame->Rdx,
TrapFrame->R8, TrapFrame->R9, TrapFrame->R10, TrapFrame->R11,
TrapFrame->R12, TrapFrame->R13, TrapFrame->R14, TrapFrame->R15,
TrapFrame->Rbp, TrapFrame->Rsp, TrapFrame->Rdi, TrapFrame->Rsi,
TrapFrame->Dr0, TrapFrame->Dr1, TrapFrame->Dr2, TrapFrame->Dr3,
TrapFrame->Dr6, TrapFrame->Dr7,
TrapFrame->Cr2, TrapFrame->Cr3, TrapFrame->SegCs, TrapFrame->SegDs,
TrapFrame->SegEs, TrapFrame->SegFs, TrapFrame->SegGs, TrapFrame->SegSs);
/* Check vector and call appropriate handler */ /* Check vector and call appropriate handler */
switch(TrapFrame->Vector) switch(TrapFrame->Vector)
{ {
@@ -172,7 +191,7 @@ VOID
AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n"); DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
for(;;); KE::Crash::Panic(0x00);
} }
/** /**
@@ -190,7 +209,7 @@ VOID
AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Debug exception (0x01)!\n"); DebugPrint(L"Handled Debug exception (0x01)!\n");
for(;;); KE::Crash::Panic(0x01);
} }
/** /**
@@ -208,7 +227,7 @@ VOID
AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n"); DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
for(;;); KE::Crash::Panic(0x02);
} }
/** /**
@@ -226,7 +245,7 @@ VOID
AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled INT3 (0x03)!\n"); DebugPrint(L"Handled INT3 (0x03)!\n");
for(;;); KE::Crash::Panic(0x03);
} }
/** /**
@@ -244,7 +263,7 @@ VOID
AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Overflow exception (0x04)!\n"); DebugPrint(L"Handled Overflow exception (0x04)!\n");
for(;;); KE::Crash::Panic(0x04);
} }
/** /**
@@ -262,7 +281,7 @@ VOID
AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n"); DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
for(;;); KE::Crash::Panic(0x05);
} }
/** /**
@@ -280,7 +299,7 @@ VOID
AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n"); DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
for(;;); KE::Crash::Panic(0x06);
} }
/** /**
@@ -298,7 +317,7 @@ VOID
AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Device Not Available exception (0x07)!\n"); DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
for(;;); KE::Crash::Panic(0x07);
} }
/** /**
@@ -316,7 +335,7 @@ VOID
AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Double-Fault exception (0x08)!\n"); DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
for(;;); KE::Crash::Panic(0x08);
} }
/** /**
@@ -334,7 +353,7 @@ VOID
AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n"); DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
for(;;); KE::Crash::Panic(0x09);
} }
/** /**
@@ -352,7 +371,7 @@ VOID
AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n"); DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
for(;;); KE::Crash::Panic(0x0A);
} }
/** /**
@@ -370,7 +389,7 @@ VOID
AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n"); DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
for(;;); KE::Crash::Panic(0x0B);
} }
/** /**
@@ -388,7 +407,7 @@ VOID
AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n"); DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
for(;;); KE::Crash::Panic(0x0C);
} }
/** /**
@@ -406,7 +425,7 @@ VOID
AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n"); DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
for(;;); KE::Crash::Panic(0x0D);
} }
/** /**
@@ -424,7 +443,7 @@ VOID
AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n"); DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
for(;;); KE::Crash::Panic(0x0E);
} }
/** /**
@@ -442,7 +461,7 @@ VOID
AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n"); DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
for(;;); KE::Crash::Panic(0x10);
} }
/** /**
@@ -460,7 +479,7 @@ VOID
AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n"); DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
for(;;); KE::Crash::Panic(0x11);
} }
/** /**
@@ -478,7 +497,7 @@ VOID
AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Machine-Check exception (0x12)!\n"); DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
for(;;); KE::Crash::Panic(0x12);
} }
/** /**
@@ -496,7 +515,7 @@ VOID
AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n"); DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
for(;;); KE::Crash::Panic(0x13);
} }
/** /**
@@ -531,7 +550,7 @@ VOID
AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Assertion (0x2C)!\n"); DebugPrint(L"Handled Assertion (0x2C)!\n");
for(;;); KE::Crash::Panic(0x2C);
} }
/** /**
@@ -549,7 +568,7 @@ VOID
AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n"); DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
for(;;); KE::Crash::Panic(0x2D);
} }
/** /**
@@ -601,7 +620,7 @@ VOID
AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n"); DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
for(;;); KE::Crash::Panic(0xFF);
} }
/** /**

View File

@@ -23,6 +23,21 @@ XTCDECL
VOID VOID
AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame) AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Caught trap: 0x%.2lX with error code: %.4lX at EIP: 0x%.8lX\n"
L"EAX: 0x%.8lX, EBX: 0x%.8lX, ECX: 0x%.8lX, EDX: 0x%.8lX\n"
L"EBP: 0x%.8lX, ESP: 0x%.8lX, EDI: 0x%.8lX, ESI: 0x%.8lX\n"
L"DR0: 0x%.8lX, DR1: 0x%.8lX, DR2: 0x%.8lX, DR3: 0x%.8lX\n"
L"DR6: 0x%.8lX, DR7: 0x%.8lX\n"
L"CR2: 0x%.8lX, CR3: 0x%.8lX, CS: 0x%.8lX, DS: 0x%.8hX\n"
L"ES: 0x%.8hX, FS: 0x%.8hX, GS: 0x%.8hX, SS: 0x%.8lX\n",
TrapFrame->Vector, TrapFrame->ErrorCode, TrapFrame->Eip,
TrapFrame->Eax, TrapFrame->Ebx, TrapFrame->Ecx, TrapFrame->Edx,
TrapFrame->Ebp, TrapFrame->Esp, TrapFrame->Edi, TrapFrame->Esi,
TrapFrame->Dr0, TrapFrame->Dr1, TrapFrame->Dr2, TrapFrame->Dr3,
TrapFrame->Dr6, TrapFrame->Dr7,
TrapFrame->Cr2, TrapFrame->Cr3, TrapFrame->SegCs, TrapFrame->SegDs,
TrapFrame->SegEs, TrapFrame->SegFs, TrapFrame->SegGs, TrapFrame->SegSs);
/* Check vector and call appropriate handler */ /* Check vector and call appropriate handler */
switch(TrapFrame->Vector) switch(TrapFrame->Vector)
{ {
@@ -144,7 +159,7 @@ VOID
AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n"); DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
for(;;); KE::Crash::Panic(0x00);
} }
/** /**
@@ -162,7 +177,7 @@ VOID
AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Debug exception (0x01)!\n"); DebugPrint(L"Handled Debug exception (0x01)!\n");
for(;;); KE::Crash::Panic(0x01);
} }
/** /**
@@ -180,7 +195,7 @@ VOID
AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n"); DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
for(;;); KE::Crash::Panic(0x02);
} }
/** /**
@@ -198,7 +213,7 @@ VOID
AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled INT3 (0x03)!\n"); DebugPrint(L"Handled INT3 (0x03)!\n");
for(;;); KE::Crash::Panic(0x03);
} }
/** /**
@@ -216,7 +231,7 @@ VOID
AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Overflow exception (0x04)!\n"); DebugPrint(L"Handled Overflow exception (0x04)!\n");
for(;;); KE::Crash::Panic(0x04);
} }
/** /**
@@ -234,7 +249,7 @@ VOID
AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n"); DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
for(;;); KE::Crash::Panic(0x05);
} }
/** /**
@@ -252,7 +267,7 @@ VOID
AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n"); DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
for(;;); KE::Crash::Panic(0x06);
} }
/** /**
@@ -270,7 +285,7 @@ VOID
AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Device Not Available exception (0x07)!\n"); DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
for(;;); KE::Crash::Panic(0x07);
} }
/** /**
@@ -288,7 +303,7 @@ VOID
AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Double-Fault exception (0x08)!\n"); DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
for(;;); KE::Crash::Panic(0x08);
} }
/** /**
@@ -306,7 +321,7 @@ VOID
AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n"); DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
for(;;); KE::Crash::Panic(0x09);
} }
/** /**
@@ -324,7 +339,7 @@ VOID
AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n"); DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
for(;;); KE::Crash::Panic(0x0A);
} }
/** /**
@@ -342,7 +357,7 @@ VOID
AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n"); DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
for(;;); KE::Crash::Panic(0x0B);
} }
/** /**
@@ -360,7 +375,7 @@ VOID
AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n"); DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
for(;;); KE::Crash::Panic(0x0C);
} }
/** /**
@@ -378,7 +393,7 @@ VOID
AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n"); DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
for(;;); KE::Crash::Panic(0x0D);
} }
/** /**
@@ -396,7 +411,7 @@ VOID
AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n"); DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
for(;;); KE::Crash::Panic(0x0E);
} }
/** /**
@@ -414,7 +429,7 @@ VOID
AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n"); DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
for(;;); KE::Crash::Panic(0x10);
} }
/** /**
@@ -432,7 +447,7 @@ VOID
AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n"); DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
for(;;); KE::Crash::Panic(0x11);
} }
/** /**
@@ -450,7 +465,7 @@ VOID
AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Machine-Check exception (0x12)!\n"); DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
for(;;); KE::Crash::Panic(0x12);
} }
/** /**
@@ -468,7 +483,7 @@ VOID
AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n"); DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
for(;;); KE::Crash::Panic(0x13);
} }
/** /**
@@ -520,7 +535,7 @@ VOID
AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Assertion (0x2C)!\n"); DebugPrint(L"Handled Assertion (0x2C)!\n");
for(;;); KE::Crash::Panic(0x2C);
} }
/** /**
@@ -538,7 +553,7 @@ VOID
AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n"); DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
for(;;); KE::Crash::Panic(0x2D);
} }
/** /**
@@ -573,7 +588,7 @@ VOID
AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame) AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
{ {
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n"); DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
for(;;); KE::Crash::Panic(0xFF);
} }
/** /**

3960
xtoskrnl/hl/fbdevfont.cc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@ BOOLEAN
KE::KUbsan::CheckReport(PKUBSAN_SOURCE_LOCATION Location) KE::KUbsan::CheckReport(PKUBSAN_SOURCE_LOCATION Location)
{ {
/* Make sure, this error should be reported */ /* Make sure, this error should be reported */
return (BOOLEAN)!ActiveFrame; return !ActiveFrame;
} }
/** /**

View File

@@ -126,7 +126,7 @@ XTAPI
BOOLEAN BOOLEAN
MM::Init::VerifyMemoryTypeFree(LOADER_MEMORY_TYPE MemoryType) MM::Init::VerifyMemoryTypeFree(LOADER_MEMORY_TYPE MemoryType)
{ {
return (BOOLEAN)((MemoryType == LoaderFree) || (MemoryType == LoaderFirmwareTemporary) || return ((MemoryType == LoaderFree) || (MemoryType == LoaderFirmwareTemporary) ||
(MemoryType == LoaderLoadedProgram) || (MemoryType == LoaderOsloaderStack)); (MemoryType == LoaderLoadedProgram) || (MemoryType == LoaderOsloaderStack));
} }
@@ -144,7 +144,7 @@ XTAPI
BOOLEAN BOOLEAN
MM::Init::VerifyMemoryTypeInvisible(LOADER_MEMORY_TYPE MemoryType) MM::Init::VerifyMemoryTypeInvisible(LOADER_MEMORY_TYPE MemoryType)
{ {
return (BOOLEAN)((MemoryType == LoaderFirmwarePermanent) || return ((MemoryType == LoaderFirmwarePermanent) ||
(MemoryType == LoaderSpecialMemory) || (MemoryType == LoaderSpecialMemory) ||
(MemoryType == LoaderBBTMemory)); (MemoryType == LoaderBBTMemory));
} }

View File

@@ -313,7 +313,7 @@ RTL::BitMap::FindBits(IN PRTL_BITMAP BitMap,
while(BitOffset + Length < BitMapEnd) while(BitOffset + Length < BitMapEnd)
{ {
/* Increment offset */ /* Increment offset */
BitOffset += CountBits(BitMap, BitMap->Size - BitOffset, BitOffset, (BOOLEAN)!SetBits); BitOffset += CountBits(BitMap, BitMap->Size - BitOffset, BitOffset, !SetBits);
if(BitOffset + Length > BitMapEnd) if(BitOffset + Length > BitMapEnd)
{ {
/* No match found, break loop execution */ /* No match found, break loop execution */

View File

@@ -34,6 +34,6 @@ RTL::Guid::CompareGuids(IN PGUID Guid1,
Guid2Ptr = (PUINT)Guid2; Guid2Ptr = (PUINT)Guid2;
/* Compare GUIDs */ /* Compare GUIDs */
return (BOOLEAN)(Guid1Ptr[0] == Guid2Ptr[0] && Guid1Ptr[1] == Guid2Ptr[1] && return (Guid1Ptr[0] == Guid2Ptr[0] && Guid1Ptr[1] == Guid2Ptr[1] &&
Guid1Ptr[2] == Guid2Ptr[2] && Guid1Ptr[3] == Guid2Ptr[3]); Guid1Ptr[2] == Guid2Ptr[2] && Guid1Ptr[3] == Guid2Ptr[3]);
} }

View File

@@ -107,7 +107,7 @@ XTCDECL
BOOLEAN BOOLEAN
RTL::LinkedList::ListEmpty(IN PLIST_ENTRY ListHead) RTL::LinkedList::ListEmpty(IN PLIST_ENTRY ListHead)
{ {
return (BOOLEAN)(((ListHead->Flink == NULLPTR) && (ListHead->Blink == NULLPTR)) || (ListHead->Flink == ListHead)); return (((ListHead->Flink == NULLPTR) && (ListHead->Blink == NULLPTR)) || (ListHead->Flink == ListHead));
} }
/** /**

View File

@@ -631,7 +631,7 @@ RTL::Math::InfiniteDouble(IN DOUBLE Value)
Var.Double = &Value; Var.Double = &Value;
/* Return TRUE if it is infinite, or FALSE otherwise */ /* Return TRUE if it is infinite, or FALSE otherwise */
return (BOOLEAN)((Var.DoubleS->Exponent & 0x7FF) == 0x7FF); return ((Var.DoubleS->Exponent & 0x7FF) == 0x7FF);
} }
/** /**
@@ -690,5 +690,5 @@ RTL::Math::NanDouble(IN DOUBLE Value)
Var.Double = &Value; Var.Double = &Value;
/* Return TRUE if it is NaN, or FALSE otherwise */ /* Return TRUE if it is NaN, or FALSE otherwise */
return (BOOLEAN)(Var.DoubleS->Exponent == 0x7FF && (Var.DoubleS->MantissaHigh != 0 || Var.DoubleS->MantissaLow != 0)); return (Var.DoubleS->Exponent == 0x7FF && (Var.DoubleS->MantissaHigh != 0 || Var.DoubleS->MantissaLow != 0));
} }