forked from xt-sys/exectos
Compare commits
21 Commits
ed293c7e61
...
cpuid-enha
| Author | SHA1 | Date | |
|---|---|---|---|
| 46cc5072af | |||
|
ec4e8c416c
|
|||
|
64733914f2
|
|||
|
4e7baf302c
|
|||
|
2f9a6b5548
|
|||
|
646e246ec6
|
|||
|
ae941d2761
|
|||
|
b40db0d1dd
|
|||
|
cf4c17df22
|
|||
|
f152e2bac7
|
|||
|
f81e895fe1
|
|||
|
370a635ee2
|
|||
|
4696faf86d
|
|||
|
332e57f305
|
|||
|
4ee3daa8f8
|
|||
|
ee82475aa3
|
|||
|
ff0caf93da
|
|||
|
20fd950ef4
|
|||
|
6e10089280
|
|||
|
9298aef87e
|
|||
|
6c66028800
|
@@ -63,6 +63,7 @@ add_compiler_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_P
|
|||||||
set_disk_image_size(32)
|
set_disk_image_size(32)
|
||||||
|
|
||||||
# Build all subprojects
|
# Build all subprojects
|
||||||
|
add_subdirectory(boot)
|
||||||
add_subdirectory(bootdata)
|
add_subdirectory(bootdata)
|
||||||
add_subdirectory(drivers)
|
add_subdirectory(drivers)
|
||||||
add_subdirectory(sdk)
|
add_subdirectory(sdk)
|
||||||
|
|||||||
14
IDEAS.md
14
IDEAS.md
@@ -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.
|
||||||
|
|||||||
1
boot/CMakeLists.txt
Normal file
1
boot/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
add_subdirectory(bootsect)
|
||||||
6
boot/bootsect/CMakeLists.txt
Normal file
6
boot/bootsect/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# XT Boot Sector
|
||||||
|
PROJECT(BOOTSECT)
|
||||||
|
|
||||||
|
# Compile boot sectors
|
||||||
|
compile_bootsector(mbrboot ${BOOTSECT_SOURCE_DIR}/mbrboot.S 0x7C00 Start)
|
||||||
|
compile_bootsector(espboot ${BOOTSECT_SOURCE_DIR}/espboot.S 0x7C00 Start)
|
||||||
113
boot/bootsect/espboot.S
Normal file
113
boot/bootsect/espboot.S
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: boot/bootsect/espboot.S
|
||||||
|
* DESCRIPTION: XT Boot Loader ESP boot code (FAT32)
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code16
|
||||||
|
|
||||||
|
|
||||||
|
.global Start
|
||||||
|
Start:
|
||||||
|
/* Jump to the real start to omit the BPB (BIOS Parameter Block) */
|
||||||
|
jmp RealStart
|
||||||
|
nop
|
||||||
|
|
||||||
|
/* BIOS Parameter Block */
|
||||||
|
OsName:
|
||||||
|
.ascii "XTOS "
|
||||||
|
OsVersion:
|
||||||
|
.ascii "1.0"
|
||||||
|
BytesPerSector:
|
||||||
|
.word 512
|
||||||
|
SectorsPerCluster:
|
||||||
|
.byte 2
|
||||||
|
ReservedSectors:
|
||||||
|
.word 8
|
||||||
|
FatCopies:
|
||||||
|
.byte 1
|
||||||
|
RootDirEntries:
|
||||||
|
.word 1024
|
||||||
|
TotalSectors:
|
||||||
|
.word 0
|
||||||
|
MediaType:
|
||||||
|
.byte 0xF8
|
||||||
|
SectorsPerFat:
|
||||||
|
.word 0
|
||||||
|
SectorsPerTrack:
|
||||||
|
.word 17
|
||||||
|
NumberOfHeads:
|
||||||
|
.word 0
|
||||||
|
HiddenSectors:
|
||||||
|
.long 0
|
||||||
|
TotalBigSectors:
|
||||||
|
.long 0x200000
|
||||||
|
BigSectorsPerFat:
|
||||||
|
.long 0x1FE0
|
||||||
|
ExtendedFlags:
|
||||||
|
.word 0
|
||||||
|
FsVersion:
|
||||||
|
.word 0
|
||||||
|
RootDirStartCluster:
|
||||||
|
.long 0
|
||||||
|
FSInfoSector:
|
||||||
|
.word 0
|
||||||
|
BackupBootSector:
|
||||||
|
.word 6
|
||||||
|
Reserved:
|
||||||
|
.fill 12, 1, 0
|
||||||
|
DriveNumber:
|
||||||
|
.byte 0x80
|
||||||
|
CurrentHead:
|
||||||
|
.byte 0
|
||||||
|
Signature:
|
||||||
|
.byte 0x29
|
||||||
|
SerialNumber:
|
||||||
|
.long 0
|
||||||
|
VolumeLabel:
|
||||||
|
.ascii "NO NAME "
|
||||||
|
FileSystem:
|
||||||
|
.ascii "FAT32 "
|
||||||
|
|
||||||
|
RealStart:
|
||||||
|
/* Set segments and stack */
|
||||||
|
cli
|
||||||
|
cld
|
||||||
|
xorw %ax, %ax
|
||||||
|
movw %ax, %ds
|
||||||
|
movw %ax, %es
|
||||||
|
movw %ax, %ss
|
||||||
|
movw $0x7C00, %bp
|
||||||
|
leaw -16(%bp), %sp
|
||||||
|
sti
|
||||||
|
|
||||||
|
/* Print message */
|
||||||
|
movw $msgUnavailable, %si
|
||||||
|
call Print
|
||||||
|
|
||||||
|
/* Wait for key press and reboot */
|
||||||
|
xorw %ax, %ax
|
||||||
|
int $0x16
|
||||||
|
int $0x19
|
||||||
|
|
||||||
|
Print:
|
||||||
|
/* Simple routine to print messages */
|
||||||
|
lodsb
|
||||||
|
orb %al, %al
|
||||||
|
jz DonePrint
|
||||||
|
movb $0x0E, %ah
|
||||||
|
movw $0x07, %bx
|
||||||
|
int $0x10
|
||||||
|
jmp Print
|
||||||
|
DonePrint:
|
||||||
|
retw
|
||||||
|
|
||||||
|
msgUnavailable:
|
||||||
|
.ascii "XTLDR requires EFI-based system!\r\nPress any key to restart\r\n"
|
||||||
|
|
||||||
|
/* Fill the rest of the VBR with zeros and add VBR signature at the end */
|
||||||
|
.fill (510 - (. - Start)), 1, 0
|
||||||
|
.word 0xAA55
|
||||||
153
boot/bootsect/mbrboot.S
Normal file
153
boot/bootsect/mbrboot.S
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: boot/bootsect/amd64/mbrboot.S
|
||||||
|
* DESCRIPTION: XT Boot Loader MBR boot code
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code16
|
||||||
|
|
||||||
|
|
||||||
|
.global Start
|
||||||
|
Start:
|
||||||
|
/* Set segments and stack */
|
||||||
|
cli
|
||||||
|
cld
|
||||||
|
xorw %ax, %ax
|
||||||
|
movw %ax, %ds
|
||||||
|
movw %ax, %es
|
||||||
|
movw %ax, %ss
|
||||||
|
movw $0x7C00, %bp
|
||||||
|
leaw -16(%bp), %sp
|
||||||
|
sti
|
||||||
|
|
||||||
|
/* Relocate MBR to 1FE0:7C00 */
|
||||||
|
movw $0x1FE0, %ax
|
||||||
|
movw %ax, %es
|
||||||
|
movw %bp, %si
|
||||||
|
movw %bp, %di
|
||||||
|
movw $256, %cx
|
||||||
|
rep movsw
|
||||||
|
|
||||||
|
/* Jump to the relocated MBR code */
|
||||||
|
jmp $0x1FE0, $RealStart
|
||||||
|
|
||||||
|
RealStart:
|
||||||
|
/* Set segments */
|
||||||
|
movw %ax, %ds
|
||||||
|
movw %ax, %es
|
||||||
|
movw %ax, %ss
|
||||||
|
|
||||||
|
/* Print welcome message */
|
||||||
|
leaw msgXtosBoot, %si
|
||||||
|
call Print
|
||||||
|
|
||||||
|
/* Get BIOS boot drive and partition table offset */
|
||||||
|
lea 0x1BE(%bp), %si
|
||||||
|
movb %dl, .BootDrive
|
||||||
|
xorw %cx, %cx
|
||||||
|
|
||||||
|
FindActivePartition:
|
||||||
|
/* Look for active partition */
|
||||||
|
movb (%si), %al
|
||||||
|
cmpb $0x80, %al
|
||||||
|
je PartitionFound
|
||||||
|
addw $16, %si
|
||||||
|
incw %cx
|
||||||
|
cmpw $4, %cx
|
||||||
|
jne FindActivePartition
|
||||||
|
jmp PartitionNotFound
|
||||||
|
|
||||||
|
PartitionFound:
|
||||||
|
/* Save LBA start */
|
||||||
|
movl 8(%si), %eax
|
||||||
|
movl %eax, .LbaStart
|
||||||
|
|
||||||
|
/* Prepare Disk Address Packet (DAP) */
|
||||||
|
lea .Dap, %si
|
||||||
|
movb $0x10, 0(%si)
|
||||||
|
movb $0x00, 1(%si)
|
||||||
|
movw $1, 2(%si)
|
||||||
|
movw $0x7C00, 4(%si)
|
||||||
|
movw $0x0000, 6(%si)
|
||||||
|
movl .LbaStart, %eax
|
||||||
|
movl %eax, 8(%si)
|
||||||
|
|
||||||
|
/* Read Volume Boot Record (VBR) */
|
||||||
|
movb $0x42, %ah
|
||||||
|
movb .BootDrive, %dl
|
||||||
|
int $0x13
|
||||||
|
jc VbrReadFail
|
||||||
|
|
||||||
|
/* Verify VBR signature */
|
||||||
|
cmpw $0xAA55, (0x7C00 + 0x01FE)
|
||||||
|
jne InvalidSignature
|
||||||
|
|
||||||
|
/* Jump to the VBR code */
|
||||||
|
jmp $0x0000, $0x7C00
|
||||||
|
|
||||||
|
InvalidSignature:
|
||||||
|
/* Invalid signature error */
|
||||||
|
leaw msgInvalidSignature, %si
|
||||||
|
call Print
|
||||||
|
jmp HaltSystem
|
||||||
|
|
||||||
|
PartitionNotFound:
|
||||||
|
/* Active partition not found error */
|
||||||
|
leaw msgPartitionNotFound, %si
|
||||||
|
call Print
|
||||||
|
jmp HaltSystem
|
||||||
|
|
||||||
|
VbrReadFail:
|
||||||
|
/* VBR read failed error */
|
||||||
|
leaw msgVbrReadFail, %si
|
||||||
|
call Print
|
||||||
|
jmp HaltSystem
|
||||||
|
|
||||||
|
HaltSystem:
|
||||||
|
/* Disable interrupts and stop the CPU */
|
||||||
|
cli
|
||||||
|
hlt
|
||||||
|
jmp HaltSystem
|
||||||
|
|
||||||
|
Print:
|
||||||
|
/* Simple routine to print messages */
|
||||||
|
lodsb
|
||||||
|
orb %al, %al
|
||||||
|
jz DonePrint
|
||||||
|
movb $0x0E, %ah
|
||||||
|
movw $0x07, %bx
|
||||||
|
int $0x10
|
||||||
|
jmp Print
|
||||||
|
DonePrint:
|
||||||
|
retw
|
||||||
|
|
||||||
|
.BootDrive:
|
||||||
|
/* Storage for the boot drive number */
|
||||||
|
.byte 0
|
||||||
|
|
||||||
|
.Dap:
|
||||||
|
/* Storage for the Disk Address Packet (DAP) */
|
||||||
|
.fill 16, 1, 0
|
||||||
|
|
||||||
|
.LbaStart:
|
||||||
|
/* Storage for the LBA start */
|
||||||
|
.long 0
|
||||||
|
|
||||||
|
msgInvalidSignature:
|
||||||
|
.asciz "Invalid partition signature!"
|
||||||
|
|
||||||
|
msgPartitionNotFound:
|
||||||
|
.asciz "Bootable partition not found!"
|
||||||
|
|
||||||
|
msgVbrReadFail:
|
||||||
|
.asciz "VBR read failed!"
|
||||||
|
|
||||||
|
msgXtosBoot:
|
||||||
|
.asciz "Starting XTOS boot loader...\r\n"
|
||||||
|
|
||||||
|
/* Fill the rest of the MBR with zeros and add MBR signature at the end */
|
||||||
|
.fill (510 - (. - Start)), 1, 0
|
||||||
|
.word 0xAA55
|
||||||
@@ -8,27 +8,25 @@ endif()
|
|||||||
# This target creates a disk image
|
# This target creates a disk image
|
||||||
add_custom_target(diskimg
|
add_custom_target(diskimg
|
||||||
DEPENDS install
|
DEPENDS install
|
||||||
COMMAND sh -c "dd if=/dev/zero of=${EXECTOS_BINARY_DIR}/output/disk.img bs=512 count=${PROJECT_DISK_IMAGE_BLOCKS} 2>/dev/null 1>/dev/null"
|
COMMAND diskimg -c ${EXECTOS_BINARY_DIR}/output/binaries -f 32 -o ${EXECTOS_BINARY_DIR}/output/disk.img -s ${PROJECT_DISK_IMAGE_SIZE}
|
||||||
COMMAND parted ${EXECTOS_BINARY_DIR}/output/disk.img -s -a minimal mklabel gpt
|
-m ${EXECTOS_BINARY_DIR}/boot/bootsect/mbrboot.bin -v ${EXECTOS_BINARY_DIR}/boot/bootsect/espboot.bin
|
||||||
COMMAND parted ${EXECTOS_BINARY_DIR}/output/disk.img -s -a minimal mkpart EFI FAT32 2048s ${PROJECT_PART_IMAGE_BLOCKS}s
|
|
||||||
COMMAND parted ${EXECTOS_BINARY_DIR}/output/disk.img -s -a minimal toggle 1 boot
|
|
||||||
COMMAND sh -c "dd if=/dev/zero of=${EXECTOS_BINARY_DIR}/output/part.img bs=512 count=${PROJECT_PART_IMAGE_BLOCKS} 2>/dev/null 1>/dev/null"
|
|
||||||
COMMAND mformat -i ${EXECTOS_BINARY_DIR}/output/part.img -h32 -t32 -n64 -L32
|
|
||||||
COMMAND sh -c "mcopy -s -i ${EXECTOS_BINARY_DIR}/output/part.img ${EXECTOS_BINARY_DIR}/output/binaries/* ::"
|
|
||||||
COMMAND sh -c "dd if=${EXECTOS_BINARY_DIR}/output/part.img of=${EXECTOS_BINARY_DIR}/output/disk.img bs=512 count=${PROJECT_PART_IMAGE_BLOCKS} seek=2048 conv=notrunc 2>/dev/null 1>/dev/null"
|
|
||||||
COMMAND rm ${EXECTOS_BINARY_DIR}/output/part.img
|
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
|
||||||
# This target starts up a BOCHS+OVMF virtual machine
|
find_program(BOCHS_EMULATOR bochs)
|
||||||
add_custom_target(bochsvm
|
if(BOCHS_EMULATOR)
|
||||||
|
# This target starts up a BOCHS+BIOS virtual machine
|
||||||
|
add_custom_target(bochsvm
|
||||||
DEPENDS diskimg
|
DEPENDS diskimg
|
||||||
COMMAND bochs -f ../sdk/firmware/bochsrc_${ARCH}.cfg -q -unlock
|
COMMAND bochs -f ../sdk/firmware/bochsrc_${ARCH}.cfg -q -unlock
|
||||||
VERBATIM USES_TERMINAL)
|
VERBATIM USES_TERMINAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
# This target starts up a QEMU+OVMF virtual machine using KVM accelerator
|
find_program(QEMU_EMULATOR ${QEMU_COMMAND})
|
||||||
add_custom_target(testkvm
|
if(QEMU_EMULATOR)
|
||||||
|
# This target starts up a QEMU+OVMF virtual machine using KVM accelerator
|
||||||
|
add_custom_target(testefikvm
|
||||||
DEPENDS install
|
DEPENDS install
|
||||||
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-KVM" -machine type=q35,kernel_irqchip=on,accel=kvm,mem-merge=off,vmport=off -enable-kvm -cpu host,-hypervisor,+topoext
|
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-EFI-KVM" -machine type=q35,kernel_irqchip=on,accel="kvm:whpx",mem-merge=off,vmport=off -enable-kvm -cpu host,-hypervisor,+topoext
|
||||||
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
||||||
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_code_${ARCH}.fd,if=pflash,format=raw,unit=0,readonly=on
|
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_code_${ARCH}.fd,if=pflash,format=raw,unit=0,readonly=on
|
||||||
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_vars_${ARCH}.fd,if=pflash,format=raw,unit=1
|
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_vars_${ARCH}.fd,if=pflash,format=raw,unit=1
|
||||||
@@ -36,13 +34,32 @@ add_custom_target(testkvm
|
|||||||
-boot menu=on -d int -M smm=off -no-reboot -no-shutdown -serial stdio
|
-boot menu=on -d int -M smm=off -no-reboot -no-shutdown -serial stdio
|
||||||
VERBATIM USES_TERMINAL)
|
VERBATIM USES_TERMINAL)
|
||||||
|
|
||||||
# This target starts up a QEMU+OVMF virtual machine using TCG accelerator
|
# This target starts up a QEMU+OVMF virtual machine using TCG accelerator
|
||||||
add_custom_target(testtcg
|
add_custom_target(testefitcg
|
||||||
DEPENDS install
|
DEPENDS install
|
||||||
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-TCG" -machine type=q35,accel=tcg -cpu max,-hypervisor
|
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-EFI-TCG" -machine type=q35,accel=tcg -cpu max,-hypervisor
|
||||||
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
||||||
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_code_${ARCH}.fd,if=pflash,format=raw,unit=0,readonly=on
|
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_code_${ARCH}.fd,if=pflash,format=raw,unit=0,readonly=on
|
||||||
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_vars_${ARCH}.fd,if=pflash,format=raw,unit=1
|
-drive file=${EXECTOS_SOURCE_DIR}/sdk/firmware/ovmf_vars_${ARCH}.fd,if=pflash,format=raw,unit=1
|
||||||
-hda fat:rw:${EXECTOS_BINARY_DIR}/output/binaries
|
-hda fat:rw:${EXECTOS_BINARY_DIR}/output/binaries
|
||||||
-boot menu=on -d int -M smm=off -no-reboot -no-shutdown -serial stdio
|
-boot menu=on -d int -no-reboot -no-shutdown -serial stdio
|
||||||
VERBATIM USES_TERMINAL)
|
VERBATIM USES_TERMINAL)
|
||||||
|
|
||||||
|
# This target starts up a QEMU+SEABIOS virtual machine using KVM accelerator
|
||||||
|
add_custom_target(testkvm
|
||||||
|
DEPENDS diskimg
|
||||||
|
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-BIOS-KVM" -machine type=q35,kernel_irqchip=on,accel="kvm:whpx",mem-merge=off,vmport=off -enable-kvm -cpu host,-hypervisor,+topoext
|
||||||
|
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
||||||
|
-hda ${EXECTOS_BINARY_DIR}/output/disk.img
|
||||||
|
-boot menu=on -d int -no-reboot -no-shutdown -serial stdio
|
||||||
|
VERBATIM USES_TERMINAL)
|
||||||
|
|
||||||
|
# This target starts up a QEMU+SEABIOS virtual machine using TCG accelerator
|
||||||
|
add_custom_target(testtcg
|
||||||
|
DEPENDS diskimg
|
||||||
|
COMMAND ${QEMU_COMMAND} -name "ExectOS-${ARCH}-BIOS-TCG" -machine type=q35,accel=tcg -cpu max,-hypervisor
|
||||||
|
-smp 2,sockets=1,cores=1,threads=2 -m 4G -overcommit mem-lock=off -rtc clock=host,base=localtime,driftfix=none
|
||||||
|
-hda ${EXECTOS_BINARY_DIR}/output/disk.img
|
||||||
|
-boot menu=on -d int -no-reboot -no-shutdown -serial stdio
|
||||||
|
VERBATIM USES_TERMINAL)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -59,18 +59,41 @@ 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 sets a property for specified module
|
# This function compiles an assembly bootsector file into a flat binary
|
||||||
function(set_module_property MODULE PROPERTY FLAGS)
|
function(compile_bootsector NAME SOURCE BASEADDR ENTRYPOINT)
|
||||||
if(NOT ${ARGC} EQUAL 3)
|
set(BINARY_NAME "${NAME}.bin")
|
||||||
message(FATAL_ERROR "Invalid number of arguments passwd to add_module_property() function")
|
set(OBJECT_NAME "${NAME}.obj")
|
||||||
endif()
|
|
||||||
get_target_property(VAL ${MODULE} ${PROPERTY})
|
add_custom_command(
|
||||||
if(VAL)
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
|
||||||
set(VAL "${VAL} ${FLAGS}")
|
COMMAND ${CMAKE_ASM_COMPILER}
|
||||||
else()
|
/nologo
|
||||||
set(VAL "${FLAGS}")
|
--target=i386-none-elf
|
||||||
endif()
|
/Fo${CMAKE_CURRENT_BINARY_DIR}/${OBJECT_NAME}
|
||||||
set_property(TARGET ${MODULE} PROPERTY ${PROPERTY} ${VAL})
|
-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 the the qemu disk image size (in MiB)
|
||||||
|
function(set_disk_image_size SIZE)
|
||||||
|
MATH(EXPR DISK_BLOCKS ${SIZE}*1024*1024/512)
|
||||||
|
MATH(EXPR PART_BLOCKS ${DISK_BLOCKS}-2048)
|
||||||
|
set(PROJECT_DISK_IMAGE_SIZE ${SIZE} CACHE INTERNAL "PROJECT_DISK_IMAGE_SIZE")
|
||||||
|
set(PROJECT_DISK_IMAGE_BLOCKS ${DISK_BLOCKS} CACHE INTERNAL "PROJECT_DISK_IMAGE_BLOCKS")
|
||||||
|
set(PROJECT_PART_IMAGE_BLOCKS ${PART_BLOCKS} CACHE INTERNAL "PROJECT_PART_IMAGE_BLOCKS")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# This function installs specified directory recursively under destination directory
|
# This function installs specified directory recursively under destination directory
|
||||||
@@ -89,6 +112,20 @@ function(set_install_target TARGET DESTINATION)
|
|||||||
install(TARGETS ${TARGET} DESTINATION ${EXECTOS_BINARY_DIR}/output/binaries/${DESTINATION})
|
install(TARGETS ${TARGET} DESTINATION ${EXECTOS_BINARY_DIR}/output/binaries/${DESTINATION})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# This function sets a property for specified module
|
||||||
|
function(set_module_property MODULE PROPERTY FLAGS)
|
||||||
|
if(NOT ${ARGC} EQUAL 3)
|
||||||
|
message(FATAL_ERROR "Invalid number of arguments passwd to add_module_property() function")
|
||||||
|
endif()
|
||||||
|
get_target_property(VAL ${MODULE} ${PROPERTY})
|
||||||
|
if(VAL)
|
||||||
|
set(VAL "${VAL} ${FLAGS}")
|
||||||
|
else()
|
||||||
|
set(VAL "${FLAGS}")
|
||||||
|
endif()
|
||||||
|
set_property(TARGET ${MODULE} PROPERTY ${PROPERTY} ${VAL})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(set_sdk_target FILENAME DESTINATION)
|
function(set_sdk_target FILENAME DESTINATION)
|
||||||
install(DIRECTORY ${FILENAME} DESTINATION ${EXECTOS_BINARY_DIR}/output/sdk/${DESTINATION})
|
install(DIRECTORY ${FILENAME} DESTINATION ${EXECTOS_BINARY_DIR}/output/sdk/${DESTINATION})
|
||||||
endfunction()
|
endfunction()
|
||||||
@@ -102,11 +139,3 @@ function(set_specfile SPECFILE EXPORTNAME)
|
|||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.def ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.c
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.def ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.c
|
||||||
COMMAND ${CMAKE_SPEC_COMPILER} -a=${ARCH} -n=${EXPORTNAME} -d=${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.c ${CMAKE_CURRENT_SOURCE_DIR}/${SPECFILE})
|
COMMAND ${CMAKE_SPEC_COMPILER} -a=${ARCH} -n=${EXPORTNAME} -d=${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.c ${CMAKE_CURRENT_SOURCE_DIR}/${SPECFILE})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# This function sets the the qemu disk image size (in MiB)
|
|
||||||
function(set_disk_image_size SIZE)
|
|
||||||
MATH(EXPR DISK_BLOCKS ${SIZE}*1024*1024/512)
|
|
||||||
MATH(EXPR PART_BLOCKS ${DISK_BLOCKS}-2048)
|
|
||||||
set(PROJECT_DISK_IMAGE_BLOCKS ${DISK_BLOCKS} CACHE INTERNAL "PROJECT_DISK_IMAGE_BLOCKS")
|
|
||||||
set(PROJECT_PART_IMAGE_BLOCKS ${PART_BLOCKS} CACHE INTERNAL "PROJECT_PART_IMAGE_BLOCKS")
|
|
||||||
endfunction()
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ plugin_ctrl: usb_xhci=false, serial=true, e1000=false, extfpuirq=true, parallel=
|
|||||||
config_interface: textconfig
|
config_interface: textconfig
|
||||||
display_library: x
|
display_library: x
|
||||||
memory: host=64, guest=64
|
memory: host=64, guest=64
|
||||||
romimage: file="../sdk/firmware/ovmf_pure_amd64.fd", address=0x00000000, options=none
|
romimage: file="../sdk/firmware/rombios.bin", address=0x00000000, options=none
|
||||||
vgaromimage: file="../sdk/firmware/vgabios.bin"
|
vgaromimage: file="../sdk/firmware/vgabios.bin"
|
||||||
boot: floppy
|
boot: disk
|
||||||
floppy_bootsig_check: disabled=0
|
floppy_bootsig_check: disabled=0
|
||||||
floppya: type=1_44
|
floppya: type=1_44
|
||||||
# no floppyb
|
# no floppyb
|
||||||
@@ -27,11 +27,7 @@ optramimage3: file=none
|
|||||||
optramimage4: file=none
|
optramimage4: file=none
|
||||||
pci: enabled=1, chipset=i440fx, slot1=cirrus, slot2=none, slot3=none, slot4=none, slot5=none
|
pci: enabled=1, chipset=i440fx, slot1=cirrus, slot2=none, slot3=none, slot4=none, slot5=none
|
||||||
vga: extension=cirrus, update_freq=5, realtime=1, ddc=builtin
|
vga: extension=cirrus, update_freq=5, realtime=1, ddc=builtin
|
||||||
cpu: count=1:1:1, ips=400000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
cpu: count=1:1:1, ips=400000000, quantum=16, model=corei7_sandy_bridge_2600k, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
||||||
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
|
|
||||||
cpuid: mmx=true, apic=xapic, simd=sse4_2, sse4a=false, misaligned_sse=false, sep=true
|
|
||||||
cpuid: movbe=false, adx=false, aes=false, sha=false, xsave=false, xsaveopt=false, x86_64=true
|
|
||||||
cpuid: 1g_pages=false, pcid=false, fsgsbase=false, smep=false, smap=false, mwait=true
|
|
||||||
print_timestamps: enabled=0
|
print_timestamps: enabled=0
|
||||||
port_e9_hack: enabled=0
|
port_e9_hack: enabled=0
|
||||||
private_colormap: enabled=0
|
private_colormap: enabled=0
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ plugin_ctrl: usb_xhci=false, serial=true, e1000=false, extfpuirq=true, parallel=
|
|||||||
config_interface: textconfig
|
config_interface: textconfig
|
||||||
display_library: x
|
display_library: x
|
||||||
memory: host=64, guest=64
|
memory: host=64, guest=64
|
||||||
romimage: file="../sdk/firmware/ovmf_pure_i686.fd", address=0x00000000, options=none
|
romimage: file="../sdk/firmware/rombios.bin", address=0x00000000, options=none
|
||||||
vgaromimage: file="../sdk/firmware/vgabios.bin"
|
vgaromimage: file="../sdk/firmware/vgabios.bin"
|
||||||
boot: floppy
|
boot: disk
|
||||||
floppy_bootsig_check: disabled=0
|
floppy_bootsig_check: disabled=0
|
||||||
floppya: type=1_44
|
floppya: type=1_44
|
||||||
# no floppyb
|
# no floppyb
|
||||||
@@ -27,11 +27,7 @@ optramimage3: file=none
|
|||||||
optramimage4: file=none
|
optramimage4: file=none
|
||||||
pci: enabled=1, chipset=i440fx, slot1=cirrus, slot2=none, slot3=none, slot4=none, slot5=none
|
pci: enabled=1, chipset=i440fx, slot1=cirrus, slot2=none, slot3=none, slot4=none, slot5=none
|
||||||
vga: extension=cirrus, update_freq=5, realtime=1, ddc=builtin
|
vga: extension=cirrus, update_freq=5, realtime=1, ddc=builtin
|
||||||
cpu: count=1:1:1, ips=400000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
cpu: count=1:1:1, ips=400000000, quantum=16, model=corei7_sandy_bridge_2600k, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
||||||
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
|
|
||||||
cpuid: mmx=true, apic=xapic, simd=sse4_2, sse4a=false, misaligned_sse=false, sep=true
|
|
||||||
cpuid: movbe=false, adx=false, aes=false, sha=false, xsave=false, xsaveopt=false, x86_64=true
|
|
||||||
cpuid: 1g_pages=false, pcid=false, fsgsbase=false, smep=false, smap=false, mwait=true
|
|
||||||
print_timestamps: enabled=0
|
print_timestamps: enabled=0
|
||||||
port_e9_hack: enabled=0
|
port_e9_hack: enabled=0
|
||||||
private_colormap: enabled=0
|
private_colormap: enabled=0
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
sdk/firmware/rombios.bin
Normal file
BIN
sdk/firmware/rombios.bin
Normal file
Binary file not shown.
@@ -394,6 +394,13 @@ typedef struct _CPU_IDENTIFICATION
|
|||||||
USHORT Stepping;
|
USHORT Stepping;
|
||||||
CPU_VENDOR Vendor;
|
CPU_VENDOR Vendor;
|
||||||
UCHAR VendorName[13];
|
UCHAR VendorName[13];
|
||||||
|
UINT32 StandardFeaturesEcx;
|
||||||
|
UINT32 StandardFeaturesEdx;
|
||||||
|
UINT32 ExtendedFeaturesEcx;
|
||||||
|
UINT32 ExtendedFeaturesEdx;
|
||||||
|
UINT32 Standard7FeaturesEbx;
|
||||||
|
UINT32 Standard7FeaturesEcx;
|
||||||
|
UINT32 Standard7FeaturesEdx;
|
||||||
} CPU_IDENTIFICATION, *PCPU_IDENTIFICATION;
|
} CPU_IDENTIFICATION, *PCPU_IDENTIFICATION;
|
||||||
|
|
||||||
/* CPUID registers */
|
/* CPUID registers */
|
||||||
|
|||||||
@@ -359,6 +359,10 @@ typedef struct _CPU_IDENTIFICATION
|
|||||||
USHORT Stepping;
|
USHORT Stepping;
|
||||||
CPU_VENDOR Vendor;
|
CPU_VENDOR Vendor;
|
||||||
UCHAR VendorName[13];
|
UCHAR VendorName[13];
|
||||||
|
UINT32 StandardFeaturesEcx;
|
||||||
|
UINT32 StandardFeaturesEdx;
|
||||||
|
UINT32 ExtendedFeaturesEcx;
|
||||||
|
UINT32 ExtendedFeaturesEdx;
|
||||||
} CPU_IDENTIFICATION, *PCPU_IDENTIFICATION;
|
} CPU_IDENTIFICATION, *PCPU_IDENTIFICATION;
|
||||||
|
|
||||||
/* CPUID registers */
|
/* CPUID registers */
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -615,7 +622,7 @@ Configuration::ParseConfigFile(IN CONST PCHAR RawConfig,
|
|||||||
SectionName = InputData;
|
SectionName = InputData;
|
||||||
|
|
||||||
/* Find end of the section name */
|
/* Find end of the section name */
|
||||||
while(*InputData != ']' && *InputData != '\0' && *InputData != '\n')
|
while(*InputData != ']' && *InputData != '\0' && *InputData != '\r' && *InputData != '\n')
|
||||||
{
|
{
|
||||||
/* Advance to the next character */
|
/* Advance to the next character */
|
||||||
InputData++;
|
InputData++;
|
||||||
@@ -665,7 +672,7 @@ Configuration::ParseConfigFile(IN CONST PCHAR RawConfig,
|
|||||||
Key = InputData;
|
Key = InputData;
|
||||||
|
|
||||||
/* Find end of the key */
|
/* Find end of the key */
|
||||||
while(*InputData != '=' && *InputData != '\0' && *InputData != '\n')
|
while(*InputData != '=' && *InputData != '\0' && *InputData != '\r' && *InputData != '\n')
|
||||||
{
|
{
|
||||||
/* Advance to the next character */
|
/* Advance to the next character */
|
||||||
InputData++;
|
InputData++;
|
||||||
@@ -693,7 +700,7 @@ Configuration::ParseConfigFile(IN CONST PCHAR RawConfig,
|
|||||||
Value = InputData;
|
Value = InputData;
|
||||||
|
|
||||||
/* Find end of the value */
|
/* Find end of the value */
|
||||||
while(*InputData != '\0' && *InputData != '\n')
|
while(*InputData != '\0' && *InputData != '\r' && *InputData != '\n')
|
||||||
{
|
{
|
||||||
/* Advance to the next character */
|
/* Advance to the next character */
|
||||||
InputData++;
|
InputData++;
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -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 */
|
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <xtver.h>
|
#include <xtver.h>
|
||||||
|
|
||||||
#include <libxtos.hh>
|
#include <libxtos.hh>
|
||||||
#include <globals.hh>
|
|
||||||
|
|
||||||
|
|
||||||
class BootUtils
|
class BootUtils
|
||||||
|
|||||||
@@ -414,7 +414,6 @@ Xtos::InitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
{
|
{
|
||||||
PKERNEL_INITIALIZATION_BLOCK LoaderBlock;
|
PKERNEL_INITIALIZATION_BLOCK LoaderBlock;
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
// PVOID RuntimeServices;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT BlockPages;
|
UINT BlockPages;
|
||||||
UINT ParametersSize;
|
UINT ParametersSize;
|
||||||
@@ -445,20 +444,10 @@ Xtos::InitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
/* Set LoaderInformation block properties */
|
/* Set LoaderInformation block properties */
|
||||||
LoaderBlock->LoaderInformation.DbgPrint = (PVOID)XtLdrProtocol->Debug.Print;
|
LoaderBlock->LoaderInformation.DbgPrint = (PVOID)XtLdrProtocol->Debug.Print;
|
||||||
|
|
||||||
/* Attempt to find virtual address of the EFI Runtime Services */
|
|
||||||
// Status = XtLdrProtocol->GetVirtualAddress(MemoryMappings, &EfiSystemTable->RuntimeServices->Hdr, &RuntimeServices);
|
|
||||||
// if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
// {
|
|
||||||
/* Set FirmwareInformation block properties */
|
/* Set FirmwareInformation block properties */
|
||||||
LoaderBlock->FirmwareInformation.FirmwareType = SystemFirmwareEfi;
|
LoaderBlock->FirmwareInformation.FirmwareType = SystemFirmwareEfi;
|
||||||
LoaderBlock->FirmwareInformation.EfiFirmware.EfiVersion = 0; //EfiSystemTable->Hdr.Revision;
|
// LoaderBlock->FirmwareInformation.EfiFirmware.EfiVersion = EfiSystemTable->Hdr.Revision;
|
||||||
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULLPTR;
|
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULLPTR;
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// /* Set invalid firmware type to indicate that kernel cannot rely on FirmwareInformation block */
|
|
||||||
// LoaderBlock->FirmwareInformation.FirmwareType = SystemFirmwareInvalid;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* Copy parameters to kernel initialization block */
|
/* Copy parameters to kernel initialization block */
|
||||||
LoaderBlock->KernelParameters = (PWCHAR)((UINT_PTR)*VirtualAddress + sizeof(KERNEL_INITIALIZATION_BLOCK));
|
LoaderBlock->KernelParameters = (PWCHAR)((UINT_PTR)*VirtualAddress + sizeof(KERNEL_INITIALIZATION_BLOCK));
|
||||||
@@ -663,7 +652,7 @@ Xtos::RunBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
|||||||
/* Add kernel image memory mapping */
|
/* Add kernel image memory mapping */
|
||||||
Status = XtLdrProtocol->Memory.MapVirtualMemory(&PageMap, ImageContext->VirtualAddress,
|
Status = XtLdrProtocol->Memory.MapVirtualMemory(&PageMap, ImageContext->VirtualAddress,
|
||||||
ImageContext->PhysicalAddress, ImageContext->ImagePages,
|
ImageContext->PhysicalAddress, ImageContext->ImagePages,
|
||||||
LoaderExceptionBlock); // 0 is LoaderExceptionBlock?! Should be LoaderSystemCode?
|
LoaderSystemCode);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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: <Prefix><Operation><Object>
|
of all public interfaces exposed by the kernel are generally composed of three parts:
|
||||||
|
<Prefix><Operation><Object>
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
@@ -64,9 +64,6 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
CPUID_REGISTERS CpuRegisters;
|
CPUID_REGISTERS CpuRegisters;
|
||||||
CPUID_SIGNATURE CpuSignature;
|
CPUID_SIGNATURE CpuSignature;
|
||||||
|
|
||||||
/* Not fully implemented yet */
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
|
|
||||||
/* Get current processor control block */
|
/* Get current processor control block */
|
||||||
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
||||||
|
|
||||||
@@ -122,7 +119,42 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
Prcb->CpuId.Vendor = CPU_VENDOR_UNKNOWN;
|
Prcb->CpuId.Vendor = CPU_VENDOR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Store a list of CPU features in processor control block */
|
/* Get CPU standard features */
|
||||||
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
|
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
||||||
|
CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
|
/* Store CPU standard features in processor control block */
|
||||||
|
Prcb->CpuId.StandardFeaturesEcx = CpuRegisters.Ecx;
|
||||||
|
Prcb->CpuId.StandardFeaturesEdx = CpuRegisters.Edx;
|
||||||
|
|
||||||
|
/* Get CPU extended features */
|
||||||
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
|
CpuRegisters.Leaf = 0x80000001;
|
||||||
|
CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
|
/* Store CPU extended features in processor control block */
|
||||||
|
Prcb->CpuId.ExtendedFeaturesEcx = CpuRegisters.Ecx;
|
||||||
|
Prcb->CpuId.ExtendedFeaturesEdx = CpuRegisters.Edx;
|
||||||
|
|
||||||
|
/* Get CPU leaf 7 features (subleaf 0) */
|
||||||
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
|
CpuRegisters.Leaf = CPUID_GET_STANDARD7_FEATURES;
|
||||||
|
CpuRegisters.SubLeaf = 0;
|
||||||
|
CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
|
/* Store CPU leaf 7 features in processor control block */
|
||||||
|
Prcb->CpuId.Standard7FeaturesEbx = CpuRegisters.Ebx;
|
||||||
|
Prcb->CpuId.Standard7FeaturesEcx = CpuRegisters.Ecx;
|
||||||
|
Prcb->CpuId.Standard7FeaturesEdx = CpuRegisters.Edx;
|
||||||
|
|
||||||
|
/* Print CPU information */
|
||||||
|
DebugPrint(L"CPU: Vendor %hs, Family 0x%X, Model 0x%X, Stepping 0x%X\n",
|
||||||
|
Prcb->CpuId.VendorName,
|
||||||
|
Prcb->CpuId.Family,
|
||||||
|
Prcb->CpuId.Model,
|
||||||
|
Prcb->CpuId.Stepping);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
CPUID_REGISTERS CpuRegisters;
|
CPUID_REGISTERS CpuRegisters;
|
||||||
CPUID_SIGNATURE CpuSignature;
|
CPUID_SIGNATURE CpuSignature;
|
||||||
|
|
||||||
/* Not fully implemented yet */
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
|
|
||||||
/* Get current processor control block */
|
/* Get current processor control block */
|
||||||
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
||||||
|
|
||||||
@@ -117,7 +114,30 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
Prcb->CpuId.Vendor = CPU_VENDOR_UNKNOWN;
|
Prcb->CpuId.Vendor = CPU_VENDOR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Store a list of CPU features in processor control block */
|
/* Get CPU standard features */
|
||||||
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
|
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
||||||
|
CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
|
/* Store CPU standard features in processor control block */
|
||||||
|
Prcb->CpuId.StandardFeaturesEcx = CpuRegisters.Ecx;
|
||||||
|
Prcb->CpuId.StandardFeaturesEdx = CpuRegisters.Edx;
|
||||||
|
|
||||||
|
/* Get CPU extended features */
|
||||||
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
|
CpuRegisters.Leaf = 0x80000001;
|
||||||
|
CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
|
/* Store CPU extended features in processor control block */
|
||||||
|
Prcb->CpuId.ExtendedFeaturesEcx = CpuRegisters.Ecx;
|
||||||
|
Prcb->CpuId.ExtendedFeaturesEdx = CpuRegisters.Edx;
|
||||||
|
|
||||||
|
/* Print CPU information */
|
||||||
|
DebugPrint(L"CPU: Vendor %hs, Family 0x%X, Model 0x%X, Stepping 0x%X\n",
|
||||||
|
Prcb->CpuId.VendorName,
|
||||||
|
Prcb->CpuId.Family,
|
||||||
|
Prcb->CpuId.Model,
|
||||||
|
Prcb->CpuId.Stepping);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
|||||||
@@ -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]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user