forked from xt-sys/exectos
Compare commits
144 Commits
master
...
boot-frame
Author | SHA1 | Date | |
---|---|---|---|
534ad63ae8 | |||
4696faf86d
|
|||
332e57f305
|
|||
4ee3daa8f8
|
|||
ee82475aa3
|
|||
ff0caf93da
|
|||
20fd950ef4
|
|||
6e10089280
|
|||
9298aef87e
|
|||
6c66028800
|
|||
ed293c7e61
|
|||
7791ca13e2
|
|||
d0aeaf1109
|
|||
c041457799
|
|||
08a9a0273f
|
|||
ae4b95380a
|
|||
2b49b23d41
|
|||
38f1af025c
|
|||
d0577611ca
|
|||
7b357ebc54
|
|||
4c380bae1c
|
|||
1b0468f742
|
|||
e7425de523
|
|||
b2c8fa3e62
|
|||
9bbac6d3c1
|
|||
dcae0cbb91
|
|||
57fbbf820c
|
|||
86fd2b4eea
|
|||
7117d76842
|
|||
98ad2087de
|
|||
fabf3a3a5e
|
|||
ba9e5b1b88
|
|||
307ec1794c
|
|||
f86b63f68d
|
|||
2f25107d09
|
|||
556e832056
|
|||
f4561c1f4f
|
|||
ee97388981
|
|||
0a0fdffc46
|
|||
e3898f28fc
|
|||
52c4d2a346
|
|||
404595801d
|
|||
3e097c260d
|
|||
e0844b38cd
|
|||
f321ca908b
|
|||
79ec28641a
|
|||
4592955da1
|
|||
a2fe39defd
|
|||
7cdfa8f79d
|
|||
0647b853a6
|
|||
3a11d536d5
|
|||
96043f3d70
|
|||
5f44458e64
|
|||
cc632c5ef9
|
|||
631c260280
|
|||
1357e92627
|
|||
3395934330
|
|||
744fffdd8a
|
|||
0a3450f649
|
|||
7d5eab1a8e
|
|||
7674196cc1
|
|||
c160e5ddf2
|
|||
9518e7da8e
|
|||
e507dd0390
|
|||
510dccc5dc
|
|||
17712883c5
|
|||
5cb6474ade
|
|||
4947f788d5
|
|||
465a23633e
|
|||
7c5d6326f8
|
|||
3f5f57ef12
|
|||
4e24b239a4
|
|||
c8dc2a1407
|
|||
27fec1bacb
|
|||
d8e0e07805
|
|||
8898a427df
|
|||
7e039c47ae
|
|||
c2a4ad026a
|
|||
db81e43525
|
|||
9cc776e06a
|
|||
602da0960c
|
|||
9577a39046
|
|||
f9fe20ba68
|
|||
227da47bfc
|
|||
9f5daafad9
|
|||
b2df65f5cc
|
|||
d6999fad2f
|
|||
e4981b52ed
|
|||
3c25934495
|
|||
e23a4c71a2
|
|||
6ee7243e04
|
|||
d45cc5ffe5
|
|||
3c8b7cb1f2
|
|||
2e415f6ec2
|
|||
5ff9303bd1
|
|||
84ac8f00e0
|
|||
418ff68be4
|
|||
2d1b6363e6
|
|||
34cebf2810
|
|||
0fa4a175e0
|
|||
72a832f190
|
|||
ba65264d1e
|
|||
2ee33ab229
|
|||
1eea654a36
|
|||
c6643125e1
|
|||
b68514b176
|
|||
960e913222
|
|||
e99e563aff
|
|||
0b40a3fb10
|
|||
a84ef21571
|
|||
1ef2560ef6
|
|||
d1b14fccdd
|
|||
88b3a57962
|
|||
9f6121e9b2
|
|||
4a7ea6009d
|
|||
c4a7df6f38
|
|||
2468d80078
|
|||
ebae8c655c
|
|||
1a0bc7f65f
|
|||
91a5db2ee4
|
|||
b639bf3077
|
|||
c409400cbf
|
|||
d602038858
|
|||
017b8603d5
|
|||
a9dd1eaacd
|
|||
f30d3df5b3
|
|||
c3ece4f317
|
|||
1e11acee72
|
|||
57193eecc0
|
|||
720d525b95
|
|||
f77f2bbf92
|
|||
0ed59f223c
|
|||
de2973ac42
|
|||
8491e5fed1
|
|||
6a330e38f2
|
|||
1dcd3fceed
|
|||
5768d4bba6
|
|||
f85fe31b38
|
|||
22f81a106b
|
|||
7e08dc286e
|
|||
3ca6d04f6b
|
|||
e57985da8d
|
|||
8a23cc444f
|
|||
e8771dfc5b
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
OSCW_ARTIFACTS_USERKEY: ${{ secrets.OSCW_ARTIFACTS_USERKEY }}
|
OSCW_ARTIFACTS_USERKEY: ${{ secrets.OSCW_ARTIFACTS_USERKEY }}
|
||||||
run: |
|
run: |
|
||||||
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-bin.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/binaries .
|
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-bin.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/binaries .
|
||||||
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-lib.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/library .
|
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-sdk.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/sdk .
|
||||||
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-sym.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/symbols .
|
tar -I 'gzip' -cpf ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}-sym.tar.gz -C build-${{ matrix.arch }}-${{ matrix.build }}/output/symbols .
|
||||||
gzip -c build-${{ matrix.arch }}-${{ matrix.build }}/output/disk.img > ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}.img.gz
|
gzip -c build-${{ matrix.arch }}-${{ matrix.build }}/output/disk.img > ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}.img.gz
|
||||||
artifact_publish "ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}*.gz" ExectOS
|
artifact_publish "ExectOS-$(date +'%Y%m%d')-${GITHUB_SHA:0:10}-${{ matrix.arch }}-${{ matrix.build }}*.gz" ExectOS
|
||||||
|
@@ -55,9 +55,6 @@ add_definitions(-D__XTOS__)
|
|||||||
add_definitions(-DXTOS_SOURCE_DIR="${EXECTOS_SOURCE_DIR}")
|
add_definitions(-DXTOS_SOURCE_DIR="${EXECTOS_SOURCE_DIR}")
|
||||||
add_definitions(-DXTOS_BINARY_DIR="${EXECTOS_BINARY_DIR}")
|
add_definitions(-DXTOS_BINARY_DIR="${EXECTOS_BINARY_DIR}")
|
||||||
|
|
||||||
# Set libraries target directory
|
|
||||||
set(LIBRARY_OUTPUT_PATH ${EXECTOS_BINARY_DIR}/output/library CACHE PATH "Build directory" FORCE)
|
|
||||||
|
|
||||||
# Compute __FILE__ definition
|
# Compute __FILE__ definition
|
||||||
file(RELATIVE_PATH _PATH_PREFIX ${EXECTOS_BINARY_DIR} ${EXECTOS_SOURCE_DIR})
|
file(RELATIVE_PATH _PATH_PREFIX ${EXECTOS_BINARY_DIR} ${EXECTOS_SOURCE_DIR})
|
||||||
add_compiler_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof XTOS_SOURCE_DIR]")
|
add_compiler_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof XTOS_SOURCE_DIR]")
|
||||||
@@ -68,5 +65,6 @@ set_disk_image_size(32)
|
|||||||
# Build all subprojects
|
# Build all subprojects
|
||||||
add_subdirectory(bootdata)
|
add_subdirectory(bootdata)
|
||||||
add_subdirectory(drivers)
|
add_subdirectory(drivers)
|
||||||
|
add_subdirectory(sdk)
|
||||||
add_subdirectory(xtldr)
|
add_subdirectory(xtldr)
|
||||||
add_subdirectory(xtoskrnl)
|
add_subdirectory(xtoskrnl)
|
||||||
|
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.
|
||||||
|
@@ -40,6 +40,14 @@ SystemPath=multi(0)disk(0)rdisk(0)partition(1)/ExectOS
|
|||||||
KernelFile=xtoskrnl.exe
|
KernelFile=xtoskrnl.exe
|
||||||
Parameters=DEBUG=COM1,115200
|
Parameters=DEBUG=COM1,115200
|
||||||
|
|
||||||
|
[ExectOS_FBDEBUG]
|
||||||
|
SystemName="ExectOS Operating System (FBDEBUG)"
|
||||||
|
SystemType=XTOS
|
||||||
|
BootModules=xtos_o
|
||||||
|
SystemPath=multi(0)disk(0)rdisk(0)partition(1)/ExectOS
|
||||||
|
KernelFile=xtoskrnl.exe
|
||||||
|
Parameters=DEBUG=COM1,115200;SCREEN
|
||||||
|
|
||||||
[ExectOS_NOXPA]
|
[ExectOS_NOXPA]
|
||||||
SystemName="ExectOS Operating System (NOXPA)"
|
SystemName="ExectOS Operating System (NOXPA)"
|
||||||
SystemType=XTOS
|
SystemType=XTOS
|
||||||
@@ -48,6 +56,14 @@ SystemPath=multi(0)disk(0)rdisk(0)partition(1)/ExectOS
|
|||||||
KernelFile=xtoskrnl.exe
|
KernelFile=xtoskrnl.exe
|
||||||
Parameters=DEBUG=COM1,115200 NOXPA
|
Parameters=DEBUG=COM1,115200 NOXPA
|
||||||
|
|
||||||
|
[ExectOS_NOXPA_FBDEBUG]
|
||||||
|
SystemName="ExectOS Operating System (NOXPA / FBDEBUG)"
|
||||||
|
SystemType=XTOS
|
||||||
|
BootModules=xtos_o
|
||||||
|
SystemPath=multi(0)disk(0)rdisk(0)partition(1)/ExectOS
|
||||||
|
KernelFile=xtoskrnl.exe
|
||||||
|
Parameters=DEBUG=COM1,115200;SCREEN NOXPA
|
||||||
|
|
||||||
[Windows]
|
[Windows]
|
||||||
SystemName="Microsoft Windows 2000"
|
SystemName="Microsoft Windows 2000"
|
||||||
SystemType=NT50
|
SystemType=NT50
|
||||||
|
@@ -7,8 +7,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND NTOSDRV_SOURCE
|
list(APPEND NTOSDRV_SOURCE
|
||||||
${NTOSDRV_SOURCE_DIR}/ntosdrv.c
|
${NTOSDRV_SOURCE_DIR}/ntosdrv.cc
|
||||||
${NTOSDRV_SOURCE_DIR}/rtl.c)
|
${NTOSDRV_SOURCE_DIR}/rtl.cc)
|
||||||
|
|
||||||
# Set module definition SPEC file
|
# Set module definition SPEC file
|
||||||
set_specfile(ntosdrv.spec ntosdrv.sys)
|
set_specfile(ntosdrv.spec ntosdrv.sys)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: drivers/ntosdrv/ntosdrv.c
|
* FILE: drivers/ntosdrv/ntosdrv.cc
|
||||||
* DESCRIPTION: NTOS compatibility driver
|
* DESCRIPTION: NTOS compatibility driver
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
XtDriverEntry(VOID)
|
XtDriverEntry(VOID)
|
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: drivers/ntosdrv/rtl.c
|
* FILE: drivers/ntosdrv/rtl.cc
|
||||||
* DESCRIPTION: NTOS compatibility driver runtime library
|
* DESCRIPTION: NTOS compatibility driver runtime library
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
*
|
*
|
||||||
* @since NT 3.5
|
* @since NT 3.5
|
||||||
*/
|
*/
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlFillMemory(OUT PVOID Destination,
|
RtlFillMemory(OUT PVOID Destination,
|
1
sdk/CMakeLists.txt
Normal file
1
sdk/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
set_sdk_target("xtdk/" "include")
|
@@ -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)
|
||||||
@@ -85,9 +113,14 @@ endfunction()
|
|||||||
|
|
||||||
# This function installs specified target results under destination directory
|
# This function installs specified target results under destination directory
|
||||||
function(set_install_target TARGET DESTINATION)
|
function(set_install_target TARGET DESTINATION)
|
||||||
|
set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${EXECTOS_BINARY_DIR}/output/sdk/lib")
|
||||||
install(TARGETS ${TARGET} DESTINATION ${EXECTOS_BINARY_DIR}/output/binaries/${DESTINATION})
|
install(TARGETS ${TARGET} DESTINATION ${EXECTOS_BINARY_DIR}/output/binaries/${DESTINATION})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(set_sdk_target FILENAME DESTINATION)
|
||||||
|
install(DIRECTORY ${FILENAME} DESTINATION ${EXECTOS_BINARY_DIR}/output/sdk/${DESTINATION})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# This function is responsible for compiling module SPEC file
|
# This function is responsible for compiling module SPEC file
|
||||||
function(set_specfile SPECFILE EXPORTNAME)
|
function(set_specfile SPECFILE EXPORTNAME)
|
||||||
if(NOT ${ARGC} EQUAL 2)
|
if(NOT ${ARGC} EQUAL 2)
|
||||||
|
@@ -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)
|
||||||
@@ -20,8 +22,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
set(CMAKE_C_STANDARD 23)
|
set(CMAKE_C_STANDARD 23)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
# Disable standard C libraries
|
# Disable standard C and C++ libraries
|
||||||
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
|
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
|
||||||
|
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE INTERNAL "")
|
||||||
|
|
||||||
# Clean linker flags
|
# Clean linker flags
|
||||||
set(CMAKE_STATIC_LINKER_FLAGS "")
|
set(CMAKE_STATIC_LINKER_FLAGS "")
|
||||||
|
@@ -12,7 +12,7 @@ endif()
|
|||||||
# Set build optimisation
|
# Set build optimisation
|
||||||
if(BUILD_TYPE STREQUAL "DEBUG")
|
if(BUILD_TYPE STREQUAL "DEBUG")
|
||||||
add_compiler_ccxxflags("/GS- /Zi /Ob0 /Od")
|
add_compiler_ccxxflags("/GS- /Zi /Ob0 /Od")
|
||||||
add_linker_flags("/DEBUG /INCREMENTAL /OPT:NOREF /OPT:NOICF /PDBSOURCEPATH:build")
|
add_linker_flags("/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:NOICF /PDBSOURCEPATH:build")
|
||||||
else()
|
else()
|
||||||
add_compiler_ccxxflags("/GS- /Ob2 /Ot /Ox /Oy")
|
add_compiler_ccxxflags("/GS- /Ob2 /Ot /Ox /Oy")
|
||||||
add_linker_flags("/INCREMENTAL:NO /OPT:REF /OPT:ICF")
|
add_linker_flags("/INCREMENTAL:NO /OPT:REF /OPT:ICF")
|
||||||
@@ -50,8 +50,9 @@ add_compiler_ccxxflags("-Wno-gnu-folding-constant")
|
|||||||
# Disable compiler builtins
|
# Disable compiler builtins
|
||||||
add_compiler_ccxxflags("-fno-builtin")
|
add_compiler_ccxxflags("-fno-builtin")
|
||||||
|
|
||||||
# Set debugging symbols output directory
|
# Set symbols and libraries output directory
|
||||||
set(CMAKE_PDB_OUTPUT_DIRECTORY "${EXECTOS_BINARY_DIR}/output/symbols")
|
set(CMAKE_PDB_OUTPUT_DIRECTORY "${EXECTOS_BINARY_DIR}/output/symbols")
|
||||||
|
set(LIBRARY_OUTPUT_PATH "${EXECTOS_BINARY_DIR}/output/sdk/lib")
|
||||||
|
|
||||||
# Set linker flags
|
# Set linker flags
|
||||||
add_linker_flags("${HOTPATCH_LINKER_FLAG} /LARGEADDRESSAWARE /IGNORE:4039 /IGNORE:4104 /MANIFEST:NO /NODEFAULTLIB /SAFESEH:NO")
|
add_linker_flags("${HOTPATCH_LINKER_FLAG} /LARGEADDRESSAWARE /IGNORE:4039 /IGNORE:4104 /MANIFEST:NO /NODEFAULTLIB /SAFESEH:NO")
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
## XT Building Kit (XTBK)
|
|
||||||
The XTBK, or XT Building Kit is a kind of SDK (Software Development Kit) utilized internally by XTOS, the XT Operating
|
|
||||||
System. It is designed to provide a collection of public functions that are available within the operating system but
|
|
||||||
not necessarily exposed or accessible to software and driver developers.
|
|
||||||
|
|
||||||
Unlike XTDK, which focuses on providing headers for external developers to create kernel mode drivers and user mode
|
|
||||||
applications, XTBK serves as an extension to XTDK and aids in the code-sharing process between different XTOS
|
|
||||||
components. This enables the reuse of code across various components of the operating system, resulting in a more
|
|
||||||
efficient and streamlined development process.
|
|
||||||
|
|
||||||
By incorporating XTBK, XTOS can optimize code reuse, particularly in low-level kernel code that can be shared with other
|
|
||||||
components like the boot loader. This approach helps in reducing code duplication and improving overall code
|
|
||||||
maintainability. Additionally, it allows for consistent implementation of functionality across different parts of the OS.
|
|
@@ -1,44 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: sdk/xtdk/amd64/arfuncs.h
|
|
||||||
* DESCRIPTION: AMD64 architecture library routines
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTDK_AMD64_ARFUNCS_H
|
|
||||||
#define __XTDK_AMD64_ARFUNCS_H
|
|
||||||
|
|
||||||
#include <xtdefs.h>
|
|
||||||
#include <xtstruct.h>
|
|
||||||
#include <xttypes.h>
|
|
||||||
#include <amd64/xtstruct.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Routines used by XTLDR */
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArClearInterruptFlag(VOID);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArHalt(VOID);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONG_PTR
|
|
||||||
ArReadControlRegister(IN USHORT ControlRegister);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONGLONG
|
|
||||||
ArReadModelSpecificRegister(IN ULONG Register);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArWriteControlRegister(IN USHORT ControlRegister,
|
|
||||||
IN UINT_PTR Value);
|
|
||||||
|
|
||||||
#endif /* __XTDK_AMD64_ARFUNCS_H */
|
|
@@ -39,13 +39,22 @@
|
|||||||
#define CR4_PCE 0x00000100
|
#define CR4_PCE 0x00000100
|
||||||
#define CR4_FXSR 0x00000200
|
#define CR4_FXSR 0x00000200
|
||||||
#define CR4_XMMEXCPT 0x00000400
|
#define CR4_XMMEXCPT 0x00000400
|
||||||
|
#define CR4_UMIP 0x00000800
|
||||||
#define CR4_LA57 0x00001000
|
#define CR4_LA57 0x00001000
|
||||||
#define CR4_RESERVED1 0x00001800
|
|
||||||
#define CR4_VMXE 0x00002000
|
#define CR4_VMXE 0x00002000
|
||||||
#define CR4_SMXE 0x00004000
|
#define CR4_SMXE 0x00004000
|
||||||
#define CR4_RESERVED2 0x00018000
|
#define CR4_FSGSBASE 0x00010000
|
||||||
#define CR4_XSAVE 0x00020000
|
#define CR4_PCIDE 0x00020000
|
||||||
#define CR4_RESERVED3 0xFFFC0000
|
#define CR4_XSAVE 0x00040000
|
||||||
|
#define CR4_KL 0x00080000
|
||||||
|
#define CR4_SMEP 0x00100000
|
||||||
|
#define CR4_SMAP 0x00200000
|
||||||
|
#define CR4_PKE 0x00400000
|
||||||
|
#define CR4_CET 0x00800000
|
||||||
|
#define CR4_PKS 0x01000000
|
||||||
|
#define CR4_UINTR 0x02000000
|
||||||
|
#define CR4_LASS 0x08000000
|
||||||
|
#define CR4_LAM_SUP 0x10000000
|
||||||
|
|
||||||
/* Descriptors size */
|
/* Descriptors size */
|
||||||
#define GDT_ENTRIES 128
|
#define GDT_ENTRIES 128
|
||||||
@@ -84,6 +93,7 @@
|
|||||||
#define X86_MSR_FSBASE 0xC0000100
|
#define X86_MSR_FSBASE 0xC0000100
|
||||||
#define X86_MSR_GSBASE 0xC0000101
|
#define X86_MSR_GSBASE 0xC0000101
|
||||||
#define X86_MSR_KERNEL_GSBASE 0xC0000102
|
#define X86_MSR_KERNEL_GSBASE 0xC0000102
|
||||||
|
#define X86_MSR_TSC_AUX 0xC0000103
|
||||||
|
|
||||||
/* Processor features in the EFER MSR */
|
/* Processor features in the EFER MSR */
|
||||||
#define X86_MSR_EFER_SCE (1 << 0)
|
#define X86_MSR_EFER_SCE (1 << 0)
|
||||||
@@ -91,6 +101,10 @@
|
|||||||
#define X86_MSR_EFER_LMA (1 << 10)
|
#define X86_MSR_EFER_LMA (1 << 10)
|
||||||
#define X86_MSR_EFER_NXE (1 << 11)
|
#define X86_MSR_EFER_NXE (1 << 11)
|
||||||
#define X86_MSR_EFER_SVME (1 << 12)
|
#define X86_MSR_EFER_SVME (1 << 12)
|
||||||
|
#define X86_EFER_LMSLE (1 << 13)
|
||||||
|
#define X86_EFER_FFXSR (1 << 14)
|
||||||
|
#define X86_EFER_TCE (1 << 15)
|
||||||
|
#define X86_EFER_AUTOIBRS (1 << 21)
|
||||||
|
|
||||||
/* X86 EFLAG bit masks definitions */
|
/* X86 EFLAG bit masks definitions */
|
||||||
#define X86_EFLAGS_NF_MASK 0x00000000 /* None */
|
#define X86_EFLAGS_NF_MASK 0x00000000 /* None */
|
||||||
@@ -405,4 +419,11 @@ typedef struct _CPUID_SIGNATURE
|
|||||||
ULONG Unused2:4;
|
ULONG Unused2:4;
|
||||||
} CPU_SIGNATURE, *PCPU_SIGNATURE;
|
} CPU_SIGNATURE, *PCPU_SIGNATURE;
|
||||||
|
|
||||||
|
/* Trampoline types */
|
||||||
|
typedef enum _TRAMPOLINE_TYPE
|
||||||
|
{
|
||||||
|
TrampolineApStartup,
|
||||||
|
TrampolineEnableXpa
|
||||||
|
} TRAMPOLINE_TYPE, *PTRAMPOLINE_TYPE;
|
||||||
|
|
||||||
#endif /* __XTDK_AMD64_ARTYPES_H */
|
#endif /* __XTDK_AMD64_ARTYPES_H */
|
||||||
|
@@ -15,32 +15,38 @@
|
|||||||
#include <amd64/xtstruct.h>
|
#include <amd64/xtstruct.h>
|
||||||
|
|
||||||
|
|
||||||
/* HAL library routines forward references */
|
/* Hardware layer routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UCHAR
|
UCHAR
|
||||||
HlIoPortInByte(IN USHORT Port);
|
HlReadPort8(IN USHORT Port);
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONG
|
|
||||||
HlIoPortInLong(IN USHORT Port);
|
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
USHORT
|
USHORT
|
||||||
HlIoPortInShort(IN USHORT Port);
|
HlReadPort16(IN USHORT Port);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
ULONG
|
||||||
|
HlReadPort32(IN USHORT Port);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
HlIoPortOutByte(IN USHORT Port,
|
HlWritePort8(IN USHORT Port,
|
||||||
IN UCHAR Data);
|
IN UCHAR Data);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
HlIoPortOutLong(IN USHORT Port,
|
HlWritePort16(IN USHORT Port,
|
||||||
IN ULONG Value);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
HlIoPortOutShort(IN USHORT Port,
|
|
||||||
IN USHORT Value);
|
IN USHORT Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
HlWritePort32(IN USHORT Port,
|
||||||
|
IN ULONG Value);
|
||||||
|
|
||||||
#endif /* __XTDK_AMD64_HLFUNCS_H */
|
#endif /* __XTDK_AMD64_HLFUNCS_H */
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
#define APIC_DF_FLAT 0xFFFFFFFF
|
#define APIC_DF_FLAT 0xFFFFFFFF
|
||||||
#define APIC_DF_CLUSTER 0x0FFFFFFF
|
#define APIC_DF_CLUSTER 0x0FFFFFFF
|
||||||
|
|
||||||
/* APIC delivery modes */
|
|
||||||
#define APIC_DM_FIXED 0x00000000
|
|
||||||
#define APIC_DM_LOWPRIO 0x00000100
|
|
||||||
#define APIC_DM_SMI 0x00000200
|
|
||||||
#define APIC_DM_REMOTE 0x00000300
|
|
||||||
#define APIC_DM_NMI 0x00000400
|
|
||||||
#define APIC_DM_INIT 0x00000500
|
|
||||||
#define APIC_DM_STARTUP 0x00000600
|
|
||||||
#define APIC_DM_EXTINT 0x00000700
|
|
||||||
|
|
||||||
/* APIC trigger modes */
|
/* APIC trigger modes */
|
||||||
#define APIC_TGM_EDGE 0
|
#define APIC_TGM_EDGE 0
|
||||||
#define APIC_TGM_LEVEL 1
|
#define APIC_TGM_LEVEL 1
|
||||||
@@ -79,6 +69,35 @@
|
|||||||
/* Initial stall factor */
|
/* Initial stall factor */
|
||||||
#define INITIAL_STALL_FACTOR 100
|
#define INITIAL_STALL_FACTOR 100
|
||||||
|
|
||||||
|
/* APIC delivery mode enumeration list */
|
||||||
|
typedef enum _APIC_DM
|
||||||
|
{
|
||||||
|
APIC_DM_FIXED,
|
||||||
|
APIC_DM_LOWPRIO,
|
||||||
|
APIC_DM_SMI,
|
||||||
|
APIC_DM_REMOTE,
|
||||||
|
APIC_DM_NMI,
|
||||||
|
APIC_DM_INIT,
|
||||||
|
APIC_DM_STARTUP,
|
||||||
|
APIC_DM_EXTINT,
|
||||||
|
} APIC_DM, *PAPIC_DM;
|
||||||
|
|
||||||
|
/* APIC destination short-hand enumeration list */
|
||||||
|
typedef enum _APIC_DSH
|
||||||
|
{
|
||||||
|
APIC_DSH_Destination,
|
||||||
|
APIC_DSH_Self,
|
||||||
|
APIC_DSH_AllIncludingSelf,
|
||||||
|
APIC_DSH_AllExclusingSelf
|
||||||
|
} APIC_DSH, *PAPIC_DSH;
|
||||||
|
|
||||||
|
/* APIC mode list */
|
||||||
|
typedef enum _APIC_MODE
|
||||||
|
{
|
||||||
|
APIC_MODE_COMPAT,
|
||||||
|
APIC_MODE_X2APIC
|
||||||
|
} APIC_MODE, *PAPIC_MODE;
|
||||||
|
|
||||||
/* APIC Register Address Map */
|
/* APIC Register Address Map */
|
||||||
typedef enum _APIC_REGISTER
|
typedef enum _APIC_REGISTER
|
||||||
{
|
{
|
||||||
@@ -116,35 +135,6 @@ typedef enum _APIC_REGISTER
|
|||||||
APIC_EXT3LVTR = 0x53 /* Extended Interrupt 3 Local Vector Table */
|
APIC_EXT3LVTR = 0x53 /* Extended Interrupt 3 Local Vector Table */
|
||||||
} APIC_REGISTER, *PAPIC_REGISTER;
|
} APIC_REGISTER, *PAPIC_REGISTER;
|
||||||
|
|
||||||
/* APIC mode list */
|
|
||||||
typedef enum _APIC_MODE
|
|
||||||
{
|
|
||||||
APIC_MODE_COMPAT,
|
|
||||||
APIC_MODE_X2APIC
|
|
||||||
} APIC_MODE, *PAPIC_MODE;
|
|
||||||
|
|
||||||
/* APIC destination short-hand enumeration list */
|
|
||||||
typedef enum _APIC_DSH
|
|
||||||
{
|
|
||||||
APIC_DSH_Destination,
|
|
||||||
APIC_DSH_Self,
|
|
||||||
APIC_DSH_AllIncludingSelf,
|
|
||||||
APIC_DSH_AllExclusingSelf
|
|
||||||
} APIC_DSH, *PAPIC_DSH;
|
|
||||||
|
|
||||||
/* APIC message type enumeration list */
|
|
||||||
typedef enum _APIC_MT
|
|
||||||
{
|
|
||||||
APIC_MT_Fixed,
|
|
||||||
APIC_MT_LowestPriority,
|
|
||||||
APIC_MT_SMI,
|
|
||||||
APIC_MT_RemoteRead,
|
|
||||||
APIC_MT_NMI,
|
|
||||||
APIC_MT_INIT,
|
|
||||||
APIC_MT_Startup,
|
|
||||||
APIC_MT_ExtInt,
|
|
||||||
} APIC_MT, *PAPIC_MT;
|
|
||||||
|
|
||||||
/* I8259 PIC interrupt mode enumeration list */
|
/* I8259 PIC interrupt mode enumeration list */
|
||||||
typedef enum _PIC_I8259_ICW1_INTERRUPT_MODE
|
typedef enum _PIC_I8259_ICW1_INTERRUPT_MODE
|
||||||
{
|
{
|
||||||
@@ -217,7 +207,7 @@ typedef union _APIC_COMMAND_REGISTER
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ULONGLONG Vector:8;
|
ULONGLONG Vector:8;
|
||||||
ULONGLONG MessageType:3;
|
ULONGLONG DeliveryMode:3;
|
||||||
ULONGLONG DestinationMode:1;
|
ULONGLONG DestinationMode:1;
|
||||||
ULONGLONG DeliveryStatus:1;
|
ULONGLONG DeliveryStatus:1;
|
||||||
ULONGLONG ReservedMBZ:1;
|
ULONGLONG ReservedMBZ:1;
|
||||||
@@ -237,7 +227,7 @@ typedef union _APIC_LVT_REGISTER
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ULONG Vector:8;
|
ULONG Vector:8;
|
||||||
ULONG MessageType:3;
|
ULONG DeliveryMode:3;
|
||||||
ULONG Reserved1:1;
|
ULONG Reserved1:1;
|
||||||
ULONG DeliveryStatus:1;
|
ULONG DeliveryStatus:1;
|
||||||
ULONG Reserved2:1;
|
ULONG Reserved2:1;
|
||||||
|
@@ -118,8 +118,8 @@
|
|||||||
#define KERNEL_STACK_GUARD_PAGES 1
|
#define KERNEL_STACK_GUARD_PAGES 1
|
||||||
|
|
||||||
/* Processor structures size */
|
/* Processor structures size */
|
||||||
#define KPROCESSOR_STRUCTURES_SIZE ((2 * KERNEL_STACK_SIZE) + sizeof(ArInitialGdt) + sizeof(ArInitialTss) + \
|
#define KPROCESSOR_STRUCTURES_SIZE ((2 * KERNEL_STACK_SIZE) + (GDT_ENTRIES * sizeof(KGDTENTRY)) + sizeof(KTSS) + \
|
||||||
sizeof(ArInitialProcessorBlock) + MM_PAGE_SIZE)
|
sizeof(KPROCESSOR_BLOCK) + MM_PAGE_SIZE)
|
||||||
|
|
||||||
/* Kernel frames */
|
/* Kernel frames */
|
||||||
#define KEXCEPTION_FRAME_SIZE sizeof(KEXCEPTION_FRAME)
|
#define KEXCEPTION_FRAME_SIZE sizeof(KEXCEPTION_FRAME)
|
||||||
|
@@ -18,11 +18,18 @@
|
|||||||
#define MM_PAGE_SHIFT 12L
|
#define MM_PAGE_SHIFT 12L
|
||||||
#define MM_PAGE_SIZE 4096
|
#define MM_PAGE_SIZE 4096
|
||||||
|
|
||||||
/* Page directory and page base addresses */
|
/* Page directory and page base addresses for 4-level paging */
|
||||||
#define MM_PTE_BASE 0xFFFFF68000000000UI64
|
#define MM_PTE_BASE 0xFFFFF68000000000ULL
|
||||||
#define MM_PDE_BASE 0xFFFFF6FB40000000UI64
|
#define MM_PDE_BASE 0xFFFFF6FB40000000ULL
|
||||||
#define MM_PPE_BASE 0xFFFFF6FB7DA00000UI64
|
#define MM_PPE_BASE 0xFFFFF6FB7DA00000ULL
|
||||||
#define MM_PXE_BASE 0xFFFFF6FB7DBED000UI64
|
#define MM_PXE_BASE 0xFFFFF6FB7DBED000ULL
|
||||||
|
|
||||||
|
/* Page directory and page base addresses for 5-level paging */
|
||||||
|
#define MM_PTE_LA57_BASE 0xFFFF000000000000ULL
|
||||||
|
#define MM_PDE_LA57_BASE 0xFFFF010000000000ULL
|
||||||
|
#define MM_PPE_LA57_BASE 0xFFFF010800000000ULL
|
||||||
|
#define MM_PXE_LA57_BASE 0xFFFF010840000000ULL
|
||||||
|
#define MM_P5E_LA57_BASE 0xFFFF010840200000ULL
|
||||||
|
|
||||||
/* PTE shift values */
|
/* PTE shift values */
|
||||||
#define MM_PTE_SHIFT 3
|
#define MM_PTE_SHIFT 3
|
||||||
@@ -30,7 +37,7 @@
|
|||||||
#define MM_PDI_SHIFT 21
|
#define MM_PDI_SHIFT 21
|
||||||
#define MM_PPI_SHIFT 30
|
#define MM_PPI_SHIFT 30
|
||||||
#define MM_PXI_SHIFT 39
|
#define MM_PXI_SHIFT 39
|
||||||
#define MM_LA57_SHIFT 48
|
#define MM_P5I_SHIFT 48
|
||||||
|
|
||||||
/* Number of PTEs per page */
|
/* Number of PTEs per page */
|
||||||
#define MM_PTE_PER_PAGE 512
|
#define MM_PTE_PER_PAGE 512
|
||||||
@@ -54,7 +61,10 @@
|
|||||||
#define MM_HARDWARE_VA_START 0xFFFFFFFFFFC00000ULL
|
#define MM_HARDWARE_VA_START 0xFFFFFFFFFFC00000ULL
|
||||||
|
|
||||||
/* Maximum physical address used by HAL allocations */
|
/* Maximum physical address used by HAL allocations */
|
||||||
#define MM_MAXIMUM_PHYSICAL_ADDRESS 0x00000000FFFFFFFF
|
#define MM_MAXIMUM_PHYSICAL_ADDRESS 0x00000000FFFFFFFFULL
|
||||||
|
|
||||||
|
/* Trampoline code address */
|
||||||
|
#define MM_TRAMPOLINE_ADDRESS 0x80000
|
||||||
|
|
||||||
/* Page size enumeration list */
|
/* Page size enumeration list */
|
||||||
typedef enum _PAGE_SIZE
|
typedef enum _PAGE_SIZE
|
||||||
@@ -85,6 +95,18 @@ typedef struct _HARDWARE_PTE
|
|||||||
ULONGLONG NoExecute:1;
|
ULONGLONG NoExecute:1;
|
||||||
} HARDWARE_PTE, *PHARDWARE_PTE;
|
} HARDWARE_PTE, *PHARDWARE_PTE;
|
||||||
|
|
||||||
|
/* Page map information structure definition */
|
||||||
|
typedef struct _MMPAGEMAP_INFO
|
||||||
|
{
|
||||||
|
BOOLEAN Xpa;
|
||||||
|
ULONGLONG PteBase;
|
||||||
|
ULONGLONG PdeBase;
|
||||||
|
ULONGLONG PpeBase;
|
||||||
|
ULONGLONG PxeBase;
|
||||||
|
ULONGLONG P5eBase;
|
||||||
|
ULONG VaBits;
|
||||||
|
} MMPAGEMAP_INFO, *PMMPAGEMAP_INFO;
|
||||||
|
|
||||||
/* A Page Table Entry on AMD64 system */
|
/* A Page Table Entry on AMD64 system */
|
||||||
typedef struct _MMPTE_HARDWARE
|
typedef struct _MMPTE_HARDWARE
|
||||||
{
|
{
|
||||||
|
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Architecture-specific enumeration lists forward references */
|
/* Architecture-specific enumeration lists forward references */
|
||||||
|
typedef enum _APIC_DM APIC_DM, *PAPIC_DM;
|
||||||
typedef enum _APIC_DSH APIC_DSH, *PAPIC_DSH;
|
typedef enum _APIC_DSH APIC_DSH, *PAPIC_DSH;
|
||||||
typedef enum _APIC_MODE APIC_MODE, *PAPIC_MODE;
|
typedef enum _APIC_MODE APIC_MODE, *PAPIC_MODE;
|
||||||
typedef enum _APIC_MT APIC_MT, *PAPIC_MT;
|
|
||||||
typedef enum _APIC_REGISTER APIC_REGISTER, *PAPIC_REGISTER;
|
typedef enum _APIC_REGISTER APIC_REGISTER, *PAPIC_REGISTER;
|
||||||
typedef enum _CPU_VENDOR CPU_VENDOR, *PCPU_VENDOR;
|
typedef enum _CPU_VENDOR CPU_VENDOR, *PCPU_VENDOR;
|
||||||
typedef enum _CPUID_FEATURES_EXTENDED CPUID_FEATURES_EXTENDED, *PCPUID_FEATURES_EXTENDED;
|
typedef enum _CPUID_FEATURES_EXTENDED CPUID_FEATURES_EXTENDED, *PCPUID_FEATURES_EXTENDED;
|
||||||
@@ -30,6 +30,7 @@ typedef enum _PIC_I8259_ICW1_OPERATING_MODE PIC_I8259_ICW1_OPERATING_MODE, *PPIC
|
|||||||
typedef enum _PIC_I8259_ICW4_BUFFERED_MODE PIC_I8259_ICW4_BUFFERED_MODE, *PPIC_I8259_ICW4_BUFFERED_MODE;
|
typedef enum _PIC_I8259_ICW4_BUFFERED_MODE PIC_I8259_ICW4_BUFFERED_MODE, *PPIC_I8259_ICW4_BUFFERED_MODE;
|
||||||
typedef enum _PIC_I8259_ICW4_EOI_MODE PIC_I8259_ICW4_EOI_MODE, *PPIC_I8259_ICW4_EOI_MODE;
|
typedef enum _PIC_I8259_ICW4_EOI_MODE PIC_I8259_ICW4_EOI_MODE, *PPIC_I8259_ICW4_EOI_MODE;
|
||||||
typedef enum _PIC_I8259_ICW4_SYSTEM_MODE PIC_I8259_ICW4_SYSTEM_MODE, *PPIC_I8259_ICW4_SYSTEM_MODE;
|
typedef enum _PIC_I8259_ICW4_SYSTEM_MODE PIC_I8259_ICW4_SYSTEM_MODE, *PPIC_I8259_ICW4_SYSTEM_MODE;
|
||||||
|
typedef enum _TRAMPOLINE_TYPE TRAMPOLINE_TYPE, *PTRAMPOLINE_TYPE;
|
||||||
|
|
||||||
/* Architecture-specific structures forward references */
|
/* Architecture-specific structures forward references */
|
||||||
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
|
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
|
||||||
@@ -51,6 +52,7 @@ typedef struct _KSWITCH_FRAME KSWITCH_FRAME, *PKSWITCH_FRAME;
|
|||||||
typedef struct _KTHREAD_INIT_FRAME KTHREAD_INIT_FRAME, *PKTHREAD_INIT_FRAME;
|
typedef struct _KTHREAD_INIT_FRAME KTHREAD_INIT_FRAME, *PKTHREAD_INIT_FRAME;
|
||||||
typedef struct _KTRAP_FRAME KTRAP_FRAME, *PKTRAP_FRAME;
|
typedef struct _KTRAP_FRAME KTRAP_FRAME, *PKTRAP_FRAME;
|
||||||
typedef struct _KTSS KTSS, *PKTSS;
|
typedef struct _KTSS KTSS, *PKTSS;
|
||||||
|
typedef struct _MMPAGEMAP_INFO MMPAGEMAP_INFO, *PMMPAGEMAP_INFO;
|
||||||
typedef struct _MMPFN MMPFN, *PMMPFN;
|
typedef struct _MMPFN MMPFN, *PMMPFN;
|
||||||
typedef struct _MMPTE_HARDWARE MMPTE_HARDWARE, *PMMPTE_HARDWARE;
|
typedef struct _MMPTE_HARDWARE MMPTE_HARDWARE, *PMMPTE_HARDWARE;
|
||||||
typedef struct _MMPTE_HARDWARE_LARGEPAGE MMPTE_HARDWARE_LARGEPAGE, *PMMPTE_HARDWARE_LARGEPAGE;
|
typedef struct _MMPTE_HARDWARE_LARGEPAGE MMPTE_HARDWARE_LARGEPAGE, *PMMPTE_HARDWARE_LARGEPAGE;
|
||||||
@@ -66,6 +68,7 @@ typedef union _APIC_BASE_REGISTER APIC_BASE_REGISTER, *PAPIC_BASE_REGISTER;
|
|||||||
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER, *PAPIC_COMMAND_REGISTER;
|
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER, *PAPIC_COMMAND_REGISTER;
|
||||||
typedef union _APIC_LVT_REGISTER APIC_LVT_REGISTER, *PAPIC_LVT_REGISTER;
|
typedef union _APIC_LVT_REGISTER APIC_LVT_REGISTER, *PAPIC_LVT_REGISTER;
|
||||||
typedef union _APIC_SPURIOUS_REGISTER APIC_SPURIOUS_REGISTER, *PAPIC_SPURIOUS_REGISTER;
|
typedef union _APIC_SPURIOUS_REGISTER APIC_SPURIOUS_REGISTER, *PAPIC_SPURIOUS_REGISTER;
|
||||||
|
typedef union _MMPTE MMP5E, *PMMP5E;
|
||||||
typedef union _MMPTE MMPDE, *PMMPDE;
|
typedef union _MMPTE MMPDE, *PMMPDE;
|
||||||
typedef union _MMPTE MMPPE, *PMMPPE;
|
typedef union _MMPTE MMPPE, *PMMPPE;
|
||||||
typedef union _MMPTE MMPTE, *PMMPTE;
|
typedef union _MMPTE MMPTE, *PMMPTE;
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* XT BootLoader routines forward references */
|
/* XT BootLoader routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
* FILE: sdk/xtdk/bltypes.h
|
* FILE: sdk/xtdk/bltypes.h
|
||||||
* DESCRIPTION: XT Boot Loader structures definitions
|
* DESCRIPTION: XT Boot Loader structures definitions
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
* Aiken Harris <harraiken91@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __XTDK_BLTYPES_H
|
#ifndef __XTDK_BLTYPES_H
|
||||||
@@ -18,10 +19,11 @@
|
|||||||
|
|
||||||
/* EFI XT boot devices */
|
/* EFI XT boot devices */
|
||||||
#define XTBL_BOOT_DEVICE_UNKNOWN 0x00
|
#define XTBL_BOOT_DEVICE_UNKNOWN 0x00
|
||||||
#define XTBL_BOOT_DEVICE_CDROM 0x01
|
#define XTBL_BOOT_DEVICE_ESP 0x01
|
||||||
#define XTBL_BOOT_DEVICE_FLOPPY 0x02
|
#define XTBL_BOOT_DEVICE_CDROM 0x02
|
||||||
#define XTBL_BOOT_DEVICE_HARDDISK 0x03
|
#define XTBL_BOOT_DEVICE_FLOPPY 0x04
|
||||||
#define XTBL_BOOT_DEVICE_RAMDISK 0x04
|
#define XTBL_BOOT_DEVICE_HARDDISK 0x08
|
||||||
|
#define XTBL_BOOT_DEVICE_RAMDISK 0x10
|
||||||
|
|
||||||
/* XTLDR Debug Port type definitions */
|
/* XTLDR Debug Port type definitions */
|
||||||
#define XTBL_DEBUGPORT_SCREEN 1
|
#define XTBL_DEBUGPORT_SCREEN 1
|
||||||
@@ -40,100 +42,130 @@
|
|||||||
#define XTBL_TUI_MAX_DIALOG_WIDTH 100
|
#define XTBL_TUI_MAX_DIALOG_WIDTH 100
|
||||||
|
|
||||||
/* XTLDR Routine pointers */
|
/* XTLDR Routine pointers */
|
||||||
typedef LONG (*PBL_GET_MEMTYPE_ROUTINE)(IN EFI_MEMORY_TYPE EfiMemoryType);
|
typedef LOADER_MEMORY_TYPE (XTCDECL *PBL_GET_MEMTYPE_ROUTINE)(IN EFI_MEMORY_TYPE EfiMemoryType);
|
||||||
|
|
||||||
/* Boot Loader protocol routine pointers */
|
/* Boot Loader protocol routine pointers */
|
||||||
typedef EFI_STATUS (*PBL_ALLOCATE_PAGES)(IN ULONGLONG Size, OUT PEFI_PHYSICAL_ADDRESS Memory);
|
typedef EFI_STATUS (XTCDECL *PBL_ALLOCATE_PAGES)(IN EFI_ALLOCATE_TYPE AllocationType, IN ULONGLONG Size, OUT PEFI_PHYSICAL_ADDRESS Memory);
|
||||||
typedef EFI_STATUS (*PBL_ALLOCATE_POOL)(IN UINT_PTR Size, OUT PVOID *Memory);
|
typedef EFI_STATUS (XTCDECL *PBL_ALLOCATE_POOL)(IN UINT_PTR Size, OUT PVOID *Memory);
|
||||||
typedef EFI_STATUS (*PBL_BOOTMENU_INITIALIZE_OS_LIST)(OUT PXTBL_BOOTMENU_ITEM *MenuEntries, OUT PULONG EntriesCount, OUT PULONG DefaultId);
|
typedef EFI_STATUS (XTCDECL *PBL_BOOTMENU_INITIALIZE_OS_LIST)(IN ULONG MaxNameLength, OUT PXTBL_BOOTMENU_ITEM *MenuEntries, OUT PULONG EntriesCount, OUT PULONG DefaultId);
|
||||||
typedef BOOLEAN (*PBL_BOOTUTIL_GET_BOOLEAN_PARAMETER)(IN CONST PWCHAR Parameters, IN CONST PWCHAR Needle);
|
typedef BOOLEAN (XTCDECL *PBL_BOOTUTILS_GET_BOOLEAN_PARAMETER)(IN PCWSTR Parameters, IN PCWSTR Needle);
|
||||||
typedef EFI_STATUS (*PBL_BUILD_PAGE_MAP)(IN PXTBL_PAGE_MAPPING PageMap, IN ULONG_PTR SelfMapAddress);
|
typedef VOID (XTAPI *PBL_BOOTUTILS_GET_TRAMPOLINE_INFORMATION)(IN TRAMPOLINE_TYPE TrampolineType, OUT PVOID *TrampolineCode, OUT PULONG_PTR TrampolineSize);
|
||||||
typedef EFI_STATUS (*PBL_CLOSE_VOLUME)(IN PEFI_HANDLE VolumeHandle);
|
typedef EFI_STATUS (XTCDECL *PBL_BUILD_PAGE_MAP)(IN PXTBL_PAGE_MAPPING PageMap, IN ULONG_PTR SelfMapAddress);
|
||||||
typedef VOID (*PBL_CLEAR_CONSOLE_LINE)(IN ULONGLONG LineNo);
|
typedef EFI_STATUS (XTCDECL *PBL_CLOSE_VOLUME)(IN PEFI_HANDLE VolumeHandle);
|
||||||
typedef EFI_STATUS (*PBL_CLOSE_XT_PROTOCOL)(IN PEFI_HANDLE Handle, IN PEFI_GUID ProtocolGuid);
|
typedef VOID (XTCDECL *PBL_CLEAR_CONSOLE_LINE)(IN ULONGLONG LineNo);
|
||||||
typedef BOOLEAN (*PBL_CONFIG_GET_BOOLEAN_VALUE)(IN CONST PWCHAR ConfigName);
|
typedef BOOLEAN (XTCDECL *PBL_CPU_CPUID)(IN OUT PCPUID_REGISTERS Registers);
|
||||||
typedef PWCHAR (*PBL_CONFIG_GET_VALUE)(IN CONST PWCHAR ConfigName);
|
typedef ULONG_PTR (XTCDECL *PBL_CPU_READ_CONTROL_REGISTER)(IN USHORT ControlRegister);
|
||||||
typedef VOID (*PBL_CONSOLE_CLEAR_SCREEN)();
|
typedef ULONGLONG (XTCDECL *PBL_CPU_READ_MODEL_SPECIFIC_REGISTER)(IN ULONG Register);
|
||||||
typedef VOID (*PBL_CONSOLE_DISABLE_CURSOR)();
|
typedef VOID (XTCDECL *PBL_CPU_WRITE_CONTROL_REGISTER)(IN USHORT ControlRegister, IN UINT_PTR Value);
|
||||||
typedef VOID (*PBL_CONSOLE_ENABLE_CURSOR)();
|
typedef EFI_STATUS (XTCDECL *PBL_CLOSE_XT_PROTOCOL)(IN PEFI_HANDLE Handle, IN PEFI_GUID ProtocolGuid);
|
||||||
typedef VOID (*PBL_CONSOLE_PRINT)(IN PUSHORT Format, IN ...);
|
typedef BOOLEAN (XTCDECL *PBL_CONFIG_GET_BOOLEAN_VALUE)(IN PCWSTR ConfigName);
|
||||||
typedef VOID (*PBL_CONSOLE_QUERY_MODE)(OUT PUINT_PTR ResX, OUT PUINT_PTR ResY);
|
typedef EFI_STATUS (XTCDECL *PBL_CONFIG_GET_BOOT_OPTION_VALUE)(IN PLIST_ENTRY Options, IN PCWSTR OptionName, OUT PWCHAR *OptionValue);
|
||||||
typedef VOID (*PBL_CONSOLE_READ_KEY_STROKE)(OUT PEFI_INPUT_KEY Key);
|
typedef VOID (XTCDECL *PBL_CONFIG_GET_EDITABLE_OPTIONS)(OUT PCWSTR **OptionsArray, OUT PULONG OptionsCount);
|
||||||
typedef VOID (*PBL_CONSOLE_RESET_INPUT_BUFFER)();
|
typedef EFI_STATUS (XTCDECL *PBL_CONFIG_GET_VALUE)(IN PCWSTR ConfigName, OUT PWCHAR *ConfigValue);
|
||||||
typedef VOID (*PBL_CONSOLE_SET_ATTRIBUTES)(IN ULONGLONG Attributes);
|
typedef EFI_STATUS (XTCDECL *PBL_CONFIG_SET_BOOT_OPTION_VALUE)(IN PLIST_ENTRY Options, IN PCWSTR OptionName, IN PCWSTR OptionValue);
|
||||||
typedef VOID (*PBL_CONSOLE_SET_CURSOR_POSITION)(IN ULONGLONG PosX, IN ULONGLONG PosY);
|
typedef VOID (XTCDECL *PBL_CONSOLE_CLEAR_SCREEN)();
|
||||||
typedef VOID (*PBL_CONSOLE_WRITE)(IN PUSHORT String);
|
typedef VOID (XTCDECL *PBL_CONSOLE_DISABLE_CURSOR)();
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_ENABLE_CURSOR)();
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_PRINT)(IN PCWSTR Format, IN ...);
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_QUERY_MODE)(OUT PUINT_PTR ResX, OUT PUINT_PTR ResY);
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_READ_KEY_STROKE)(OUT PEFI_INPUT_KEY Key);
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_RESET_INPUT_BUFFER)();
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_SET_ATTRIBUTES)(IN ULONGLONG Attributes);
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_SET_CURSOR_POSITION)(IN ULONGLONG PosX, IN ULONGLONG PosY);
|
||||||
|
typedef VOID (XTCDECL *PBL_CONSOLE_WRITE)(IN PCWSTR String);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_COMPARE_MEMORY)(IN PCVOID LeftBuffer, IN PCVOID RightBuffer, IN SIZE_T Length);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_WIDESTRING_COMPARE)(IN PCWSTR String1, IN PCWSTR String2, IN SIZE_T Length);
|
||||||
typedef VOID (XTAPI *PBL_COPY_MEMORY)(OUT PVOID Destination, IN PCVOID Source, IN SIZE_T Length);
|
typedef VOID (XTAPI *PBL_COPY_MEMORY)(OUT PVOID Destination, IN PCVOID Source, IN SIZE_T Length);
|
||||||
typedef VOID (*PBL_DEBUG_PRINT)(IN PUSHORT Format, IN ...);
|
typedef VOID (XTCDECL *PBL_DEBUG_PRINT)(IN PCWSTR Format, IN ...);
|
||||||
typedef EFI_STATUS (*PBL_ENTER_FIRMWARE_SETUP)();
|
typedef EFI_STATUS (XTCDECL *PBL_ENTER_FIRMWARE_SETUP)();
|
||||||
typedef EFI_STATUS (*PBL_EXIT_BOOT_SERVICES)();
|
typedef EFI_STATUS (XTCDECL *PBL_EXIT_BOOT_SERVICES)();
|
||||||
typedef EFI_STATUS (*PBL_FIND_BOOT_PROTOCOL)(IN PWCHAR SystemType, OUT PEFI_GUID BootProtocolGuid);
|
typedef EFI_STATUS (XTCDECL *PBL_FIND_BOOT_PROTOCOL)(IN PCWSTR SystemType, OUT PEFI_GUID BootProtocolGuid);
|
||||||
typedef EFI_STATUS (*PBL_FREE_PAGES)(IN ULONGLONG Size, IN EFI_PHYSICAL_ADDRESS Memory);
|
typedef EFI_STATUS (XTCDECL *PBL_FREE_PAGES)(IN ULONGLONG Size, IN EFI_PHYSICAL_ADDRESS Memory);
|
||||||
typedef EFI_STATUS (*PBL_FREE_POOL)(IN PVOID Memory);
|
typedef EFI_STATUS (XTCDECL *PBL_FREE_POOL)(IN PVOID Memory);
|
||||||
typedef EFI_STATUS (*PBL_GET_CONFIGURATION_TABLE)(IN PEFI_GUID TableGuid, OUT PVOID *Table);
|
typedef EFI_STATUS (XTCDECL *PBL_GET_CONFIGURATION_TABLE)(IN PEFI_GUID TableGuid, OUT PVOID *Table);
|
||||||
typedef EFI_STATUS (*PBL_GET_EFI_VARIABLE)(IN PEFI_GUID Vendor, IN PWCHAR VariableName, OUT PVOID *VariableValue);
|
typedef EFI_STATUS (XTCDECL *PBL_GET_EFI_VARIABLE)(IN PEFI_GUID Vendor, IN PCWSTR VariableName, OUT PVOID *VariableValue);
|
||||||
typedef VOID (*PBL_GET_MAPPINGS_COUNT)(IN PXTBL_PAGE_MAPPING PageMap, OUT PULONG NumberOfMappings);
|
typedef VOID (XTCDECL *PBL_GET_MAPPINGS_COUNT)(IN PXTBL_PAGE_MAPPING PageMap, OUT PULONG NumberOfMappings);
|
||||||
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
typedef EFI_STATUS (XTCDECL *PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
||||||
typedef PLIST_ENTRY (*PBL_GET_MODULES_LIST)();
|
typedef PLIST_ENTRY (XTCDECL *PBL_GET_MODULES_LIST)();
|
||||||
typedef ULONGLONG (*PBL_GET_RANDOM_VALUE)(IN OUT PULONGLONG RNGBuffer);
|
typedef ULONGLONG (XTCDECL *PBL_GET_RANDOM_VALUE)(IN OUT PULONGLONG RNGBuffer);
|
||||||
typedef INT_PTR (*PBL_GET_SECURE_BOOT_STATUS)();
|
typedef INT_PTR (XTCDECL *PBL_GET_SECURE_BOOT_STATUS)();
|
||||||
typedef PVOID (*PBL_GET_VIRTUAL_ADDRESS)(IN PXTBL_PAGE_MAPPING PageMap, IN PVOID PhysicalAddress);
|
typedef PVOID (XTCDECL *PBL_GET_VIRTUAL_ADDRESS)(IN PXTBL_PAGE_MAPPING PageMap, IN PVOID PhysicalAddress);
|
||||||
typedef EFI_STATUS (*PBL_INITIALIZE_ENTROPY)(PULONGLONG RNGBuffer);
|
typedef EFI_STATUS (XTCDECL *PBL_INITIALIZE_ENTROPY)(PULONGLONG RNGBuffer);
|
||||||
typedef VOID (*PBL_INITIALIZE_PAGE_MAP)(OUT PXTBL_PAGE_MAPPING PageMap, IN SHORT PageMapLevel, IN PAGE_SIZE PageSize);
|
typedef VOID (XTCDECL *PBL_INITIALIZE_PAGE_MAP)(OUT PXTBL_PAGE_MAPPING PageMap, IN SHORT PageMapLevel, IN PAGE_SIZE PageSize);
|
||||||
typedef EFI_STATUS (*PBL_INSTALL_XT_PROTOCOL)(IN PVOID Interface, IN PEFI_GUID Guid);
|
typedef EFI_STATUS (XTCDECL *PBL_INSTALL_XT_PROTOCOL)(IN PVOID Interface, IN PEFI_GUID Guid);
|
||||||
typedef EFI_STATUS (*PBL_INVOKE_BOOT_PROTOCOL)(IN PWCHAR ShortName, IN PLIST_ENTRY OptionsList);
|
typedef EFI_STATUS (XTCDECL *PBL_INVOKE_BOOT_PROTOCOL)(IN PWCHAR ShortName, IN PLIST_ENTRY OptionsList);
|
||||||
typedef EFI_STATUS (*PBL_LOCATE_PROTOCOL_HANDLES)(OUT PEFI_HANDLE *Handles, OUT PUINT_PTR Count, IN PEFI_GUID ProtocolGuid);
|
typedef EFI_STATUS (XTCDECL *PBL_LOCATE_PROTOCOL_HANDLES)(OUT PEFI_HANDLE *Handles, OUT PUINT_PTR Count, IN PEFI_GUID ProtocolGuid);
|
||||||
typedef EFI_STATUS (*PBL_LOAD_EFI_IMAGE)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, IN PVOID ImageData, IN SIZE_T ImageSize, OUT PEFI_HANDLE ImageHandle);
|
typedef EFI_STATUS (XTCDECL *PBL_LOAD_EFI_IMAGE)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, IN PVOID ImageData, IN SIZE_T ImageSize, OUT PEFI_HANDLE ImageHandle);
|
||||||
typedef EFI_STATUS (*PBL_MAP_EFI_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN OUT PVOID *MemoryMapAddress, IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine);
|
typedef VOID (XTCDECL *PBL_LLIST_INITIALIZE_HEAD)(IN PLIST_ENTRY ListHead);
|
||||||
typedef EFI_STATUS (*PBL_MAP_PAGE)(IN PXTBL_PAGE_MAPPING PageMap, IN ULONG_PTR VirtualAddress, IN ULONG_PTR PhysicalAddress, IN ULONG NumberOfPages);
|
typedef VOID (XTCDECL *PBL_LLIST_INSERT_HEAD)(IN OUT PLIST_ENTRY ListHead, IN PLIST_ENTRY Entry);
|
||||||
typedef EFI_STATUS (*PBL_MAP_VIRTUAL_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, IN ULONGLONG NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType);
|
typedef VOID (XTCDECL *PBL_LLIST_INSERT_TAIL)(IN OUT PLIST_ENTRY ListHead, IN PLIST_ENTRY Entry);
|
||||||
typedef EFI_STATUS (*PBL_OPEN_VOLUME)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, OUT PEFI_HANDLE DiskHandle, OUT PEFI_FILE_HANDLE *FsHandle);
|
typedef VOID (XTCDECL *PBL_LLIST_REMOVE_ENTRY)(IN PLIST_ENTRY Entry);
|
||||||
typedef EFI_STATUS (*PBL_OPEN_PROTOCOL)(OUT PEFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid);
|
typedef EFI_STATUS (XTCDECL *PBL_MAP_EFI_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN OUT PVOID *MemoryMapAddress, IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine);
|
||||||
typedef EFI_STATUS (*PBL_OPEN_PROTOCOL_HANDLE)(IN EFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid);
|
typedef EFI_STATUS (XTCDECL *PBL_MAP_PAGE)(IN PXTBL_PAGE_MAPPING PageMap, IN ULONG_PTR VirtualAddress, IN ULONG_PTR PhysicalAddress, IN ULONG NumberOfPages);
|
||||||
typedef PVOID (*PBL_PHYSICAL_ADDRESS_TO_VIRTUAL)(IN PVOID PhysicalAddress, IN PVOID PhysicalBase, IN PVOID VirtualBase);
|
typedef EFI_STATUS (XTCDECL *PBL_MAP_VIRTUAL_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, IN ULONGLONG NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType);
|
||||||
typedef EFI_STATUS (*PBL_PHYSICAL_LIST_TO_VIRTUAL)(IN PXTBL_PAGE_MAPPING PageMap, IN OUT PLIST_ENTRY ListHead, IN PVOID PhysicalBase, IN PVOID VirtualBase);
|
typedef VOID (XTAPI *PBL_MOVE_MEMORY)(IN OUT PVOID Destination, IN PCVOID Source, IN SIZE_T Length);
|
||||||
typedef EFI_STATUS (*PBL_POWER_SYSTEM)();
|
typedef EFI_STATUS (XTCDECL *PBL_OPEN_VOLUME)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, OUT PEFI_HANDLE DiskHandle, OUT PEFI_FILE_HANDLE *FsHandle);
|
||||||
typedef EFI_STATUS (*PBL_READ_FILE)(IN PEFI_FILE_HANDLE DirHandle, IN CONST PWCHAR FileName, OUT PVOID *FileData, OUT PSIZE_T FileSize);
|
typedef EFI_STATUS (XTCDECL *PBL_OPEN_PROTOCOL)(OUT PEFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid);
|
||||||
typedef EFI_STATUS (*PBL_REGISTER_BOOT_PROTOCOL)(IN PWCHAR SystemType, IN PEFI_GUID BootProtocolGuid);
|
typedef EFI_STATUS (XTCDECL *PBL_OPEN_PROTOCOL_HANDLE)(IN EFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid);
|
||||||
typedef VOID (*PBL_REGISTER_XT_BOOT_MENU)(PVOID BootMenuRoutine);
|
typedef PVOID (XTCDECL *PBL_PHYSICAL_ADDRESS_TO_VIRTUAL)(IN PVOID PhysicalAddress, IN PVOID PhysicalBase, IN PVOID VirtualBase);
|
||||||
typedef EFI_STATUS (*PBL_SET_EFI_VARIABLE)(IN PEFI_GUID Vendor, IN PWCHAR VariableName, IN PVOID VariableValue, IN UINT_PTR Size);
|
typedef UCHAR (XTCDECL *PBL_IOPORT_READ_8)(IN USHORT Port);
|
||||||
|
typedef USHORT (XTCDECL *PBL_IOPORT_READ_16)(IN USHORT Port);
|
||||||
|
typedef ULONG (XTCDECL *PBL_IOPORT_READ_32)(IN USHORT Port);
|
||||||
|
typedef VOID (XTCDECL *PBL_IOPORT_WRITE_8)(IN USHORT Port, IN UCHAR Value);
|
||||||
|
typedef VOID (XTCDECL *PBL_IOPORT_WRITE_16)(IN USHORT Port, IN USHORT Value);
|
||||||
|
typedef VOID (XTCDECL *PBL_IOPORT_WRITE_32)(IN USHORT Port, IN ULONG Value);
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_PHYSICAL_LIST_TO_VIRTUAL)(IN PXTBL_PAGE_MAPPING PageMap, IN OUT PLIST_ENTRY ListHead, IN PVOID PhysicalBase, IN PVOID VirtualBase);
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_POWER_SYSTEM)();
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_READ_FILE)(IN PEFI_FILE_HANDLE DirHandle, IN PCWSTR FileName, OUT PVOID *FileData, OUT PSIZE_T FileSize);
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_REGISTER_BOOT_PROTOCOL)(IN PCWSTR SystemType, IN PEFI_GUID BootProtocolGuid);
|
||||||
|
typedef VOID (XTCDECL *PBL_REGISTER_XT_BOOT_MENU)(PVOID BootMenuRoutine);
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_SET_EFI_VARIABLE)(IN PEFI_GUID Vendor, IN PCWSTR VariableName, IN PVOID VariableValue, IN UINT_PTR Size);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_STRING_COMPARE)(IN PCSTR String1, IN PCSTR String2, IN SIZE_T Length);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_STRING_LENGTH)(IN PCSTR String, IN SIZE_T MaxLength);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_STRING_TO_WIDESTRING)(OUT PWCHAR Destination, IN PCSTR *Source, IN SIZE_T Length);
|
||||||
|
typedef PCHAR (XTAPI *PBL_STRING_TRIM)(IN PCHAR String);
|
||||||
typedef VOID (XTAPI *PBL_SET_MEMORY)(OUT PVOID Destination, IN UCHAR Byte, IN SIZE_T Length);
|
typedef VOID (XTAPI *PBL_SET_MEMORY)(OUT PVOID Destination, IN UCHAR Byte, IN SIZE_T Length);
|
||||||
typedef VOID (*PBL_SLEEP_EXECUTION)(IN ULONG_PTR Milliseconds);
|
typedef VOID (XTCDECL *PBL_SLEEP_EXECUTION)(IN ULONG_PTR Milliseconds);
|
||||||
typedef EFI_STATUS (*PBL_START_EFI_IMAGE)(IN EFI_HANDLE ImageHandle);
|
typedef EFI_STATUS (XTCDECL *PBL_START_EFI_IMAGE)(IN EFI_HANDLE ImageHandle);
|
||||||
typedef VOID (*PBL_TUI_DISPLAY_ERROR_DIALOG)(IN PWCHAR Caption, IN PWCHAR Message);
|
typedef VOID (XTCDECL *PBL_TUI_DISPLAY_ERROR_DIALOG)(IN PCWSTR Caption, IN PCWSTR Message);
|
||||||
typedef VOID (*PBL_TUI_DISPLAY_INFO_DIALOG)(IN PWCHAR Caption, IN PWCHAR Message);
|
typedef VOID (XTCDECL *PBL_TUI_DISPLAY_INFO_DIALOG)(IN PCWSTR Caption, IN PCWSTR Message);
|
||||||
typedef VOID (*PBL_TUI_DISPLAY_INPUT_DIALOG)(IN PWCHAR Caption, IN PWCHAR Message, IN PWCHAR *InputFieldText);
|
typedef VOID (XTCDECL *PBL_TUI_DISPLAY_INPUT_DIALOG)(IN PCWSTR Caption, IN PCWSTR Message, IN OUT PWCHAR *InputFieldText);
|
||||||
typedef XTBL_DIALOG_HANDLE (*PBL_TUI_DISPLAY_PROGRESS_DIALOG)(IN PWCHAR Caption, IN PWCHAR Message, IN UCHAR Percentage);
|
typedef XTBL_DIALOG_HANDLE (XTCDECL *PBL_TUI_DISPLAY_PROGRESS_DIALOG)(IN PCWSTR Caption, IN PCWSTR Message, IN UCHAR Percentage);
|
||||||
typedef VOID (*PBL_TUI_UPDATE_PROGRESS_BAR)(IN PXTBL_DIALOG_HANDLE Handle, IN PWCHAR Message, IN UCHAR Percentage);
|
typedef VOID (XTCDECL *PBL_TUI_UPDATE_PROGRESS_BAR)(IN PXTBL_DIALOG_HANDLE Handle, IN PCWSTR Message, IN UCHAR Percentage);
|
||||||
typedef EFI_STATUS (*PBL_WAIT_FOR_EFI_EVENT)(IN UINT_PTR NumberOfEvents, IN PEFI_EVENT Event, OUT PUINT_PTR Index);
|
typedef SIZE_T (XTAPI *PBL_WIDESTRING_COMPARE_INSENSITIVE)(IN PCWSTR String1, IN PCWSTR String2, IN SIZE_T Length);
|
||||||
typedef VOID (*PBL_XT_BOOT_MENU)();
|
typedef PWCHAR (XTAPI *PBL_WIDESTRING_CONCATENATE)(OUT PWCHAR Destination, IN PWCHAR Source, IN SIZE_T Count);
|
||||||
|
typedef XTSTATUS (XTAPI *PBL_WIDESTRING_FORMAT)(IN PRTL_PRINT_CONTEXT Context, IN PCWSTR Format, IN VA_LIST ArgumentList);
|
||||||
|
typedef SIZE_T (XTAPI *PBL_WIDESTRING_LENGTH)(IN PCWSTR String, IN SIZE_T MaxLength);
|
||||||
|
typedef PWCHAR (XTAPI *PBL_WIDESTRING_TOKENIZE)(IN PWCHAR String, IN PCWSTR Delimiter, IN OUT PWCHAR *SavePtr);
|
||||||
|
typedef EFI_STATUS (XTCDECL *PBL_WAIT_FOR_EFI_EVENT)(IN UINT_PTR NumberOfEvents, IN PEFI_EVENT Event, OUT PUINT_PTR Index);
|
||||||
|
typedef VOID (XTCDECL *PBL_XT_BOOT_MENU)();
|
||||||
typedef VOID (XTAPI *PBL_ZERO_MEMORY)(OUT PVOID Destination, IN SIZE_T Length);
|
typedef VOID (XTAPI *PBL_ZERO_MEMORY)(OUT PVOID Destination, IN SIZE_T Length);
|
||||||
|
|
||||||
/* Module protocols routine pointers */
|
/* Module protocols routine pointers */
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_ACPI_DESCRIPTION_POINTER)(OUT PVOID *AcpiTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_ACPI_DESCRIPTION_POINTER)(OUT PVOID *AcpiTable);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_ACPI_TABLE)(IN CONST UINT Signature, IN PVOID PreviousTable, OUT PVOID *AcpiTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_ACPI_TABLE)(IN CONST UINT Signature, IN PVOID PreviousTable, OUT PVOID *AcpiTable);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_APIC_BASE)(OUT PVOID *ApicBase);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_APIC_BASE)(OUT PVOID *ApicBase);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_RSDP_TABLE)(OUT PVOID *AcpiTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_RSDP_TABLE)(OUT PVOID *AcpiTable);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_SMBIOS_TABLE)(OUT PVOID *SmBiosTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_SMBIOS_TABLE)(OUT PVOID *SmBiosTable);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_SMBIOS3_TABLE)(OUT PVOID *SmBiosTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_SMBIOS3_TABLE)(OUT PVOID *SmBiosTable);
|
||||||
typedef EFI_STATUS (*PBL_ACPI_GET_XSDP_TABLE)(OUT PVOID *AcpiTable);
|
typedef EFI_STATUS (XTCDECL *PBL_ACPI_GET_XSDP_TABLE)(OUT PVOID *AcpiTable);
|
||||||
typedef EFI_STATUS (*PBL_BOOTPROTO_BOOT_SYSTEM)(IN PXTBL_BOOT_PARAMETERS Parameters);
|
typedef EFI_STATUS (XTCDECL *PBL_BOOTPROTO_BOOT_SYSTEM)(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_ENTRY_POINT)(IN PVOID ImagePointer, OUT PVOID *EntryPoint);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_ENTRY_POINT)(IN PVOID ImagePointer, OUT PVOID *EntryPoint);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_FILE_SIZE)(IN PVOID ImagePointer, OUT PULONGLONG FileSize);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_FILE_SIZE)(IN PVOID ImagePointer, OUT PULONGLONG FileSize);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_IMAGE_SIZE)(IN PVOID ImagePointer, OUT PUINT ImageSize);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_IMAGE_SIZE)(IN PVOID ImagePointer, OUT PUINT ImageSize);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_MACHINE_TYPE)(IN PVOID ImagePointer, OUT PUSHORT MachineType);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_MACHINE_TYPE)(IN PVOID ImagePointer, OUT PUSHORT MachineType);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_SECTION)(IN PVOID ImagePointer, IN PCHAR SectionName, OUT PULONG *RawData);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_SECTION)(IN PVOID ImagePointer, IN PCHAR SectionName, OUT PULONG *RawData);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_SUBSYSTEM)(IN PVOID ImagePointer, OUT PUSHORT SubSystem);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_SUBSYSTEM)(IN PVOID ImagePointer, OUT PUSHORT SubSystem);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_GET_VERSION)(IN PVOID ImagePointer, OUT PUSHORT Version);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_GET_VERSION)(IN PVOID ImagePointer, OUT PUSHORT Version);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_LOAD_IMAGE)(IN PEFI_FILE_HANDLE FileHandle, IN LOADER_MEMORY_TYPE MemoryType, IN PVOID VirtualAddress, OUT PVOID *ImagePointer);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_LOAD_IMAGE)(IN PEFI_FILE_HANDLE FileHandle, IN LOADER_MEMORY_TYPE MemoryType, IN PVOID VirtualAddress, OUT PVOID *ImagePointer);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_RELOCATE_IMAGE)(IN PVOID ImagePointer, IN EFI_VIRTUAL_ADDRESS Address);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_RELOCATE_IMAGE)(IN PVOID ImagePointer, IN EFI_VIRTUAL_ADDRESS Address);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_UNLOAD_IMAGE)(IN PVOID ImagePointer);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_UNLOAD_IMAGE)(IN PVOID ImagePointer);
|
||||||
typedef EFI_STATUS (*PBL_EXECIMAGE_VERIFY_IMAGE)(IN PVOID ImagePointer);
|
typedef EFI_STATUS (XTCDECL *PBL_EXECIMAGE_VERIFY_IMAGE)(IN PVOID ImagePointer);
|
||||||
typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_DRIVER)(OUT PEFI_GRAPHICS_PROTOCOL Protocol);
|
typedef EFI_STATUS (XTCDECL *PBL_FRAMEBUFFER_GET_DISPLAY_DRIVER)(OUT PEFI_GRAPHICS_PROTOCOL Protocol);
|
||||||
typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase, OUT PULONG_PTR FrameBufferSize, OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo);
|
typedef EFI_STATUS (XTCDECL *PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase, OUT PULONG_PTR FrameBufferSize, OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo);
|
||||||
typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_PREFERRED_SCREEN_RESOLUTION)(OUT PUINT PreferredWidth, OUT PUINT PreferredHeight);
|
typedef EFI_STATUS (XTCDECL *PBL_FRAMEBUFFER_GET_PREFERRED_SCREEN_RESOLUTION)(OUT PUINT PreferredWidth, OUT PUINT PreferredHeight);
|
||||||
typedef EFI_STATUS (*PBL_FRAMEBUFFER_INITIALIZE)();
|
typedef EFI_STATUS (XTCDECL *PBL_FRAMEBUFFER_INITIALIZE)();
|
||||||
typedef EFI_STATUS (*PBL_FRAMEBUFFER_SET_SCREEN_RESOLUTION)(IN UINT Width, IN UINT Height);
|
typedef EFI_STATUS (XTCDECL *PBL_FRAMEBUFFER_SET_SCREEN_RESOLUTION)(IN UINT Width, IN UINT Height);
|
||||||
|
|
||||||
/* Boot parameters structure */
|
/* Boot parameters structure */
|
||||||
typedef struct _XTBL_BOOT_PARAMETERS
|
typedef struct _XTBL_BOOT_PARAMETERS
|
||||||
@@ -153,6 +185,7 @@ typedef struct _XTBL_BOOT_PARAMETERS
|
|||||||
typedef struct _XTBL_BOOTMENU_ITEM
|
typedef struct _XTBL_BOOTMENU_ITEM
|
||||||
{
|
{
|
||||||
PWCHAR EntryName;
|
PWCHAR EntryName;
|
||||||
|
PWCHAR FullName;
|
||||||
PWCHAR ShortName;
|
PWCHAR ShortName;
|
||||||
PLIST_ENTRY Options;
|
PLIST_ENTRY Options;
|
||||||
} XTBL_BOOTMENU_ITEM, *PXTBL_BOOTMENU_ITEM;
|
} XTBL_BOOTMENU_ITEM, *PXTBL_BOOTMENU_ITEM;
|
||||||
@@ -248,13 +281,10 @@ typedef struct _XTBL_PAGE_MAPPING
|
|||||||
/* XTLDR Status data */
|
/* XTLDR Status data */
|
||||||
typedef struct _XTBL_STATUS
|
typedef struct _XTBL_STATUS
|
||||||
{
|
{
|
||||||
PBL_XT_BOOT_MENU BootMenu;
|
|
||||||
BOOLEAN BootServices;
|
|
||||||
ULONG DebugPort;
|
|
||||||
PVOID LoaderBase;
|
PVOID LoaderBase;
|
||||||
ULONGLONG LoaderSize;
|
ULONGLONG LoaderSize;
|
||||||
|
BOOLEAN BootServices;
|
||||||
INT_PTR SecureBoot;
|
INT_PTR SecureBoot;
|
||||||
CPPORT SerialPort;
|
|
||||||
} XTBL_STATUS, *PXTBL_STATUS;
|
} XTBL_STATUS, *PXTBL_STATUS;
|
||||||
|
|
||||||
/* XT framebuffer video mode information structure definition */
|
/* XT framebuffer video mode information structure definition */
|
||||||
@@ -356,12 +386,16 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
} Boot;
|
} Boot;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
PBL_BOOTUTIL_GET_BOOLEAN_PARAMETER GetBooleanParameter;
|
PBL_BOOTUTILS_GET_BOOLEAN_PARAMETER GetBooleanParameter;
|
||||||
} BootUtil;
|
PBL_BOOTUTILS_GET_TRAMPOLINE_INFORMATION GetTrampolineInformation;
|
||||||
|
} BootUtils;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
PBL_CONFIG_GET_BOOLEAN_VALUE GetBooleanValue;
|
PBL_CONFIG_GET_BOOLEAN_VALUE GetBooleanValue;
|
||||||
|
PBL_CONFIG_GET_BOOT_OPTION_VALUE GetBootOptionValue;
|
||||||
|
PBL_CONFIG_GET_EDITABLE_OPTIONS GetEditableOptions;
|
||||||
PBL_CONFIG_GET_VALUE GetValue;
|
PBL_CONFIG_GET_VALUE GetValue;
|
||||||
|
PBL_CONFIG_SET_BOOT_OPTION_VALUE SetBootOptionValue;
|
||||||
} Config;
|
} Config;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@@ -378,6 +412,13 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
PBL_CONSOLE_WRITE Write;
|
PBL_CONSOLE_WRITE Write;
|
||||||
} Console;
|
} Console;
|
||||||
struct
|
struct
|
||||||
|
{
|
||||||
|
PBL_CPU_CPUID CpuId;
|
||||||
|
PBL_CPU_READ_CONTROL_REGISTER ReadControlRegister;
|
||||||
|
PBL_CPU_READ_MODEL_SPECIFIC_REGISTER ReadModelSpecificRegister;
|
||||||
|
PBL_CPU_WRITE_CONTROL_REGISTER WriteControlRegister;
|
||||||
|
} Cpu;
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
PBL_DEBUG_PRINT Print;
|
PBL_DEBUG_PRINT Print;
|
||||||
} Debug;
|
} Debug;
|
||||||
@@ -388,10 +429,27 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
PBL_READ_FILE ReadFile;
|
PBL_READ_FILE ReadFile;
|
||||||
} Disk;
|
} Disk;
|
||||||
struct
|
struct
|
||||||
|
{
|
||||||
|
PBL_IOPORT_READ_8 Read8;
|
||||||
|
PBL_IOPORT_READ_16 Read16;
|
||||||
|
PBL_IOPORT_READ_32 Read32;
|
||||||
|
PBL_IOPORT_WRITE_8 Write8;
|
||||||
|
PBL_IOPORT_WRITE_16 Write16;
|
||||||
|
PBL_IOPORT_WRITE_32 Write32;
|
||||||
|
} IoPort;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
PBL_LLIST_INITIALIZE_HEAD InitializeHead;
|
||||||
|
PBL_LLIST_INSERT_HEAD InsertHead;
|
||||||
|
PBL_LLIST_INSERT_TAIL InsertTail;
|
||||||
|
PBL_LLIST_REMOVE_ENTRY RemoveEntry;
|
||||||
|
} LinkedList;
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
PBL_ALLOCATE_PAGES AllocatePages;
|
PBL_ALLOCATE_PAGES AllocatePages;
|
||||||
PBL_ALLOCATE_POOL AllocatePool;
|
PBL_ALLOCATE_POOL AllocatePool;
|
||||||
PBL_BUILD_PAGE_MAP BuildPageMap;
|
PBL_BUILD_PAGE_MAP BuildPageMap;
|
||||||
|
PBL_COMPARE_MEMORY CompareMemory;
|
||||||
PBL_COPY_MEMORY CopyMemory;
|
PBL_COPY_MEMORY CopyMemory;
|
||||||
PBL_FREE_PAGES FreePages;
|
PBL_FREE_PAGES FreePages;
|
||||||
PBL_FREE_POOL FreePool;
|
PBL_FREE_POOL FreePool;
|
||||||
@@ -402,6 +460,7 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
PBL_MAP_EFI_MEMORY MapEfiMemory;
|
PBL_MAP_EFI_MEMORY MapEfiMemory;
|
||||||
PBL_MAP_PAGE MapPage;
|
PBL_MAP_PAGE MapPage;
|
||||||
PBL_MAP_VIRTUAL_MEMORY MapVirtualMemory;
|
PBL_MAP_VIRTUAL_MEMORY MapVirtualMemory;
|
||||||
|
PBL_MOVE_MEMORY MoveMemory;
|
||||||
PBL_PHYSICAL_ADDRESS_TO_VIRTUAL PhysicalAddressToVirtual;
|
PBL_PHYSICAL_ADDRESS_TO_VIRTUAL PhysicalAddressToVirtual;
|
||||||
PBL_PHYSICAL_LIST_TO_VIRTUAL PhysicalListToVirtual;
|
PBL_PHYSICAL_LIST_TO_VIRTUAL PhysicalListToVirtual;
|
||||||
PBL_SET_MEMORY SetMemory;
|
PBL_SET_MEMORY SetMemory;
|
||||||
@@ -417,6 +476,13 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
PBL_OPEN_PROTOCOL_HANDLE OpenHandle;
|
PBL_OPEN_PROTOCOL_HANDLE OpenHandle;
|
||||||
} Protocol;
|
} Protocol;
|
||||||
struct
|
struct
|
||||||
|
{
|
||||||
|
PBL_STRING_COMPARE Compare;
|
||||||
|
PBL_STRING_LENGTH Length;
|
||||||
|
PBL_STRING_TO_WIDESTRING ToWideString;
|
||||||
|
PBL_STRING_TRIM Trim;
|
||||||
|
} String;
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
PBL_TUI_DISPLAY_ERROR_DIALOG DisplayErrorDialog;
|
PBL_TUI_DISPLAY_ERROR_DIALOG DisplayErrorDialog;
|
||||||
PBL_TUI_DISPLAY_INFO_DIALOG DisplayInfoDialog;
|
PBL_TUI_DISPLAY_INFO_DIALOG DisplayInfoDialog;
|
||||||
@@ -440,7 +506,16 @@ typedef struct _XTBL_LOADER_PROTOCOL
|
|||||||
PBL_SLEEP_EXECUTION SleepExecution;
|
PBL_SLEEP_EXECUTION SleepExecution;
|
||||||
PBL_START_EFI_IMAGE StartEfiImage;
|
PBL_START_EFI_IMAGE StartEfiImage;
|
||||||
PBL_WAIT_FOR_EFI_EVENT WaitForEfiEvent;
|
PBL_WAIT_FOR_EFI_EVENT WaitForEfiEvent;
|
||||||
} Util;
|
} Utils;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
PBL_WIDESTRING_COMPARE Compare;
|
||||||
|
PBL_WIDESTRING_COMPARE_INSENSITIVE CompareInsensitive;
|
||||||
|
PBL_WIDESTRING_CONCATENATE Concatenate;
|
||||||
|
PBL_WIDESTRING_FORMAT Format;
|
||||||
|
PBL_WIDESTRING_LENGTH Length;
|
||||||
|
PBL_WIDESTRING_TOKENIZE Tokenize;
|
||||||
|
} WideString;
|
||||||
} XTBL_LOADER_PROTOCOL, *PXTBL_LOADER_PROTOCOL;
|
} XTBL_LOADER_PROTOCOL, *PXTBL_LOADER_PROTOCOL;
|
||||||
|
|
||||||
#endif /* __XTDK_BLTYPES_H */
|
#endif /* __XTDK_BLTYPES_H */
|
||||||
|
@@ -14,26 +14,32 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Kernel Executive routines forward references */
|
/* Kernel Executive routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
ExWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
@@ -14,16 +14,38 @@
|
|||||||
#include <xttypes.h>
|
#include <xttypes.h>
|
||||||
|
|
||||||
|
|
||||||
/* Routines used by XTLDR */
|
/* Hardware layer routines forward references */
|
||||||
XTCDECL
|
XTCLINK
|
||||||
XTSTATUS
|
XTAPI
|
||||||
HlComPortPutByte(IN PCPPORT Port,
|
UCHAR
|
||||||
IN UCHAR Byte);
|
HlReadRegister8(IN PVOID Register);
|
||||||
|
|
||||||
XTCDECL
|
XTCLINK
|
||||||
XTSTATUS
|
XTAPI
|
||||||
HlInitializeComPort(IN OUT PCPPORT Port,
|
USHORT
|
||||||
IN PUCHAR PortAddress,
|
HlReadRegister16(IN PVOID Register);
|
||||||
IN ULONG BaudRate);
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
ULONG
|
||||||
|
HlReadRegister32(IN PVOID Register);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
HlWriteRegister8(IN PVOID Register,
|
||||||
|
IN UCHAR Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
HlWriteRegister16(IN PVOID Register,
|
||||||
|
IN USHORT Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
HlWriteRegister32(IN PVOID Register,
|
||||||
|
IN ULONG Value);
|
||||||
|
|
||||||
#endif /* __XTDK_HLFUNCS_H */
|
#endif /* __XTDK_HLFUNCS_H */
|
||||||
|
@@ -366,8 +366,8 @@ typedef struct _CPPORT
|
|||||||
UCHAR Ring;
|
UCHAR Ring;
|
||||||
} CPPORT, *PCPPORT;
|
} CPPORT, *PCPPORT;
|
||||||
|
|
||||||
/* HAL framebuffer data structure */
|
/* Framebuffer data structure */
|
||||||
typedef struct _HAL_FRAMEBUFFER_DATA
|
typedef struct _HL_FRAMEBUFFER_DATA
|
||||||
{
|
{
|
||||||
BOOLEAN Initialized;
|
BOOLEAN Initialized;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
@@ -375,7 +375,7 @@ typedef struct _HAL_FRAMEBUFFER_DATA
|
|||||||
UINT Width;
|
UINT Width;
|
||||||
UINT Height;
|
UINT Height;
|
||||||
UINT PixelsPerScanLine;
|
UINT PixelsPerScanLine;
|
||||||
UINT BitsPerPixel;
|
UINT BytesPerPixel;
|
||||||
UINT Pitch;
|
UINT Pitch;
|
||||||
PVOID Font;
|
PVOID Font;
|
||||||
struct
|
struct
|
||||||
@@ -389,7 +389,22 @@ typedef struct _HAL_FRAMEBUFFER_DATA
|
|||||||
USHORT ReservedShift;
|
USHORT ReservedShift;
|
||||||
USHORT ReservedSize;
|
USHORT ReservedSize;
|
||||||
} Pixels;
|
} Pixels;
|
||||||
} HAL_FRAMEBUFFER_DATA, *PHAL_FRAMEBUFFER_DATA;
|
} HL_FRAMEBUFFER_DATA, *PHL_FRAMEBUFFER_DATA;
|
||||||
|
|
||||||
|
/* Scroll region data structure */
|
||||||
|
typedef struct _HL_SCROLL_REGION_DATA
|
||||||
|
{
|
||||||
|
ULONG Left;
|
||||||
|
ULONG Top;
|
||||||
|
ULONG Right;
|
||||||
|
ULONG Bottom;
|
||||||
|
ULONG WidthInChars;
|
||||||
|
ULONG HeightInChars;
|
||||||
|
ULONG CursorX;
|
||||||
|
ULONG CursorY;
|
||||||
|
ULONG BackgroundColor;
|
||||||
|
ULONG TextColor;
|
||||||
|
} HL_SCROLL_REGION_DATA, *PHL_SCROLL_REGION_DATA;
|
||||||
|
|
||||||
/* Processor identity structure */
|
/* Processor identity structure */
|
||||||
typedef struct _PROCESSOR_IDENTITY
|
typedef struct _PROCESSOR_IDENTITY
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: sdk/xtdk/i686/arfuncs.h
|
|
||||||
* DESCRIPTION: I686 architecture library routines
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTDK_I686_ARFUNCS_H
|
|
||||||
#define __XTDK_I686_ARFUNCS_H
|
|
||||||
|
|
||||||
#include <xtdefs.h>
|
|
||||||
#include <xtstruct.h>
|
|
||||||
#include <xttypes.h>
|
|
||||||
#include <i686/xtstruct.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Routines used by XTLDR */
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArClearInterruptFlag(VOID);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArHalt(VOID);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONG_PTR
|
|
||||||
ArReadControlRegister(IN USHORT ControlRegister);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONGLONG
|
|
||||||
ArReadModelSpecificRegister(IN ULONG Register);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
ArWriteControlRegister(IN USHORT ControlRegister,
|
|
||||||
IN UINT_PTR Value);
|
|
||||||
|
|
||||||
#endif /* __XTDK_I686_ARFUNCS_H */
|
|
@@ -39,13 +39,22 @@
|
|||||||
#define CR4_PCE 0x00000100
|
#define CR4_PCE 0x00000100
|
||||||
#define CR4_FXSR 0x00000200
|
#define CR4_FXSR 0x00000200
|
||||||
#define CR4_XMMEXCPT 0x00000400
|
#define CR4_XMMEXCPT 0x00000400
|
||||||
|
#define CR4_UMIP 0x00000800
|
||||||
#define CR4_LA57 0x00001000
|
#define CR4_LA57 0x00001000
|
||||||
#define CR4_RESERVED1 0x00001800
|
|
||||||
#define CR4_VMXE 0x00002000
|
#define CR4_VMXE 0x00002000
|
||||||
#define CR4_SMXE 0x00004000
|
#define CR4_SMXE 0x00004000
|
||||||
#define CR4_RESERVED2 0x00018000
|
#define CR4_FSGSBASE 0x00010000
|
||||||
#define CR4_XSAVE 0x00020000
|
#define CR4_PCIDE 0x00020000
|
||||||
#define CR4_RESERVED3 0xFFFC0000
|
#define CR4_XSAVE 0x00040000
|
||||||
|
#define CR4_KL 0x00080000
|
||||||
|
#define CR4_SMEP 0x00100000
|
||||||
|
#define CR4_SMAP 0x00200000
|
||||||
|
#define CR4_PKE 0x00400000
|
||||||
|
#define CR4_CET 0x00800000
|
||||||
|
#define CR4_PKS 0x01000000
|
||||||
|
#define CR4_UINTR 0x02000000
|
||||||
|
#define CR4_LASS 0x08000000
|
||||||
|
#define CR4_LAM_SUP 0x10000000
|
||||||
|
|
||||||
/* Descriptors size */
|
/* Descriptors size */
|
||||||
#define GDT_ENTRIES 128
|
#define GDT_ENTRIES 128
|
||||||
@@ -375,4 +384,10 @@ typedef struct _CPUID_SIGNATURE
|
|||||||
ULONG Unused2:4;
|
ULONG Unused2:4;
|
||||||
} CPU_SIGNATURE, *PCPU_SIGNATURE;
|
} CPU_SIGNATURE, *PCPU_SIGNATURE;
|
||||||
|
|
||||||
|
/* Trampoline types */
|
||||||
|
typedef enum _TRAMPOLINE_TYPE
|
||||||
|
{
|
||||||
|
TrampolineApStartup
|
||||||
|
} TRAMPOLINE_TYPE, *PTRAMPOLINE_TYPE;
|
||||||
|
|
||||||
#endif /* __XTDK_I686_ARTYPES_H */
|
#endif /* __XTDK_I686_ARTYPES_H */
|
||||||
|
@@ -15,32 +15,38 @@
|
|||||||
#include <i686/xtstruct.h>
|
#include <i686/xtstruct.h>
|
||||||
|
|
||||||
|
|
||||||
/* HAL library routines forward references */
|
/* Hardware layer routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UCHAR
|
UCHAR
|
||||||
HlIoPortInByte(IN USHORT Port);
|
HlReadPort8(IN USHORT Port);
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONG
|
|
||||||
HlIoPortInLong(IN USHORT Port);
|
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
USHORT
|
USHORT
|
||||||
HlIoPortInShort(IN USHORT Port);
|
HlReadPort16(IN USHORT Port);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
ULONG
|
||||||
|
HlReadPort32(IN USHORT Port);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
HlIoPortOutByte(IN USHORT Port,
|
HlWritePort8(IN USHORT Port,
|
||||||
IN UCHAR Data);
|
IN UCHAR Data);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
HlIoPortOutLong(IN USHORT Port,
|
HlWritePort16(IN USHORT Port,
|
||||||
IN ULONG Value);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
HlIoPortOutShort(IN USHORT Port,
|
|
||||||
IN USHORT Value);
|
IN USHORT Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
HlWritePort32(IN USHORT Port,
|
||||||
|
IN ULONG Value);
|
||||||
|
|
||||||
#endif /* __XTDK_I686_HLFUNCS_H */
|
#endif /* __XTDK_I686_HLFUNCS_H */
|
||||||
|
@@ -47,16 +47,6 @@
|
|||||||
#define APIC_DF_FLAT 0xFFFFFFFF
|
#define APIC_DF_FLAT 0xFFFFFFFF
|
||||||
#define APIC_DF_CLUSTER 0x0FFFFFFF
|
#define APIC_DF_CLUSTER 0x0FFFFFFF
|
||||||
|
|
||||||
/* APIC delivery modes */
|
|
||||||
#define APIC_DM_FIXED 0x00000000
|
|
||||||
#define APIC_DM_LOWPRIO 0x00000100
|
|
||||||
#define APIC_DM_SMI 0x00000200
|
|
||||||
#define APIC_DM_REMOTE 0x00000300
|
|
||||||
#define APIC_DM_NMI 0x00000400
|
|
||||||
#define APIC_DM_INIT 0x00000500
|
|
||||||
#define APIC_DM_STARTUP 0x00000600
|
|
||||||
#define APIC_DM_EXTINT 0x00000700
|
|
||||||
|
|
||||||
/* APIC trigger modes */
|
/* APIC trigger modes */
|
||||||
#define APIC_TGM_EDGE 0
|
#define APIC_TGM_EDGE 0
|
||||||
#define APIC_TGM_LEVEL 1
|
#define APIC_TGM_LEVEL 1
|
||||||
@@ -86,6 +76,35 @@
|
|||||||
/* Initial stall factor */
|
/* Initial stall factor */
|
||||||
#define INITIAL_STALL_FACTOR 100
|
#define INITIAL_STALL_FACTOR 100
|
||||||
|
|
||||||
|
/* APIC delivery mode enumeration list */
|
||||||
|
typedef enum _APIC_DM
|
||||||
|
{
|
||||||
|
APIC_DM_FIXED,
|
||||||
|
APIC_DM_LOWPRIO,
|
||||||
|
APIC_DM_SMI,
|
||||||
|
APIC_DM_REMOTE,
|
||||||
|
APIC_DM_NMI,
|
||||||
|
APIC_DM_INIT,
|
||||||
|
APIC_DM_STARTUP,
|
||||||
|
APIC_DM_EXTINT,
|
||||||
|
} APIC_DM, *PAPIC_DM;
|
||||||
|
|
||||||
|
/* APIC destination short-hand enumeration list */
|
||||||
|
typedef enum _APIC_DSH
|
||||||
|
{
|
||||||
|
APIC_DSH_Destination,
|
||||||
|
APIC_DSH_Self,
|
||||||
|
APIC_DSH_AllIncludingSelf,
|
||||||
|
APIC_DSH_AllExclusingSelf
|
||||||
|
} APIC_DSH, *PAPIC_DSH;
|
||||||
|
|
||||||
|
/* APIC mode list */
|
||||||
|
typedef enum _APIC_MODE
|
||||||
|
{
|
||||||
|
APIC_MODE_COMPAT,
|
||||||
|
APIC_MODE_X2APIC
|
||||||
|
} APIC_MODE, *PAPIC_MODE;
|
||||||
|
|
||||||
/* APIC Register Address Map */
|
/* APIC Register Address Map */
|
||||||
typedef enum _APIC_REGISTER
|
typedef enum _APIC_REGISTER
|
||||||
{
|
{
|
||||||
@@ -123,35 +142,6 @@ typedef enum _APIC_REGISTER
|
|||||||
APIC_EXT3LVTR = 0x53 /* Extended Interrupt 3 Local Vector Table */
|
APIC_EXT3LVTR = 0x53 /* Extended Interrupt 3 Local Vector Table */
|
||||||
} APIC_REGISTER, *PAPIC_REGISTER;
|
} APIC_REGISTER, *PAPIC_REGISTER;
|
||||||
|
|
||||||
/* APIC mode list */
|
|
||||||
typedef enum _APIC_MODE
|
|
||||||
{
|
|
||||||
APIC_MODE_COMPAT,
|
|
||||||
APIC_MODE_X2APIC
|
|
||||||
} APIC_MODE, *PAPIC_MODE;
|
|
||||||
|
|
||||||
/* APIC destination short-hand enumeration list */
|
|
||||||
typedef enum _APIC_DSH
|
|
||||||
{
|
|
||||||
APIC_DSH_Destination,
|
|
||||||
APIC_DSH_Self,
|
|
||||||
APIC_DSH_AllIncludingSelf,
|
|
||||||
APIC_DSH_AllExclusingSelf
|
|
||||||
} APIC_DSH, *PAPIC_DSH;
|
|
||||||
|
|
||||||
/* APIC message type enumeration list */
|
|
||||||
typedef enum _APIC_MT
|
|
||||||
{
|
|
||||||
APIC_MT_Fixed,
|
|
||||||
APIC_MT_LowestPriority,
|
|
||||||
APIC_MT_SMI,
|
|
||||||
APIC_MT_RemoteRead,
|
|
||||||
APIC_MT_NMI,
|
|
||||||
APIC_MT_INIT,
|
|
||||||
APIC_MT_Startup,
|
|
||||||
APIC_MT_ExtInt,
|
|
||||||
} APIC_MT, *PAPIC_MT;
|
|
||||||
|
|
||||||
/* I8259 PIC interrupt mode enumeration list */
|
/* I8259 PIC interrupt mode enumeration list */
|
||||||
typedef enum _PIC_I8259_ICW1_INTERRUPT_MODE
|
typedef enum _PIC_I8259_ICW1_INTERRUPT_MODE
|
||||||
{
|
{
|
||||||
@@ -224,7 +214,7 @@ typedef union _APIC_COMMAND_REGISTER
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ULONGLONG Vector:8;
|
ULONGLONG Vector:8;
|
||||||
ULONGLONG MessageType:3;
|
ULONGLONG DeliveryMode:3;
|
||||||
ULONGLONG DestinationMode:1;
|
ULONGLONG DestinationMode:1;
|
||||||
ULONGLONG DeliveryStatus:1;
|
ULONGLONG DeliveryStatus:1;
|
||||||
ULONGLONG ReservedMBZ:1;
|
ULONGLONG ReservedMBZ:1;
|
||||||
@@ -244,7 +234,7 @@ typedef union _APIC_LVT_REGISTER
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ULONG Vector:8;
|
ULONG Vector:8;
|
||||||
ULONG MessageType:3;
|
ULONG DeliveryMode:3;
|
||||||
ULONG Reserved1:1;
|
ULONG Reserved1:1;
|
||||||
ULONG DeliveryStatus:1;
|
ULONG DeliveryStatus:1;
|
||||||
ULONG Reserved2:1;
|
ULONG Reserved2:1;
|
||||||
|
@@ -144,8 +144,8 @@
|
|||||||
#define KERNEL_STACK_GUARD_PAGES 1
|
#define KERNEL_STACK_GUARD_PAGES 1
|
||||||
|
|
||||||
/* Processor structures size */
|
/* Processor structures size */
|
||||||
#define KPROCESSOR_STRUCTURES_SIZE ((2 * KERNEL_STACK_SIZE) + sizeof(ArInitialGdt) + sizeof(ArInitialTss) + \
|
#define KPROCESSOR_STRUCTURES_SIZE ((2 * KERNEL_STACK_SIZE) + (GDT_ENTRIES * sizeof(KGDTENTRY)) + sizeof(KTSS) + \
|
||||||
sizeof(ArInitialProcessorBlock) + MM_PAGE_SIZE)
|
sizeof(KPROCESSOR_BLOCK) + MM_PAGE_SIZE)
|
||||||
|
|
||||||
/* Kernel frames */
|
/* Kernel frames */
|
||||||
#define KTRAP_FRAME_ALIGN 0x08
|
#define KTRAP_FRAME_ALIGN 0x08
|
||||||
|
@@ -28,7 +28,11 @@
|
|||||||
#define MM_PDI_SHIFT 21
|
#define MM_PDI_SHIFT 21
|
||||||
#define MM_PPI_SHIFT 30
|
#define MM_PPI_SHIFT 30
|
||||||
|
|
||||||
|
/* Page directory and page base legacy address */
|
||||||
|
#define MM_PDE_LEGACY_BASE 0xC0300000
|
||||||
|
|
||||||
/* PTE legacy shift values */
|
/* PTE legacy shift values */
|
||||||
|
#define MM_PTE_LEGACY_SHIFT 2
|
||||||
#define MM_PDI_LEGACY_SHIFT 22
|
#define MM_PDI_LEGACY_SHIFT 22
|
||||||
|
|
||||||
/* Minimum number of physical pages needed by the system */
|
/* Minimum number of physical pages needed by the system */
|
||||||
@@ -49,6 +53,8 @@
|
|||||||
/* Maximum physical address used by HAL allocations */
|
/* Maximum physical address used by HAL allocations */
|
||||||
#define MM_MAXIMUM_PHYSICAL_ADDRESS 0xFFFFFFFF
|
#define MM_MAXIMUM_PHYSICAL_ADDRESS 0xFFFFFFFF
|
||||||
|
|
||||||
|
/* Trampoline code address */
|
||||||
|
#define MM_TRAMPOLINE_ADDRESS 0x80000
|
||||||
|
|
||||||
/* Page size enumeration list */
|
/* Page size enumeration list */
|
||||||
typedef enum _PAGE_SIZE
|
typedef enum _PAGE_SIZE
|
||||||
@@ -58,8 +64,26 @@ typedef enum _PAGE_SIZE
|
|||||||
Size4M
|
Size4M
|
||||||
} PAGE_SIZE, *PPAGE_SIZE;
|
} PAGE_SIZE, *PPAGE_SIZE;
|
||||||
|
|
||||||
/* Page Table entry structure definition (with PAE support) */
|
/* Legacy Page Table entry structure definition (PML2) */
|
||||||
typedef struct _HARDWARE_PTE
|
typedef struct _HARDWARE_LEGACY_PTE
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG Writable:1;
|
||||||
|
ULONG Owner:1;
|
||||||
|
ULONG WriteThrough:1;
|
||||||
|
ULONG CacheDisable:1;
|
||||||
|
ULONG Accessed:1;
|
||||||
|
ULONG Dirty:1;
|
||||||
|
ULONG LargePage:1;
|
||||||
|
ULONG Global:1;
|
||||||
|
ULONG CopyOnWrite:1;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG Reserved0:1;
|
||||||
|
ULONG PageFrameNumber:20;
|
||||||
|
} HARDWARE_LEGACY_PTE, *PHARDWARE_LEGACY_PTE;
|
||||||
|
|
||||||
|
/* Page Table entry structure definition (PML3) */
|
||||||
|
typedef struct _HARDWARE_MODERN_PTE
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Writable:1;
|
ULONGLONG Writable:1;
|
||||||
@@ -77,10 +101,117 @@ typedef struct _HARDWARE_PTE
|
|||||||
ULONGLONG Reserved1:14;
|
ULONGLONG Reserved1:14;
|
||||||
ULONGLONG SoftwareWsIndex:11;
|
ULONGLONG SoftwareWsIndex:11;
|
||||||
ULONGLONG NoExecute:1;
|
ULONGLONG NoExecute:1;
|
||||||
|
} HARDWARE_MODERN_PTE, *PHARDWARE_MODERN_PTE;
|
||||||
|
|
||||||
|
/* Generic Page Table entry union to abstract PML2 and PML3 formats */
|
||||||
|
typedef union _HARDWARE_PTE
|
||||||
|
{
|
||||||
|
ULONGLONG Long;
|
||||||
|
HARDWARE_LEGACY_PTE Pml2;
|
||||||
|
HARDWARE_MODERN_PTE Pml3;
|
||||||
} HARDWARE_PTE, *PHARDWARE_PTE;
|
} HARDWARE_PTE, *PHARDWARE_PTE;
|
||||||
|
|
||||||
/* Page Table Entry on PAE enabled system */
|
/* Page map information structure definition */
|
||||||
typedef struct _MMPTE_HARDWARE
|
typedef struct _MMPAGEMAP_INFO
|
||||||
|
{
|
||||||
|
BOOLEAN Xpa;
|
||||||
|
ULONG PteBase;
|
||||||
|
ULONG PdeBase;
|
||||||
|
ULONG PdiShift;
|
||||||
|
ULONG PteShift;
|
||||||
|
} MMPAGEMAP_INFO, *PMMPAGEMAP_INFO;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry hardware structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_HARDWARE
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG Writable:1;
|
||||||
|
ULONG Owner:1;
|
||||||
|
ULONG WriteThrough:1;
|
||||||
|
ULONG CacheDisable:1;
|
||||||
|
ULONG Accessed:1;
|
||||||
|
ULONG Dirty:1;
|
||||||
|
ULONG LargePage:1;
|
||||||
|
ULONG Global:1;
|
||||||
|
ULONG CopyOnWrite:1;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG Write:1;
|
||||||
|
ULONG PageFrameNumber:20;
|
||||||
|
} MMPML2_PTE_HARDWARE, *PMMPML2_PTE_HARDWARE;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry list structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_LIST
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG OneEntry:1;
|
||||||
|
ULONG Reserved0:8;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG Reserved1:1;
|
||||||
|
ULONG NextEntry:20;
|
||||||
|
} MMPML2_PTE_LIST, *PMMPML2_PTE_LIST;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry subsection structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_PROTOTYPE
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG ProtoAddressLow:7;
|
||||||
|
ULONG ReadOnly:1;
|
||||||
|
ULONG WhichPool:1;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG ProtoAddressHigh:21;
|
||||||
|
} MMPML2_PTE_PROTOTYPE, *PMMPML2_PTE_PROTOTYPE;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry software structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_SOFTWARE
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG PageFileLow:4;
|
||||||
|
ULONG Protection:5;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG Transition:1;
|
||||||
|
ULONG PageFileHigh:20;
|
||||||
|
} MMPML2_PTE_SOFTWARE, *PMMPML2_PTE_SOFTWARE;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry subsection structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_SUBSECTION
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG SubsectionAddressLow:4;
|
||||||
|
ULONG Protection:5;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG SubsectionAddressHigh:20;
|
||||||
|
ULONG WhichPool:1;
|
||||||
|
} MMPML2_PTE_SUBSECTION, *PMMPML2_PTE_SUBSECTION;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry transition structure definition (PML2) */
|
||||||
|
typedef struct _MMPML2_PTE_TRANSITION
|
||||||
|
{
|
||||||
|
ULONG Valid:1;
|
||||||
|
ULONG Write:1;
|
||||||
|
ULONG Owner:1;
|
||||||
|
ULONG WriteThrough:1;
|
||||||
|
ULONG CacheDisable:1;
|
||||||
|
ULONG Protection:5;
|
||||||
|
ULONG Prototype:1;
|
||||||
|
ULONG Transition:1;
|
||||||
|
ULONG PageFrameNumber:20;
|
||||||
|
} MMPML2_PTE_TRANSITION, *PMMPML2_PTE_TRANSITION;
|
||||||
|
|
||||||
|
/* Legacy Page Table Entry union definition (PML2) */
|
||||||
|
typedef union _MMPML2_PTE
|
||||||
|
{
|
||||||
|
ULONG Long;
|
||||||
|
HARDWARE_PTE Flush;
|
||||||
|
MMPML2_PTE_HARDWARE Hard;
|
||||||
|
MMPML2_PTE_PROTOTYPE Proto;
|
||||||
|
MMPML2_PTE_SOFTWARE Soft;
|
||||||
|
MMPML2_PTE_TRANSITION Trans;
|
||||||
|
MMPML2_PTE_SUBSECTION Subsect;
|
||||||
|
MMPML2_PTE_LIST List;
|
||||||
|
} MMPML2_PTE, *PMMPML2_PTE;
|
||||||
|
|
||||||
|
/* Page Table Entry hardware structure definition (PML3) */
|
||||||
|
typedef struct _MMPML3_PTE_HARDWARE
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Writable:1;
|
ULONGLONG Writable:1;
|
||||||
@@ -95,59 +226,59 @@ typedef struct _MMPTE_HARDWARE
|
|||||||
ULONGLONG Prototype:1;
|
ULONGLONG Prototype:1;
|
||||||
ULONGLONG Write:1;
|
ULONGLONG Write:1;
|
||||||
ULONGLONG PageFrameNumber:26;
|
ULONGLONG PageFrameNumber:26;
|
||||||
ULONGLONG Reserved1:25;
|
ULONGLONG Reserved0:25;
|
||||||
ULONGLONG NoExecute:1;
|
ULONGLONG NoExecute:1;
|
||||||
} MMPTE_HARDWARE, *PMMPTE_HARDWARE;
|
} MMPML3_PTE_HARDWARE, *PMMPML3_PTE_HARDWARE;
|
||||||
|
|
||||||
/* Page Table Entry list structure definition (with PAE support) */
|
/* Page Table Entry list structure definition (PML3) */
|
||||||
typedef struct _MMPTE_LIST
|
typedef struct _MMPML3_PTE_LIST
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG OneEntry:1;
|
ULONGLONG OneEntry:1;
|
||||||
ULONGLONG Reserved1:8;
|
ULONGLONG Reserved0:8;
|
||||||
ULONGLONG Prototype:1;
|
ULONGLONG Prototype:1;
|
||||||
ULONGLONG Reserved2:21;
|
ULONGLONG Reserved1:21;
|
||||||
ULONGLONG NextEntry:32;
|
ULONGLONG NextEntry:32;
|
||||||
} MMPTE_LIST, *PMMPTE_LIST;
|
} MMPML3_PTE_LIST, *PMMPML3_PTE_LIST;
|
||||||
|
|
||||||
/* Page Table Entry subsection structure definition (with PAE support) */
|
/* Page Table Entry subsection structure definition (PML3) */
|
||||||
typedef struct _MMPTE_PROTOTYPE
|
typedef struct _MMPML3_PTE_PROTOTYPE
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Reserved1:7;
|
ULONGLONG Reserved0:7;
|
||||||
ULONGLONG ReadOnly:1;
|
ULONGLONG ReadOnly:1;
|
||||||
ULONGLONG Reserved2:1;
|
ULONGLONG Reserved1:1;
|
||||||
ULONGLONG Prototype:1;
|
ULONGLONG Prototype:1;
|
||||||
ULONGLONG Protection:5;
|
ULONGLONG Protection:5;
|
||||||
ULONGLONG Reserved3:16;
|
ULONGLONG Reserved2:16;
|
||||||
ULONGLONG ProtoAddress:32;
|
ULONGLONG ProtoAddress:32;
|
||||||
} MMPTE_PROTOTYPE, *PMMPTE_PROTOTYPE;
|
} MMPML3_PTE_PROTOTYPE, *PMMPML3_PTE_PROTOTYPE;
|
||||||
|
|
||||||
/* Page Table Entry software structure definition (with PAE support) */
|
/* Page Table Entry software structure definition (PML3) */
|
||||||
typedef struct _MMPTE_SOFTWARE
|
typedef struct _MMPML3_PTE_SOFTWARE
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG PageFileLow:4;
|
ULONGLONG PageFileLow:4;
|
||||||
ULONGLONG Protection:5;
|
ULONGLONG Protection:5;
|
||||||
ULONGLONG Prototype:1;
|
ULONGLONG Prototype:1;
|
||||||
ULONGLONG Transition:1;
|
ULONGLONG Transition:1;
|
||||||
ULONGLONG Reserved1:20;
|
ULONGLONG Reserved0:20;
|
||||||
ULONGLONG PageFileHigh:32;
|
ULONGLONG PageFileHigh:32;
|
||||||
} MMPTE_SOFTWARE, *PMMPTE_SOFTWARE;
|
} MMPML3_PTE_SOFTWARE, *PMMPML3_PTE_SOFTWARE;
|
||||||
|
|
||||||
/* Page Table Entry subsection structure definition (with PAE support) */
|
/* Page Table Entry subsection structure definition (PML3) */
|
||||||
typedef struct _MMPTE_SUBSECTION
|
typedef struct _MMPML3_PTE_SUBSECTION
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Reserved1:4;
|
ULONGLONG Reserved0:4;
|
||||||
ULONGLONG Protection:5;
|
ULONGLONG Protection:5;
|
||||||
ULONGLONG Prototype:1;
|
ULONGLONG Prototype:1;
|
||||||
ULONGLONG Reserved2:21;
|
ULONGLONG Reserved1:21;
|
||||||
ULONGLONG SubsectionAddress:32;
|
ULONGLONG SubsectionAddress:32;
|
||||||
} MMPTE_SUBSECTION, *PMMPTE_SUBSECTION;
|
} MMPML3_PTE_SUBSECTION, *PMMPML3_PTE_SUBSECTION;
|
||||||
|
|
||||||
/* Page Table Entry transition structure definition (with PAE support) */
|
/* Page Table Entry transition structure definition (PML3) */
|
||||||
typedef struct _MMPTE_TRANSITION
|
typedef struct _MMPML3_PTE_TRANSITION
|
||||||
{
|
{
|
||||||
ULONGLONG Valid:1;
|
ULONGLONG Valid:1;
|
||||||
ULONGLONG Write:1;
|
ULONGLONG Write:1;
|
||||||
@@ -159,38 +290,28 @@ typedef struct _MMPTE_TRANSITION
|
|||||||
ULONGLONG Transition:1;
|
ULONGLONG Transition:1;
|
||||||
ULONGLONG PageFrameNumber:26;
|
ULONGLONG PageFrameNumber:26;
|
||||||
ULONGLONG Unused:26;
|
ULONGLONG Unused:26;
|
||||||
} MMPTE_TRANSITION, *PMMPTE_TRANSITION;
|
} MMPML3_PTE_TRANSITION, *PMMPML3_PTE_TRANSITION;
|
||||||
|
|
||||||
/* Page Table Entry structure definition (with PAE support) */
|
/* Page Table Entry union definition (PML3) */
|
||||||
typedef union _MMPTE
|
typedef union _MMPML3_PTE
|
||||||
{
|
{
|
||||||
ULONGLONG Long;
|
ULONGLONG Long;
|
||||||
HARDWARE_PTE Flush;
|
HARDWARE_PTE Flush;
|
||||||
MMPTE_HARDWARE Hardware;
|
MMPML3_PTE_HARDWARE Hardware;
|
||||||
MMPTE_PROTOTYPE Prototype;
|
MMPML3_PTE_PROTOTYPE Prototype;
|
||||||
MMPTE_SOFTWARE Software;
|
MMPML3_PTE_SOFTWARE Software;
|
||||||
MMPTE_TRANSITION Transition;
|
MMPML3_PTE_TRANSITION Transition;
|
||||||
MMPTE_SUBSECTION Subsection;
|
MMPML3_PTE_SUBSECTION Subsection;
|
||||||
MMPTE_LIST List;
|
MMPML3_PTE_LIST List;
|
||||||
} MMPTE, *PMMPTE;
|
} MMPML3_PTE, *PMMPML3_PTE;
|
||||||
|
|
||||||
/* Legacy Page Table entry structure definition (without PAE support) */
|
/* Generic Page Table Entry union to abstract PML2 and PML3 formats */
|
||||||
typedef struct _HARDWARE_LEGACY_PTE
|
typedef union _MMPTE
|
||||||
{
|
{
|
||||||
ULONG Valid:1;
|
ULONGLONG Long;
|
||||||
ULONG Writable:1;
|
MMPML2_PTE Pml2;
|
||||||
ULONG Owner:1;
|
MMPML3_PTE Pml3;
|
||||||
ULONG WriteThrough:1;
|
} MMPTE, *PMMPTE;
|
||||||
ULONG CacheDisable:1;
|
|
||||||
ULONG Accessed:1;
|
|
||||||
ULONG Dirty:1;
|
|
||||||
ULONG LargePage:1;
|
|
||||||
ULONG Global:1;
|
|
||||||
ULONG CopyOnWrite:1;
|
|
||||||
ULONG Prototype:1;
|
|
||||||
ULONG Reserved0:1;
|
|
||||||
ULONG PageFrameNumber:20;
|
|
||||||
} HARDWARE_LEGACY_PTE, *PHARDWARE_LEGACY_PTE;
|
|
||||||
|
|
||||||
/* Page Frame Number structure definition */
|
/* Page Frame Number structure definition */
|
||||||
typedef struct _MMPFN
|
typedef struct _MMPFN
|
||||||
|
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Architecture-specific enumeration lists forward references */
|
/* Architecture-specific enumeration lists forward references */
|
||||||
|
typedef enum _APIC_DM APIC_DM, *PAPIC_DM;
|
||||||
typedef enum _APIC_DSH APIC_DSH, *PAPIC_DSH;
|
typedef enum _APIC_DSH APIC_DSH, *PAPIC_DSH;
|
||||||
typedef enum _APIC_MODE APIC_MODE, *PAPIC_MODE;
|
typedef enum _APIC_MODE APIC_MODE, *PAPIC_MODE;
|
||||||
typedef enum _APIC_MT APIC_MT, *PAPIC_MT;
|
|
||||||
typedef enum _APIC_REGISTER APIC_REGISTER, *PAPIC_REGISTER;
|
typedef enum _APIC_REGISTER APIC_REGISTER, *PAPIC_REGISTER;
|
||||||
typedef enum _CPU_VENDOR CPU_VENDOR, *PCPU_VENDOR;
|
typedef enum _CPU_VENDOR CPU_VENDOR, *PCPU_VENDOR;
|
||||||
typedef enum _CPUID_FEATURES_EXTENDED CPUID_FEATURES_EXTENDED, *PCPUID_FEATURES_EXTENDED;
|
typedef enum _CPUID_FEATURES_EXTENDED CPUID_FEATURES_EXTENDED, *PCPUID_FEATURES_EXTENDED;
|
||||||
@@ -30,6 +30,7 @@ typedef enum _PIC_I8259_ICW1_OPERATING_MODE PIC_I8259_ICW1_OPERATING_MODE, *PPIC
|
|||||||
typedef enum _PIC_I8259_ICW4_BUFFERED_MODE PIC_I8259_ICW4_BUFFERED_MODE, *PPIC_I8259_ICW4_BUFFERED_MODE;
|
typedef enum _PIC_I8259_ICW4_BUFFERED_MODE PIC_I8259_ICW4_BUFFERED_MODE, *PPIC_I8259_ICW4_BUFFERED_MODE;
|
||||||
typedef enum _PIC_I8259_ICW4_EOI_MODE PIC_I8259_ICW4_EOI_MODE, *PPIC_I8259_ICW4_EOI_MODE;
|
typedef enum _PIC_I8259_ICW4_EOI_MODE PIC_I8259_ICW4_EOI_MODE, *PPIC_I8259_ICW4_EOI_MODE;
|
||||||
typedef enum _PIC_I8259_ICW4_SYSTEM_MODE PIC_I8259_ICW4_SYSTEM_MODE, *PPIC_I8259_ICW4_SYSTEM_MODE;
|
typedef enum _PIC_I8259_ICW4_SYSTEM_MODE PIC_I8259_ICW4_SYSTEM_MODE, *PPIC_I8259_ICW4_SYSTEM_MODE;
|
||||||
|
typedef enum _TRAMPOLINE_TYPE TRAMPOLINE_TYPE, *PTRAMPOLINE_TYPE;
|
||||||
|
|
||||||
/* Architecture-specific structures forward references */
|
/* Architecture-specific structures forward references */
|
||||||
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
|
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
|
||||||
@@ -40,7 +41,7 @@ typedef struct _FN_SAVE_FORMAT FN_SAVE_FORMAT, *PFN_SAVE_FORMAT;
|
|||||||
typedef struct _FX_SAVE_AREA FX_SAVE_AREA, *PFX_SAVE_AREA;
|
typedef struct _FX_SAVE_AREA FX_SAVE_AREA, *PFX_SAVE_AREA;
|
||||||
typedef struct _FX_SAVE_FORMAT FX_SAVE_FORMAT, *PFX_SAVE_FORMAT;
|
typedef struct _FX_SAVE_FORMAT FX_SAVE_FORMAT, *PFX_SAVE_FORMAT;
|
||||||
typedef struct _HARDWARE_LEGACY_PTE HARDWARE_LEGACY_PTE, *PHARDWARE_LEGACY_PTE;
|
typedef struct _HARDWARE_LEGACY_PTE HARDWARE_LEGACY_PTE, *PHARDWARE_LEGACY_PTE;
|
||||||
typedef struct _HARDWARE_PTE HARDWARE_PTE, *PHARDWARE_PTE;
|
typedef struct _HARDWARE_MODERN_PTE HARDWARE_MODERN_PTE, *PHARDWARE_MODERN_PTE;
|
||||||
typedef struct _KDESCRIPTOR KDESCRIPTOR, *PKDESCRIPTOR;
|
typedef struct _KDESCRIPTOR KDESCRIPTOR, *PKDESCRIPTOR;
|
||||||
typedef struct _KEXCEPTION_FRAME KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
|
typedef struct _KEXCEPTION_FRAME KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
|
||||||
typedef struct _KGDTENTRY KGDTENTRY, *PKGDTENTRY;
|
typedef struct _KGDTENTRY KGDTENTRY, *PKGDTENTRY;
|
||||||
@@ -55,13 +56,20 @@ typedef struct _KSWITCH_FRAME KSWITCH_FRAME, *PKSWITCH_FRAME;
|
|||||||
typedef struct _KTHREAD_INIT_FRAME KTHREAD_INIT_FRAME, *PKTHREAD_INIT_FRAME;
|
typedef struct _KTHREAD_INIT_FRAME KTHREAD_INIT_FRAME, *PKTHREAD_INIT_FRAME;
|
||||||
typedef struct _KTRAP_FRAME KTRAP_FRAME, *PKTRAP_FRAME;
|
typedef struct _KTRAP_FRAME KTRAP_FRAME, *PKTRAP_FRAME;
|
||||||
typedef struct _KTSS KTSS, *PKTSS;
|
typedef struct _KTSS KTSS, *PKTSS;
|
||||||
|
typedef struct _MMPAGEMAP_INFO MMPAGEMAP_INFO, *PMMPAGEMAP_INFO;
|
||||||
typedef struct _MMPFN MMPFN, *PMMPFN;
|
typedef struct _MMPFN MMPFN, *PMMPFN;
|
||||||
typedef struct _MMPTE_HARDWARE MMPTE_HARDWARE, *PMMPTE_HARDWARE;
|
typedef struct _MMPML2_PTE_HARDWARE MMPML2_PTE_HARDWARE, *PMMPML2_PTE_HARDWARE;
|
||||||
typedef struct _MMPTE_LIST MMPTE_LIST, *PMMPTE_LIST;
|
typedef struct _MMPML2_PTE_LIST MMPML2_PTE_LIST, *PMMPML2_PTE_LIST;
|
||||||
typedef struct _MMPTE_PROTOTYPE MMPTE_PROTOTYPE, *PMMPTE_PROTOTYPE;
|
typedef struct _MMPML2_PTE_PROTOTYPE MMPML2_PTE_PROTOTYPE, *PMMPML2_PTE_PROTOTYPE;
|
||||||
typedef struct _MMPTE_SOFTWARE MMPTE_SOFTWARE, *PMMPTE_SOFTWARE;
|
typedef struct _MMPML2_PTE_SOFTWARE MMPML2_PTE_SOFTWARE, *PMMPML2_PTE_SOFTWARE;
|
||||||
typedef struct _MMPTE_SUBSECTION MMPTE_SUBSECTION, *PMMPTE_SUBSECTION;
|
typedef struct _MMPML2_PTE_SUBSECTION MMPML2_PTE_SUBSECTION, *PMMPML2_PTE_SUBSECTION;
|
||||||
typedef struct _MMPTE_TRANSITION MMPTE_TRANSITION, *PMMPTE_TRANSITION;
|
typedef struct _MMPML2_PTE_TRANSITION MMPML2_PTE_TRANSITION, *PMMPML2_PTE_TRANSITION;
|
||||||
|
typedef struct _MMPML3_PTE_HARDWARE MMPML3_PTE_HARDWARE, *PMMPML3_PTE_HARDWARE;
|
||||||
|
typedef struct _MMPML3_PTE_LIST MMPML3_PTE_LIST, *PMMPML3_PTE_LIST;
|
||||||
|
typedef struct _MMPML3_PTE_PROTOTYPE MMPML3_PTE_PROTOTYPE, *PMMPML3_PTE_PROTOTYPE;
|
||||||
|
typedef struct _MMPML3_PTE_SOFTWARE MMPML3_PTE_SOFTWARE, *PMMPML3_PTE_SOFTWARE;
|
||||||
|
typedef struct _MMPML3_PTE_SUBSECTION MMPML3_PTE_SUBSECTION, *PMMPML3_PTE_SUBSECTION;
|
||||||
|
typedef struct _MMPML3_PTE_TRANSITION MMPML3_PTE_TRANSITION, *PMMPML3_PTE_TRANSITION;
|
||||||
typedef struct _THREAD_ENVIRONMENT_BLOCK THREAD_ENVIRONMENT_BLOCK, *PTHREAD_ENVIRONMENT_BLOCK;
|
typedef struct _THREAD_ENVIRONMENT_BLOCK THREAD_ENVIRONMENT_BLOCK, *PTHREAD_ENVIRONMENT_BLOCK;
|
||||||
|
|
||||||
/* Unions forward references */
|
/* Unions forward references */
|
||||||
@@ -69,12 +77,15 @@ typedef union _APIC_BASE_REGISTER APIC_BASE_REGISTER, *PAPIC_BASE_REGISTER;
|
|||||||
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER, *PAPIC_COMMAND_REGISTER;
|
typedef union _APIC_COMMAND_REGISTER APIC_COMMAND_REGISTER, *PAPIC_COMMAND_REGISTER;
|
||||||
typedef union _APIC_LVT_REGISTER APIC_LVT_REGISTER, *PAPIC_LVT_REGISTER;
|
typedef union _APIC_LVT_REGISTER APIC_LVT_REGISTER, *PAPIC_LVT_REGISTER;
|
||||||
typedef union _APIC_SPURIOUS_REGISTER APIC_SPURIOUS_REGISTER, *PAPIC_SPURIOUS_REGISTER;
|
typedef union _APIC_SPURIOUS_REGISTER APIC_SPURIOUS_REGISTER, *PAPIC_SPURIOUS_REGISTER;
|
||||||
|
typedef union _HARDWARE_PTE HARDWARE_PTE, *PHARDWARE_PTE;
|
||||||
|
typedef union _MMPML2_PTE MMPML2_PTE, *PMMPML2_PTE;
|
||||||
|
typedef union _MMPML3_PTE MMPML3_PTE, *PMMPML3_PTE;
|
||||||
typedef union _MMPTE MMPDE, *PMMPDE;
|
typedef union _MMPTE MMPDE, *PMMPDE;
|
||||||
|
typedef union _MMPTE MMPPE, *PMMPPE;
|
||||||
typedef union _MMPTE MMPTE, *PMMPTE;
|
typedef union _MMPTE MMPTE, *PMMPTE;
|
||||||
typedef union _PIC_I8259_ICW1 PIC_I8259_ICW1, *PPIC_I8259_ICW1;
|
typedef union _PIC_I8259_ICW1 PIC_I8259_ICW1, *PPIC_I8259_ICW1;
|
||||||
typedef union _PIC_I8259_ICW2 PIC_I8259_ICW2, *PPIC_I8259_ICW2;
|
typedef union _PIC_I8259_ICW2 PIC_I8259_ICW2, *PPIC_I8259_ICW2;
|
||||||
typedef union _PIC_I8259_ICW3 PIC_I8259_ICW3, *PPIC_I8259_ICW3;
|
typedef union _PIC_I8259_ICW3 PIC_I8259_ICW3, *PPIC_I8259_ICW3;
|
||||||
typedef union _PIC_I8259_ICW4 PIC_I8259_ICW4, *PPIC_I8259_ICW4;
|
typedef union _PIC_I8259_ICW4 PIC_I8259_ICW4, *PPIC_I8259_ICW4;
|
||||||
|
|
||||||
|
|
||||||
#endif /* __XTDK_I686_XTSTRUCT_H */
|
#endif /* __XTDK_I686_XTSTRUCT_H */
|
||||||
|
23
sdk/xtdk/kdfuncs.h
Normal file
23
sdk/xtdk/kdfuncs.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/kdfuncs.h
|
||||||
|
* DESCRIPTION: XTOS kernel debugger routine definitions
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_KDFUNCS_H
|
||||||
|
#define __XTDK_KDFUNCS_H
|
||||||
|
|
||||||
|
#include <xtdefs.h>
|
||||||
|
#include <xttypes.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Kernel debugger routines forward references */
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
DbgPrint(PCWSTR Format,
|
||||||
|
...);
|
||||||
|
|
||||||
|
#endif /* __XTDK_KDFUNCS_H */
|
45
sdk/xtdk/kdtypes.h
Normal file
45
sdk/xtdk/kdtypes.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/kdtypes.h
|
||||||
|
* DESCRIPTION: Kernel Debugger data structures
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_KDTYPES_H
|
||||||
|
#define __XTDK_KDTYPES_H
|
||||||
|
|
||||||
|
#include <xtbase.h>
|
||||||
|
#include <xtstruct.h>
|
||||||
|
#include <rtltypes.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Number of debug providers */
|
||||||
|
#define KDBG_PROVIDERS_COUNT 2
|
||||||
|
|
||||||
|
/* Debug providers bitmask definitions */
|
||||||
|
#define DEBUG_PROVIDER_COMPORT 0x00000001
|
||||||
|
#define DEBUG_PROVIDER_FRAMEBUFFER 0x00000002
|
||||||
|
|
||||||
|
/* Kernel routine callbacks */
|
||||||
|
typedef XTSTATUS (XTAPI *PKD_INIT_ROUTINE)();
|
||||||
|
typedef VOID (*PKD_PRINT_ROUTINE)(IN PCWSTR Format, IN ...);
|
||||||
|
|
||||||
|
/* Debug mode structure definition */
|
||||||
|
typedef struct _KD_DEBUG_MODE
|
||||||
|
{
|
||||||
|
BOOLEAN Enabled;
|
||||||
|
ULONG Mode;
|
||||||
|
ULONG ComPortAddress;
|
||||||
|
ULONG ComPortNumber;
|
||||||
|
ULONG ComPortBaudRate;
|
||||||
|
} KD_DEBUG_MODE, *PKD_DEBUG_MODE;
|
||||||
|
|
||||||
|
/* Kernel debugger dispatch table structure definition */
|
||||||
|
typedef struct _KD_DISPATCH_TABLE
|
||||||
|
{
|
||||||
|
LIST_ENTRY ListEntry;
|
||||||
|
RTL_PRINT_CONTEXT PrintContext;
|
||||||
|
} KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE;
|
||||||
|
|
||||||
|
#endif /* __XTDK_KDTYPES_H */
|
@@ -16,36 +16,44 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Kernel services routines forward references */
|
/* Kernel services routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
|
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KeAcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
KeAcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
KeAcquireSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
KeAcquireSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
||||||
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
|
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
KeCancelTimer(IN PKTIMER Timer);
|
KeCancelTimer(IN PKTIMER Timer);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
KRUNLEVEL
|
KRUNLEVEL
|
||||||
KeGetCurrentRunLevel(VOID);
|
KeGetCurrentRunLevel(VOID);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
KeGetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
KeGetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
||||||
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
|
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
KeGetTimerState(IN PKTIMER Timer);
|
KeGetTimerState(IN PKTIMER Timer);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeApc(IN PKAPC Apc,
|
KeInitializeApc(IN PKAPC Apc,
|
||||||
@@ -57,45 +65,54 @@ KeInitializeApc(IN PKAPC Apc,
|
|||||||
IN KPROCESSOR_MODE ApcMode,
|
IN KPROCESSOR_MODE ApcMode,
|
||||||
IN PVOID Context);
|
IN PVOID Context);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeDpc(IN PKDPC Dpc,
|
KeInitializeDpc(IN PKDPC Dpc,
|
||||||
IN PKDEFERRED_ROUTINE DpcRoutine,
|
IN PKDEFERRED_ROUTINE DpcRoutine,
|
||||||
IN PVOID DpcContext);
|
IN PVOID DpcContext);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
KeInitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
||||||
IN LONG Count,
|
IN LONG Count,
|
||||||
IN LONG Limit);
|
IN LONG Limit);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeSpinLock(IN PKSPIN_LOCK SpinLock);
|
KeInitializeSpinLock(IN PKSPIN_LOCK SpinLock);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeThreadedDpc(IN PKDPC Dpc,
|
KeInitializeThreadedDpc(IN PKDPC Dpc,
|
||||||
IN PKDEFERRED_ROUTINE DpcRoutine,
|
IN PKDEFERRED_ROUTINE DpcRoutine,
|
||||||
IN PVOID DpcContext);
|
IN PVOID DpcContext);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeTimer(OUT PKTIMER Timer,
|
KeInitializeTimer(OUT PKTIMER Timer,
|
||||||
IN KTIMER_TYPE Type);
|
IN KTIMER_TYPE Type);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KeLowerRunLevel(IN KRUNLEVEL RunLevel);
|
KeLowerRunLevel(IN KRUNLEVEL RunLevel);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
KRUNLEVEL
|
KRUNLEVEL
|
||||||
KeRaiseRunLevel(IN KRUNLEVEL RunLevel);
|
KeRaiseRunLevel(IN KRUNLEVEL RunLevel);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LONG
|
LONG
|
||||||
KeReadSemaphoreState(IN PKSEMAPHORE Semaphore);
|
KeReadSemaphoreState(IN PKSEMAPHORE Semaphore);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LONG
|
LONG
|
||||||
KeReleaseSemaphore(IN PKSEMAPHORE Semaphore,
|
KeReleaseSemaphore(IN PKSEMAPHORE Semaphore,
|
||||||
@@ -103,23 +120,28 @@ KeReleaseSemaphore(IN PKSEMAPHORE Semaphore,
|
|||||||
IN LONG Adjustment,
|
IN LONG Adjustment,
|
||||||
IN BOOLEAN Wait);
|
IN BOOLEAN Wait);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
|
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KeReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
KeReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeReleaseSystemResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader);
|
KeReleaseSystemResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeSetTargetProcessorDpc(IN PKDPC Dpc,
|
KeSetTargetProcessorDpc(IN PKDPC Dpc,
|
||||||
IN CCHAR Number);
|
IN CCHAR Number);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeSetTimer(IN PKTIMER Timer,
|
KeSetTimer(IN PKTIMER Timer,
|
||||||
@@ -127,10 +149,12 @@ KeSetTimer(IN PKTIMER Timer,
|
|||||||
IN LONG Period,
|
IN LONG Period,
|
||||||
IN PKDPC Dpc);
|
IN PKDPC Dpc);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeSignalCallDpcDone(IN PVOID SystemArgument);
|
KeSignalCallDpcDone(IN PVOID SystemArgument);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
KeSignalCallDpcSynchronize(IN PVOID SystemArgument);
|
KeSignalCallDpcSynchronize(IN PVOID SystemArgument);
|
||||||
|
@@ -10,8 +10,18 @@
|
|||||||
#define __XTDK_MMTYPES_H
|
#define __XTDK_MMTYPES_H
|
||||||
|
|
||||||
#include <xtbase.h>
|
#include <xtbase.h>
|
||||||
|
#include ARCH_HEADER(xtstruct.h)
|
||||||
|
|
||||||
|
|
||||||
|
/* Page map routines structure definition */
|
||||||
|
typedef CONST STRUCT _CMMPAGEMAP_ROUTINES
|
||||||
|
{
|
||||||
|
VOID (XTAPI *ClearPte)(PHARDWARE_PTE PtePointer);
|
||||||
|
BOOLEAN (XTAPI *PteValid)(PHARDWARE_PTE PtePointer);
|
||||||
|
VOID (XTAPI *SetPteCaching)(PHARDWARE_PTE PtePointer, BOOLEAN CacheDisable, BOOLEAN WriteThrough);
|
||||||
|
VOID (XTAPI *SetPte)(PHARDWARE_PTE PtePointer, PFN_NUMBER PageFrameNumber, BOOLEAN Writable);
|
||||||
|
} CMMPAGEMAP_ROUTINES, *PCMMPAGEMAP_ROUTINES;
|
||||||
|
|
||||||
/* Color tables structure definition */
|
/* Color tables structure definition */
|
||||||
typedef struct _MMCOLOR_TABLES
|
typedef struct _MMCOLOR_TABLES
|
||||||
{
|
{
|
||||||
|
@@ -15,290 +15,356 @@
|
|||||||
#include <rtltypes.h>
|
#include <rtltypes.h>
|
||||||
|
|
||||||
|
|
||||||
/* Routines used by XTLDR */
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
RtlInitializeListHead(IN PLIST_ENTRY ListHead);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
RtlInsertHeadList(IN OUT PLIST_ENTRY ListHead,
|
|
||||||
IN PLIST_ENTRY Entry);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
RtlInsertTailList(IN OUT PLIST_ENTRY ListHead,
|
|
||||||
IN PLIST_ENTRY Entry);
|
|
||||||
|
|
||||||
XTAPI
|
|
||||||
UCHAR
|
|
||||||
RtlReadRegisterByte(IN VOLATILE PVOID Register);
|
|
||||||
|
|
||||||
XTAPI
|
|
||||||
ULONG
|
|
||||||
RtlReadRegisterLong(IN VOLATILE PVOID Register);
|
|
||||||
|
|
||||||
XTAPI
|
|
||||||
USHORT
|
|
||||||
RtlReadRegisterShort(IN VOLATILE PVOID Register);
|
|
||||||
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
RtlRemoveEntryList(IN PLIST_ENTRY Entry);
|
|
||||||
|
|
||||||
|
|
||||||
/* Runtime Library routines forward references */
|
/* Runtime Library routines forward references */
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlClearAllBits(IN PRTL_BITMAP BitMap);
|
RtlClearAllBits(IN PRTL_BITMAP BitMap);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlClearBit(IN PRTL_BITMAP BitMap,
|
RtlClearBit(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Bit);
|
IN ULONG_PTR Bit);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlClearBits(IN PRTL_BITMAP BitMap,
|
RtlClearBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR StartingIndex,
|
IN ULONG_PTR StartingIndex,
|
||||||
IN ULONG_PTR Length);
|
IN ULONG_PTR Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG
|
ULONG
|
||||||
RtlClearSetBits(IN PRTL_BITMAP BitMap,
|
RtlClearSetBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Length,
|
IN ULONG_PTR Length,
|
||||||
IN ULONG_PTR Index);
|
IN ULONG_PTR Index);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
RtlCompareGuids(IN PGUID Guid1,
|
RtlCompareGuids(IN PGUID Guid1,
|
||||||
IN PGUID Guid2);
|
IN PGUID Guid2);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlCompareMemory(IN PCVOID LeftBuffer,
|
RtlCompareMemory(IN PCVOID LeftBuffer,
|
||||||
IN PCVOID RightBuffer,
|
IN PCVOID RightBuffer,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlCompareString(IN CONST PCHAR String1,
|
RtlCompareString(IN PCSTR String1,
|
||||||
IN CONST PCHAR String2,
|
IN PCSTR String2,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlCompareStringInsensitive(IN CONST PCHAR String1,
|
RtlCompareStringInsensitive(IN PCSTR String1,
|
||||||
IN CONST PCHAR String2,
|
IN PCSTR String2,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlCompareWideString(IN CONST PWCHAR String1,
|
RtlCompareWideString(IN PCWSTR String1,
|
||||||
IN CONST PWCHAR String2,
|
IN PCWSTR String2,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlCompareWideStringInsensitive(IN CONST PWCHAR String1,
|
RtlCompareWideStringInsensitive(IN PCWSTR String1,
|
||||||
IN CONST PWCHAR String2,
|
IN PCWSTR String2,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PCHAR
|
PCHAR
|
||||||
RtlConcatenateString(OUT PCHAR Destination,
|
RtlConcatenateString(OUT PCHAR Destination,
|
||||||
IN PCHAR Source,
|
IN PCHAR Source,
|
||||||
IN SIZE_T Count);
|
IN SIZE_T Count);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PWCHAR
|
PWCHAR
|
||||||
RtlConcatenateWideString(OUT PWCHAR Destination,
|
RtlConcatenateWideString(OUT PWCHAR Destination,
|
||||||
IN PWCHAR Source,
|
IN PWCHAR Source,
|
||||||
IN SIZE_T Count);
|
IN SIZE_T Count);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LARGE_INTEGER
|
LARGE_INTEGER
|
||||||
RtlConvertToLargeInteger32(IN LONG Value);
|
RtlConvertToLargeInteger32(IN LONG Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LARGE_INTEGER
|
LARGE_INTEGER
|
||||||
RtlConvertToLargeIntegerUnsigned32(IN ULONG Value);
|
RtlConvertToLargeIntegerUnsigned32(IN ULONG Value);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlCopyMemory(OUT PVOID Destination,
|
RtlCopyMemory(OUT PVOID Destination,
|
||||||
IN PCVOID Source,
|
IN PCVOID Source,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlCopyString(IN PCHAR Destination,
|
RtlCopyString(IN PCHAR Destination,
|
||||||
IN PCCHAR Source,
|
IN PCSTR Source,
|
||||||
IN ULONG Length);
|
IN ULONG Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlCopyWideString(IN PWCHAR Destination,
|
RtlCopyWideString(IN PWCHAR Destination,
|
||||||
IN CONST PWCHAR Source,
|
IN PCWSTR Source,
|
||||||
IN ULONG Length);
|
IN ULONG Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LARGE_INTEGER
|
LARGE_INTEGER
|
||||||
RtlDivideLargeInteger(IN LARGE_INTEGER Dividend,
|
RtlDivideLargeInteger(IN LARGE_INTEGER Dividend,
|
||||||
IN ULONG Divisor,
|
IN ULONG Divisor,
|
||||||
OUT PULONG Remainder);
|
OUT PULONG Remainder);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
RtlFindClearBits(IN PRTL_BITMAP BitMap,
|
RtlFindClearBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Length,
|
IN ULONG_PTR Length,
|
||||||
IN ULONG_PTR Index);
|
IN ULONG_PTR Index);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
RtlFindSetBits(IN PRTL_BITMAP BitMap,
|
RtlFindSetBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Length,
|
IN ULONG_PTR Length,
|
||||||
IN ULONG_PTR Index);
|
IN ULONG_PTR Index);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
PCSTR
|
||||||
RtlFormatWideString(IN PRTL_PRINT_CONTEXT Context,
|
RtlFindString(IN PCSTR Source,
|
||||||
IN PCWSTR Format,
|
IN PCSTR Search);
|
||||||
IN VA_LIST ArgumentList);
|
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
PCSTR
|
||||||
|
RtlFindStringInsensitive(IN PCSTR Source,
|
||||||
|
IN PCSTR Search);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
PCWSTR
|
||||||
|
RtlFindWideString(IN PCWSTR Source,
|
||||||
|
IN PCWSTR Search);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
PCWSTR
|
||||||
|
RtlFindWideStringInsensitive(IN PCWSTR Source,
|
||||||
|
IN PCWSTR Search);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlInitializeBitMap(IN PRTL_BITMAP BitMap,
|
RtlInitializeBitMap(IN PRTL_BITMAP BitMap,
|
||||||
IN PULONG_PTR Buffer,
|
IN PULONG_PTR Buffer,
|
||||||
IN ULONG Size);
|
IN ULONG Size);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
RtlInitializeListHead(IN PLIST_ENTRY ListHead);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
RtlInsertHeadList(IN OUT PLIST_ENTRY ListHead,
|
||||||
|
IN PLIST_ENTRY Entry);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
RtlInsertTailList(IN OUT PLIST_ENTRY ListHead,
|
||||||
|
IN PLIST_ENTRY Entry);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
BOOLEAN
|
||||||
|
RtlListEmpty(IN PLIST_ENTRY ListHead);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
BOOLEAN
|
||||||
|
RtlListLoop(IN PLIST_ENTRY ListHead);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlMoveMemory(OUT PVOID Destination,
|
RtlMoveMemory(OUT PVOID Destination,
|
||||||
IN PCVOID Source,
|
IN PCVOID Source,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
LARGE_INTEGER
|
LARGE_INTEGER
|
||||||
RtlMultiplyLargeInteger(IN LARGE_INTEGER Multiplicand,
|
RtlMultiplyLargeInteger(IN LARGE_INTEGER Multiplicand,
|
||||||
IN LONG Multiplier);
|
IN LONG Multiplier);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
RtlRemoveEntryList(IN PLIST_ENTRY Entry);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlReverseString(IN OUT PCHAR String,
|
RtlReverseString(IN OUT PCHAR String,
|
||||||
IN ULONG Length);
|
IN ULONG Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlReverseWideString(IN OUT PWCHAR String,
|
RtlReverseWideString(IN OUT PWCHAR String,
|
||||||
IN ULONG Length);
|
IN ULONG Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
RtlSameMemory(IN PCVOID LeftBuffer,
|
RtlSameMemory(IN PCVOID LeftBuffer,
|
||||||
IN PCVOID RightBuffer,
|
IN PCVOID RightBuffer,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlSetAllBits(IN PRTL_BITMAP BitMap);
|
RtlSetAllBits(IN PRTL_BITMAP BitMap);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlSetBit(IN PRTL_BITMAP BitMap,
|
RtlSetBit(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Bit);
|
IN ULONG_PTR Bit);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlSetBits(IN PRTL_BITMAP BitMap,
|
RtlSetBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR StartingIndex,
|
IN ULONG_PTR StartingIndex,
|
||||||
IN ULONG_PTR Length);
|
IN ULONG_PTR Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG
|
ULONG
|
||||||
RtlSetClearBits(IN PRTL_BITMAP BitMap,
|
RtlSetClearBits(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Length,
|
IN ULONG_PTR Length,
|
||||||
IN ULONG_PTR Index);
|
IN ULONG_PTR Index);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlSetMemory(OUT PVOID Destination,
|
RtlSetMemory(OUT PVOID Destination,
|
||||||
IN UCHAR Byte,
|
IN UCHAR Byte,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlStringLength(IN CONST PCHAR String,
|
RtlStringLength(IN PCSTR String,
|
||||||
IN SIZE_T MaxLength);
|
IN SIZE_T MaxLength);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlStringToWideString(OUT PWCHAR Destination,
|
RtlStringToWideString(OUT PWCHAR Destination,
|
||||||
IN CONST PCHAR *Source,
|
IN PCSTR *Source,
|
||||||
IN SIZE_T Length);
|
IN SIZE_T Length);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
RtlTestBit(IN PRTL_BITMAP BitMap,
|
RtlTestBit(IN PRTL_BITMAP BitMap,
|
||||||
IN ULONG_PTR Bit);
|
IN ULONG_PTR Bit);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PCHAR
|
PCHAR
|
||||||
RtlTokenizeString(IN PCHAR String,
|
RtlTokenizeString(IN PCHAR String,
|
||||||
IN CONST PCHAR Delimiter,
|
IN PCSTR Delimiter,
|
||||||
IN OUT PCHAR *SavePtr);
|
IN OUT PCHAR *SavePtr);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PWCHAR
|
PWCHAR
|
||||||
RtlTokenizeWideString(IN PWCHAR String,
|
RtlTokenizeWideString(IN PWCHAR String,
|
||||||
IN CONST PWCHAR Delimiter,
|
IN PCWSTR Delimiter,
|
||||||
IN OUT PWCHAR *SavePtr);
|
IN OUT PWCHAR *SavePtr);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
CHAR
|
||||||
|
RtlToLowerCharacter(IN CHAR Character);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
WCHAR
|
||||||
|
RtlToLowerWideCharacter(IN WCHAR Character);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
CHAR
|
||||||
|
RtlToUpperCharacter(IN CHAR Character);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
|
XTAPI
|
||||||
|
WCHAR
|
||||||
|
RtlToUpperWideCharacter(IN WCHAR Character);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PCHAR
|
PCHAR
|
||||||
RtlTrimLeftString(IN CONST PCHAR String);
|
RtlTrimLeftString(IN PCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PWCHAR
|
PWCHAR
|
||||||
RtlTrimLeftWideString(IN CONST PWCHAR String);
|
RtlTrimLeftWideString(IN PWCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PCHAR
|
PCHAR
|
||||||
RtlTrimRightString(IN CONST PCHAR String);
|
RtlTrimRightString(IN PCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PWCHAR
|
PWCHAR
|
||||||
RtlTrimRightWideString(IN CONST PWCHAR String);
|
RtlTrimRightWideString(IN PWCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PCHAR
|
PCHAR
|
||||||
RtlTrimString(IN CONST PCHAR String);
|
RtlTrimString(IN PCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PWCHAR
|
PWCHAR
|
||||||
RtlTrimWideString(IN CONST PWCHAR String);
|
RtlTrimWideString(IN PWCHAR String);
|
||||||
|
|
||||||
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
SIZE_T
|
SIZE_T
|
||||||
RtlWideStringLength(IN CONST PWCHAR String,
|
RtlWideStringLength(IN PCWSTR String,
|
||||||
IN SIZE_T MaxLength);
|
IN SIZE_T MaxLength);
|
||||||
|
|
||||||
XTAPI
|
XTCLINK
|
||||||
VOID
|
|
||||||
RtlWriteRegisterByte(IN VOLATILE PVOID Register,
|
|
||||||
IN UCHAR Value);
|
|
||||||
|
|
||||||
XTAPI
|
|
||||||
VOID
|
|
||||||
RtlWriteRegisterLong(IN VOLATILE PVOID Register,
|
|
||||||
IN ULONG Value);
|
|
||||||
|
|
||||||
XTAPI
|
|
||||||
VOID
|
|
||||||
RtlWriteRegisterShort(IN VOLATILE PVOID Register,
|
|
||||||
IN USHORT Value);
|
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
RtlZeroMemory(OUT PVOID Destination,
|
RtlZeroMemory(OUT PVOID Destination,
|
||||||
|
@@ -56,17 +56,17 @@ typedef XTSTATUS (*PWRITE_WIDE_CHARACTER)(IN WCHAR Character);
|
|||||||
/* Variable types enumeration list */
|
/* Variable types enumeration list */
|
||||||
typedef enum _RTL_VARIABLE_TYPE
|
typedef enum _RTL_VARIABLE_TYPE
|
||||||
{
|
{
|
||||||
Unknown,
|
TypeUnknown,
|
||||||
AnsiString,
|
TypeAnsiString,
|
||||||
Boolean,
|
TypeBoolean,
|
||||||
Char,
|
TypeChar,
|
||||||
Float,
|
TypeFloat,
|
||||||
Guid,
|
TypeGuid,
|
||||||
Integer,
|
TypeInteger,
|
||||||
String,
|
TypeString,
|
||||||
UnicodeString,
|
TypeUnicodeString,
|
||||||
WideChar,
|
TypeWideChar,
|
||||||
WideString
|
TypeWideString
|
||||||
} RTL_VARIABLE_TYPE, *PRTL_VARIABLE_TYPE;
|
} RTL_VARIABLE_TYPE, *PRTL_VARIABLE_TYPE;
|
||||||
|
|
||||||
/* Bit Map structure definition */
|
/* Bit Map structure definition */
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Base XT headers */
|
/* Base XT headers */
|
||||||
|
#include <xtcompat.h>
|
||||||
#include <xtdefs.h>
|
#include <xtdefs.h>
|
||||||
#include <xtstatus.h>
|
#include <xtstatus.h>
|
||||||
#include <xttarget.h>
|
#include <xttarget.h>
|
||||||
@@ -37,14 +38,6 @@
|
|||||||
#include ARCH_HEADER(ketypes.h)
|
#include ARCH_HEADER(ketypes.h)
|
||||||
#include ARCH_HEADER(mmtypes.h)
|
#include ARCH_HEADER(mmtypes.h)
|
||||||
|
|
||||||
/* XT Kernel runtime routines */
|
|
||||||
#include <hlfuncs.h>
|
|
||||||
#include <rtlfuncs.h>
|
|
||||||
|
|
||||||
/* Architecture specific XT kernel routines */
|
|
||||||
#include ARCH_HEADER(arfuncs.h)
|
|
||||||
#include ARCH_HEADER(hlfuncs.h)
|
|
||||||
|
|
||||||
/* Boot Manager specific structures */
|
/* Boot Manager specific structures */
|
||||||
#include <bltarget.h>
|
#include <bltarget.h>
|
||||||
#include <bltypes.h>
|
#include <bltypes.h>
|
||||||
|
41
sdk/xtdk/xtcompat.h
Normal file
41
sdk/xtdk/xtcompat.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/xtcompat.h
|
||||||
|
* DESCRIPTION: C/C++ compatibility macros
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_XTCOMPAT_H
|
||||||
|
#define __XTDK_XTCOMPAT_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
/* C++ definitions */
|
||||||
|
#define XTCLINK extern "C"
|
||||||
|
#define NULLPTR nullptr
|
||||||
|
|
||||||
|
/* C++ boolean type */
|
||||||
|
typedef bool BOOLEAN, *PBOOLEAN;
|
||||||
|
#define TRUE true
|
||||||
|
#define FALSE false
|
||||||
|
|
||||||
|
/* C++ widechar type */
|
||||||
|
typedef wchar_t wchar;
|
||||||
|
#else
|
||||||
|
/* C definitions */
|
||||||
|
#define XTCLINK
|
||||||
|
#define NULLPTR ((void *)0)
|
||||||
|
|
||||||
|
/* C boolean type */
|
||||||
|
typedef enum _BOOLEAN
|
||||||
|
{
|
||||||
|
FALSE = 0,
|
||||||
|
TRUE = 1
|
||||||
|
} BOOLEAN, *PBOOLEAN;
|
||||||
|
|
||||||
|
/* C widechar type */
|
||||||
|
typedef unsigned short wchar;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __XTDK_XTCOMPAT_H */
|
@@ -20,7 +20,7 @@
|
|||||||
/* XTOS platform debugging macros */
|
/* XTOS platform debugging macros */
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#define DebugPrint(Format, ...) if(KeDbgPrint) KeDbgPrint(Format, __VA_ARGS__);
|
#define DebugPrint(Format, ...) DbgPrint(Format, __VA_ARGS__);
|
||||||
#else
|
#else
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#define DebugPrint(Format, ...) ((VOID)NULL)
|
#define DebugPrint(Format, ...) ((VOID)NULL)
|
||||||
|
@@ -29,10 +29,6 @@
|
|||||||
#define UNION union
|
#define UNION union
|
||||||
#define VOLATILE volatile
|
#define VOLATILE volatile
|
||||||
|
|
||||||
/* NULL values */
|
|
||||||
#define NULL ((PVOID) 0)
|
|
||||||
#define NULL64 ((VOID * PVOID) 0)
|
|
||||||
|
|
||||||
/* Type limits */
|
/* Type limits */
|
||||||
#define MINCHAR 0x80
|
#define MINCHAR 0x80
|
||||||
#define MAXCHAR 0x7F
|
#define MAXCHAR 0x7F
|
||||||
|
3949
sdk/xtdk/xtfont.h
3949
sdk/xtdk/xtfont.h
File diff suppressed because it is too large
Load Diff
@@ -89,7 +89,6 @@ typedef struct _FIRMWARE_INFORMATION_BLOCK
|
|||||||
typedef struct _LOADER_INFORMATION_BLOCK
|
typedef struct _LOADER_INFORMATION_BLOCK
|
||||||
{
|
{
|
||||||
PVOID DbgPrint;
|
PVOID DbgPrint;
|
||||||
ULONG PageMapLevel;
|
|
||||||
} LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
} LOADER_INFORMATION_BLOCK, *PLOADER_INFORMATION_BLOCK;
|
||||||
|
|
||||||
/* Boot Loader memory mapping information */
|
/* Boot Loader memory mapping information */
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Base XT headers */
|
/* Base XT headers */
|
||||||
|
#include <xtcompat.h>
|
||||||
#include <xtdefs.h>
|
#include <xtdefs.h>
|
||||||
#include <xtstatus.h>
|
#include <xtstatus.h>
|
||||||
#include <xttarget.h>
|
#include <xttarget.h>
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#include <extypes.h>
|
#include <extypes.h>
|
||||||
#include <hltypes.h>
|
#include <hltypes.h>
|
||||||
#include <iotypes.h>
|
#include <iotypes.h>
|
||||||
|
#include <kdtypes.h>
|
||||||
#include <ketypes.h>
|
#include <ketypes.h>
|
||||||
#include <ldrtypes.h>
|
#include <ldrtypes.h>
|
||||||
#include <mmtypes.h>
|
#include <mmtypes.h>
|
||||||
@@ -46,9 +48,9 @@
|
|||||||
/* XT routines */
|
/* XT routines */
|
||||||
#include <exfuncs.h>
|
#include <exfuncs.h>
|
||||||
#include <hlfuncs.h>
|
#include <hlfuncs.h>
|
||||||
|
#include <kdfuncs.h>
|
||||||
#include <kefuncs.h>
|
#include <kefuncs.h>
|
||||||
#include <rtlfuncs.h>
|
#include <rtlfuncs.h>
|
||||||
|
|
||||||
/* Architecture specific XT routines */
|
/* Architecture specific XT routines */
|
||||||
#include ARCH_HEADER(arfuncs.h)
|
|
||||||
#include ARCH_HEADER(hlfuncs.h)
|
#include ARCH_HEADER(hlfuncs.h)
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
#define STATUS_INVALID_PARAMETER ((XTSTATUS) 0xC000000DL)
|
#define STATUS_INVALID_PARAMETER ((XTSTATUS) 0xC000000DL)
|
||||||
#define STATUS_END_OF_FILE ((XTSTATUS) 0xC0000011L)
|
#define STATUS_END_OF_FILE ((XTSTATUS) 0xC0000011L)
|
||||||
#define STATUS_NO_MEMORY ((XTSTATUS) 0xC0000017L)
|
#define STATUS_NO_MEMORY ((XTSTATUS) 0xC0000017L)
|
||||||
|
#define STATUS_PORT_DISCONNECTED ((XTSTATUS) 0xC0000037L)
|
||||||
#define STATUS_CRC_ERROR ((XTSTATUS) 0xC000003FL)
|
#define STATUS_CRC_ERROR ((XTSTATUS) 0xC000003FL)
|
||||||
#define STATUS_INSUFFICIENT_RESOURCES ((XTSTATUS) 0xC000009AL)
|
#define STATUS_INSUFFICIENT_RESOURCES ((XTSTATUS) 0xC000009AL)
|
||||||
#define STATUS_DEVICE_NOT_READY ((XTSTATUS) 0xC00000A3L)
|
#define STATUS_DEVICE_NOT_READY ((XTSTATUS) 0xC00000A3L)
|
||||||
|
@@ -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;
|
||||||
@@ -50,7 +49,9 @@ typedef enum _KTIMER_TYPE KTIMER_TYPE, *PKTIMER_TYPE;
|
|||||||
typedef enum _KUBSAN_DATA_TYPE KUBSAN_DATA_TYPE, *PKUBSAN_DATA_TYPE;
|
typedef enum _KUBSAN_DATA_TYPE KUBSAN_DATA_TYPE, *PKUBSAN_DATA_TYPE;
|
||||||
typedef enum _LOADER_MEMORY_TYPE LOADER_MEMORY_TYPE, *PLOADER_MEMORY_TYPE;
|
typedef enum _LOADER_MEMORY_TYPE LOADER_MEMORY_TYPE, *PLOADER_MEMORY_TYPE;
|
||||||
typedef enum _MODE MODE, *PMODE;
|
typedef enum _MODE MODE, *PMODE;
|
||||||
|
typedef enum _RTL_VARIABLE_TYPE RTL_VARIABLE_TYPE, *PRTL_VARIABLE_TYPE;
|
||||||
typedef enum _SYSTEM_FIRMWARE_TYPE SYSTEM_FIRMWARE_TYPE, *PSYSTEM_FIRMWARE_TYPE;
|
typedef enum _SYSTEM_FIRMWARE_TYPE SYSTEM_FIRMWARE_TYPE, *PSYSTEM_FIRMWARE_TYPE;
|
||||||
|
typedef enum _SYSTEM_RESOURCE_TYPE SYSTEM_RESOURCE_TYPE, *PSYSTEM_RESOURCE_TYPE;
|
||||||
typedef enum _WAIT_TYPE WAIT_TYPE, *PWAIT_TYPE;
|
typedef enum _WAIT_TYPE WAIT_TYPE, *PWAIT_TYPE;
|
||||||
|
|
||||||
/* Structures forward references */
|
/* Structures forward references */
|
||||||
@@ -69,6 +70,7 @@ typedef struct _ANSI_STRING ANSI_STRING, *PANSI_STRING;
|
|||||||
typedef struct _ANSI_STRING32 ANSI_STRING32, *PANSI_STRING32;
|
typedef struct _ANSI_STRING32 ANSI_STRING32, *PANSI_STRING32;
|
||||||
typedef struct _ANSI_STRING64 ANSI_STRING64, *PANSI_STRING64;
|
typedef struct _ANSI_STRING64 ANSI_STRING64, *PANSI_STRING64;
|
||||||
typedef struct _CPPORT CPPORT, *PCPPORT;
|
typedef struct _CPPORT CPPORT, *PCPPORT;
|
||||||
|
typedef const struct _CMMPAGEMAP_ROUTINES CMMPAGEMAP_ROUTINES, *PCMMPAGEMAP_ROUTINES;
|
||||||
typedef struct _CSTRING CSTRING, *PCSTRING;
|
typedef struct _CSTRING CSTRING, *PCSTRING;
|
||||||
typedef struct _EFI_1394_DEVICE_PATH EFI_1394_DEVICE_PATH, *PEFI_1394_DEVICE_PATH;
|
typedef struct _EFI_1394_DEVICE_PATH EFI_1394_DEVICE_PATH, *PEFI_1394_DEVICE_PATH;
|
||||||
typedef struct _EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, *PEFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
|
typedef struct _EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, *PEFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
|
||||||
@@ -233,9 +235,12 @@ typedef struct _FIRMWARE_INFORMATION_BLOCK FIRMWARE_INFORMATION_BLOCK, *PFIRMWAR
|
|||||||
typedef struct _FLOAT128 FLOAT128, *PFLOAT128;
|
typedef struct _FLOAT128 FLOAT128, *PFLOAT128;
|
||||||
typedef struct _GENERIC_ADDRESS GENERIC_ADDRESS, *PGENERIC_ADDRESS;
|
typedef struct _GENERIC_ADDRESS GENERIC_ADDRESS, *PGENERIC_ADDRESS;
|
||||||
typedef struct _GUID GUID, *PGUID;
|
typedef struct _GUID GUID, *PGUID;
|
||||||
typedef struct _HAL_FRAMEBUFFER_DATA HAL_FRAMEBUFFER_DATA, *PHAL_FRAMEBUFFER_DATA;
|
typedef struct _HL_FRAMEBUFFER_DATA HL_FRAMEBUFFER_DATA, *PHL_FRAMEBUFFER_DATA;
|
||||||
|
typedef struct _HL_SCROLL_REGION_DATA HL_SCROLL_REGION_DATA, *PHL_SCROLL_REGION_DATA;
|
||||||
typedef struct _KAPC KAPC, *PKAPC;
|
typedef struct _KAPC KAPC, *PKAPC;
|
||||||
typedef struct _KAPC_STATE KAPC_STATE, *PKAPC_STATE;
|
typedef struct _KAPC_STATE KAPC_STATE, *PKAPC_STATE;
|
||||||
|
typedef struct _KD_DEBUG_MODE KD_DEBUG_MODE, *PKD_DEBUG_MODE;
|
||||||
|
typedef struct _KD_DISPATCH_TABLE KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE;
|
||||||
typedef struct _KDPC KDPC, *PKDPC;
|
typedef struct _KDPC KDPC, *PKDPC;
|
||||||
typedef struct _KDPC_DATA KDPC_DATA, *PKDPC_DATA;
|
typedef struct _KDPC_DATA KDPC_DATA, *PKDPC_DATA;
|
||||||
typedef struct _KERNEL_INITIALIZATION_BLOCK KERNEL_INITIALIZATION_BLOCK, *PKERNEL_INITIALIZATION_BLOCK;
|
typedef struct _KERNEL_INITIALIZATION_BLOCK KERNEL_INITIALIZATION_BLOCK, *PKERNEL_INITIALIZATION_BLOCK;
|
||||||
@@ -300,6 +305,9 @@ typedef struct _PECOFF_IMAGE_SECTION_HEADER PECOFF_IMAGE_SECTION_HEADER, *PPECOF
|
|||||||
typedef struct _PECOFF_IMAGE_VXD_HEADER PECOFF_IMAGE_VXD_HEADER, *PPECOFF_IMAGE_VXD_HEADER;
|
typedef struct _PECOFF_IMAGE_VXD_HEADER PECOFF_IMAGE_VXD_HEADER, *PPECOFF_IMAGE_VXD_HEADER;
|
||||||
typedef struct _PROCESSOR_IDENTITY PROCESSOR_IDENTITY, *PPROCESSOR_IDENTITY;
|
typedef struct _PROCESSOR_IDENTITY PROCESSOR_IDENTITY, *PPROCESSOR_IDENTITY;
|
||||||
typedef struct _PROCESSOR_POWER_STATE PROCESSOR_POWER_STATE, *PPROCESSOR_POWER_STATE;
|
typedef struct _PROCESSOR_POWER_STATE PROCESSOR_POWER_STATE, *PPROCESSOR_POWER_STATE;
|
||||||
|
typedef struct _RTL_BITMAP RTL_BITMAP, *PRTL_BITMAP;
|
||||||
|
typedef struct _RTL_PRINT_CONTEXT RTL_PRINT_CONTEXT, *PRTL_PRINT_CONTEXT;
|
||||||
|
typedef struct _RTL_PRINT_FORMAT_PROPERTIES RTL_PRINT_FORMAT_PROPERTIES, *PRTL_PRINT_FORMAT_PROPERTIES;
|
||||||
typedef struct _SINGLE_LIST_ENTRY SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
|
typedef struct _SINGLE_LIST_ENTRY SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
|
||||||
typedef struct _SMBIOS_TABLE_HEADER SMBIOS_TABLE_HEADER, *PSMBIOS_TABLE_HEADER;
|
typedef struct _SMBIOS_TABLE_HEADER SMBIOS_TABLE_HEADER, *PSMBIOS_TABLE_HEADER;
|
||||||
typedef struct _SMBIOS3_TABLE_HEADER SMBIOS3_TABLE_HEADER, *PSMBIOS3_TABLE_HEADER;
|
typedef struct _SMBIOS3_TABLE_HEADER SMBIOS3_TABLE_HEADER, *PSMBIOS3_TABLE_HEADER;
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#define __XTDK_XTTYPES_H
|
#define __XTDK_XTTYPES_H
|
||||||
|
|
||||||
#include <xttarget.h>
|
#include <xttarget.h>
|
||||||
|
#include <xtcompat.h>
|
||||||
|
|
||||||
|
|
||||||
/* Standard C types */
|
/* Standard C types */
|
||||||
@@ -128,7 +129,7 @@ typedef CHAR SZ, *PSZ;
|
|||||||
typedef const CHAR CSZ, *PCSZ;
|
typedef const CHAR CSZ, *PCSZ;
|
||||||
|
|
||||||
/* UNICODE character types */
|
/* UNICODE character types */
|
||||||
typedef USHORT WCHAR, *PWCHAR;
|
typedef wchar WCHAR, *PWCHAR;
|
||||||
typedef WCHAR *PWCH, *LPWCH;
|
typedef WCHAR *PWCH, *LPWCH;
|
||||||
typedef const WCHAR *PCWCH, *LPCWCH;
|
typedef const WCHAR *PCWCH, *LPCWCH;
|
||||||
typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
|
typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
|
||||||
@@ -149,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
|
||||||
{
|
{
|
||||||
|
@@ -356,6 +356,7 @@
|
|||||||
#define EFI_RNG_PROTOCOL_GUID {0x3152BCA5, 0xEADE, 0x433D, {0x86, 0x2E, 0xC0, 0x1C, 0xDC, 0x29, 0x1F, 0x44}}
|
#define EFI_RNG_PROTOCOL_GUID {0x3152BCA5, 0xEADE, 0x433D, {0x86, 0x2E, 0xC0, 0x1C, 0xDC, 0x29, 0x1F, 0x44}}
|
||||||
#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID {0x964E5B22, 0x6459, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID {0x964E5B22, 0x6459, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
||||||
#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID {0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}}
|
#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID {0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}}
|
||||||
|
#define EFI_SIMPLE_POINTER_PROTOCOL_GUID {0x31878C87, 0x0B75, 0x11D5, {0x9A, 0x4F, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}}
|
||||||
#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID {0x387477C1, 0x69C7, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID {0x387477C1, 0x69C7, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
||||||
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID {0xDD9E7534, 0x7762, 0x4698, {0x8C, 0x14, 0xF5, 0x85, 0x17, 0xA6, 0x25, 0xAA}}
|
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID {0xDD9E7534, 0x7762, 0x4698, {0x8C, 0x14, 0xF5, 0x85, 0x17, 0xA6, 0x25, 0xAA}}
|
||||||
#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID {0x387477C2, 0x69C7, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID {0x387477C2, 0x69C7, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
||||||
@@ -634,9 +635,9 @@ typedef EFI_STATUS (*PEFI_FREE_POOL)(IN PVOID Buffer);
|
|||||||
typedef VOID (*PEFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN PVOID Context);
|
typedef VOID (*PEFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN PVOID Context);
|
||||||
typedef EFI_STATUS (*PEFI_CREATE_EVENT)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN PEFI_EVENT_NOTIFY NotifyFunction, IN PVOID NotifyContext, OUT PEFI_EVENT Event);
|
typedef EFI_STATUS (*PEFI_CREATE_EVENT)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN PEFI_EVENT_NOTIFY NotifyFunction, IN PVOID NotifyContext, OUT PEFI_EVENT Event);
|
||||||
typedef EFI_STATUS (*PEFI_GET_MEMORY_MAP)(IN OUT PUINT_PTR MemoryMapSize, IN OUT PEFI_MEMORY_DESCRIPTOR MemoryMap, OUT PUINT_PTR MapKey, OUT PUINT_PTR DescriptorSize, OUT PUINT32 DescriptorVersion);
|
typedef EFI_STATUS (*PEFI_GET_MEMORY_MAP)(IN OUT PUINT_PTR MemoryMapSize, IN OUT PEFI_MEMORY_DESCRIPTOR MemoryMap, OUT PUINT_PTR MapKey, OUT PUINT_PTR DescriptorSize, OUT PUINT32 DescriptorVersion);
|
||||||
typedef EFI_STATUS (*PEFI_GET_VARIABLE)(IN PUINT16 VariableName, IN PEFI_GUID VendorGuid, OUT PUINT32 Attributes, IN OUT PUINT_PTR DataSize, OUT PVOID Data);
|
typedef EFI_STATUS (*PEFI_GET_VARIABLE)(IN PWCHAR VariableName, IN PEFI_GUID VendorGuid, OUT PUINT32 Attributes, IN OUT PUINT_PTR DataSize, OUT PVOID Data);
|
||||||
typedef EFI_STATUS (*PEFI_GET_NEXT_HIGH_MONO_COUNT)(OUT PUINT32 HighCount);
|
typedef EFI_STATUS (*PEFI_GET_NEXT_HIGH_MONO_COUNT)(OUT PUINT32 HighCount);
|
||||||
typedef EFI_STATUS (*PEFI_GET_NEXT_VARIABLE_NAME)(IN OUT PUINT_PTR VariableNameSize, IN OUT PUINT16 VariableName, IN OUT PEFI_GUID VendorGuid);
|
typedef EFI_STATUS (*PEFI_GET_NEXT_VARIABLE_NAME)(IN OUT PUINT_PTR VariableNameSize, IN OUT PWCHAR VariableName, IN OUT PEFI_GUID VendorGuid);
|
||||||
typedef EFI_STATUS (*PEFI_GET_TIME)(OUT PEFI_TIME Time, OUT PEFI_TIME_CAPABILITIES Capabilities);
|
typedef EFI_STATUS (*PEFI_GET_TIME)(OUT PEFI_TIME Time, OUT PEFI_TIME_CAPABILITIES Capabilities);
|
||||||
typedef EFI_STATUS (*PEFI_SET_TIME)(IN PEFI_TIME Time);
|
typedef EFI_STATUS (*PEFI_SET_TIME)(IN PEFI_TIME Time);
|
||||||
typedef EFI_STATUS (*PEFI_SET_TIMER)(IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime);
|
typedef EFI_STATUS (*PEFI_SET_TIMER)(IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime);
|
||||||
@@ -648,13 +649,13 @@ typedef EFI_STATUS (*PEFI_WAIT_FOR_EVENT)(IN UINT_PTR NumberOfEvents, IN PEFI_EV
|
|||||||
typedef EFI_STATUS (*PEFI_QUERY_CAPSULE_CAPABILITIES)(IN PEFI_CAPSULE_HEADER *CapsuleHeaderArray, IN UINT_PTR CapsuleCount, OUT PUINT64 MaximumCapsuleSize, OUT PEFI_RESET_TYPE ResetType);
|
typedef EFI_STATUS (*PEFI_QUERY_CAPSULE_CAPABILITIES)(IN PEFI_CAPSULE_HEADER *CapsuleHeaderArray, IN UINT_PTR CapsuleCount, OUT PUINT64 MaximumCapsuleSize, OUT PEFI_RESET_TYPE ResetType);
|
||||||
typedef EFI_STATUS (*PEFI_QUERY_VARIABLE_INFO)(IN UINT32 Attributes, OUT PUINT64 MaximumVariableStorageSize, OUT PUINT64 RemainingVariableStorageSize, OUT PUINT64 MaximumVariableSize);
|
typedef EFI_STATUS (*PEFI_QUERY_VARIABLE_INFO)(IN UINT32 Attributes, OUT PUINT64 MaximumVariableStorageSize, OUT PUINT64 RemainingVariableStorageSize, OUT PUINT64 MaximumVariableSize);
|
||||||
typedef EFI_STATUS (*PEFI_RAISE_TPL)(IN EFI_TPL NewTpl);
|
typedef EFI_STATUS (*PEFI_RAISE_TPL)(IN EFI_TPL NewTpl);
|
||||||
typedef EFI_STATUS (*PEFI_RESET_SYSTEM)(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINT_PTR DataSize, IN PUINT16 ResetData);
|
typedef EFI_STATUS (*PEFI_RESET_SYSTEM)(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINT_PTR DataSize, IN PWCHAR ResetData);
|
||||||
typedef EFI_STATUS (*PEFI_RESTORE_TPL)(IN EFI_TPL OldTpl);
|
typedef EFI_STATUS (*PEFI_RESTORE_TPL)(IN EFI_TPL OldTpl);
|
||||||
typedef EFI_STATUS (*PEFI_UPDATE_CAPSULE)(IN PEFI_CAPSULE_HEADER *CapsuleHeaderArray, IN UINT_PTR CapsuleCount, IN EFI_PHYSICAL_ADDRESS ScatterGatherList);
|
typedef EFI_STATUS (*PEFI_UPDATE_CAPSULE)(IN PEFI_CAPSULE_HEADER *CapsuleHeaderArray, IN UINT_PTR CapsuleCount, IN EFI_PHYSICAL_ADDRESS ScatterGatherList);
|
||||||
typedef EFI_STATUS (*PEFI_SET_VARIABLE)(IN PUINT16 VariableName, IN PEFI_GUID VendorGuid, IN UINT32 Attributes, IN UINT_PTR DataSize, IN PVOID Data);
|
typedef EFI_STATUS (*PEFI_SET_VARIABLE)(IN PWCHAR VariableName, IN PEFI_GUID VendorGuid, IN UINT32 Attributes, IN UINT_PTR DataSize, IN PVOID Data);
|
||||||
typedef EFI_STATUS (*PEFI_SET_VIRTUAL_ADDRESS_MAP)(IN UINT_PTR MemoryMapSize, IN UINT_PTR DescriptorSize, IN UINT32 DescriptorVersion, IN PEFI_MEMORY_DESCRIPTOR VirtualMap);
|
typedef EFI_STATUS (*PEFI_SET_VIRTUAL_ADDRESS_MAP)(IN UINT_PTR MemoryMapSize, IN UINT_PTR DescriptorSize, IN UINT32 DescriptorVersion, IN PEFI_MEMORY_DESCRIPTOR VirtualMap);
|
||||||
typedef EFI_STATUS (*PEFI_GET_WAKEUP_TIME)(OUT UCHAR Enabled, OUT UCHAR Pending, OUT PEFI_TIME Time);
|
typedef EFI_STATUS (*PEFI_GET_WAKEUP_TIME)(OUT BOOLEAN Enabled, OUT BOOLEAN Pending, OUT PEFI_TIME Time);
|
||||||
typedef EFI_STATUS (*PEFI_SET_WAKEUP_TIME)(IN UCHAR Enable, IN PEFI_TIME Time);
|
typedef EFI_STATUS (*PEFI_SET_WAKEUP_TIME)(IN BOOLEAN Enable, IN PEFI_TIME Time);
|
||||||
typedef EFI_STATUS (*PEFI_INSTALL_PROTOCOL_INTERFACE)(IN OUT PEFI_HANDLE Handle, IN PEFI_GUID Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN PVOID Interface);
|
typedef EFI_STATUS (*PEFI_INSTALL_PROTOCOL_INTERFACE)(IN OUT PEFI_HANDLE Handle, IN PEFI_GUID Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN PVOID Interface);
|
||||||
typedef EFI_STATUS (*PEFI_REINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN PVOID OldInterface, IN PVOID NewInterface);
|
typedef EFI_STATUS (*PEFI_REINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN PVOID OldInterface, IN PVOID NewInterface);
|
||||||
typedef EFI_STATUS (*PEFI_UNINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN PVOID Interface);
|
typedef EFI_STATUS (*PEFI_UNINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN PVOID Interface);
|
||||||
@@ -665,15 +666,15 @@ typedef EFI_STATUS (*PEFI_LOCATE_DEVICE_PATH)(IN PEFI_GUID Protocol, IN OUT PEFI
|
|||||||
typedef EFI_STATUS (*PEFI_LOCATE_HANDLE_BUFFER)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN PEFI_GUID Protocol, IN PVOID SearchKey, IN OUT PUINT_PTR NoHandles, OUT PEFI_HANDLE *Buffer);
|
typedef EFI_STATUS (*PEFI_LOCATE_HANDLE_BUFFER)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN PEFI_GUID Protocol, IN PVOID SearchKey, IN OUT PUINT_PTR NoHandles, OUT PEFI_HANDLE *Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_LOCATE_PROTOCOL)(IN PEFI_GUID Protocol, IN PVOID Registration, OUT PVOID *Interface);
|
typedef EFI_STATUS (*PEFI_LOCATE_PROTOCOL)(IN PEFI_GUID Protocol, IN PVOID Registration, OUT PVOID *Interface);
|
||||||
typedef EFI_STATUS (*PEFI_INSTALL_CONFIGURATION_TABLE)(IN PEFI_GUID Guid, IN PVOID Table);
|
typedef EFI_STATUS (*PEFI_INSTALL_CONFIGURATION_TABLE)(IN PEFI_GUID Guid, IN PVOID Table);
|
||||||
typedef EFI_STATUS (*PEFI_IMAGE_LOAD)(IN UCHAR BootPolicy, IN EFI_HANDLE ParentImageHandle, IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, IN PVOID SourceBuffer, IN UINT_PTR SourceSize, OUT PEFI_HANDLE ImageHandle);
|
typedef EFI_STATUS (*PEFI_IMAGE_LOAD)(IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, IN PVOID SourceBuffer, IN UINT_PTR SourceSize, OUT PEFI_HANDLE ImageHandle);
|
||||||
typedef EFI_STATUS (*PEFI_IMAGE_UNLOAD)(IN EFI_HANDLE ImageHandle);
|
typedef EFI_STATUS (*PEFI_IMAGE_UNLOAD)(IN EFI_HANDLE ImageHandle);
|
||||||
typedef EFI_STATUS (*PEFI_IMAGE_START)(IN EFI_HANDLE ImageHandle, OUT PUINT_PTR ExitDataSize, OUT PUINT16 *ExitData);
|
typedef EFI_STATUS (*PEFI_IMAGE_START)(IN EFI_HANDLE ImageHandle, OUT PUINT_PTR ExitDataSize, OUT PWCHAR *ExitData);
|
||||||
typedef EFI_STATUS (*PEFI_EXIT)(IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINT_PTR ExitDataSize, IN PUINT16 ExitData);
|
typedef EFI_STATUS (*PEFI_EXIT)(IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINT_PTR ExitDataSize, IN PWCHAR ExitData);
|
||||||
typedef EFI_STATUS (*PEFI_EXIT_BOOT_SERVICES)(IN EFI_HANDLE ImageHandle, IN UINT_PTR MapKey);
|
typedef EFI_STATUS (*PEFI_EXIT_BOOT_SERVICES)(IN EFI_HANDLE ImageHandle, IN UINT_PTR MapKey);
|
||||||
typedef EFI_STATUS (*PEFI_GET_NEXT_MONOTONIC_COUNT)(OUT PUINT64 Count);
|
typedef EFI_STATUS (*PEFI_GET_NEXT_MONOTONIC_COUNT)(OUT PUINT64 Count);
|
||||||
typedef EFI_STATUS (*PEFI_STALL)(IN UINT_PTR Microseconds);
|
typedef EFI_STATUS (*PEFI_STALL)(IN UINT_PTR Microseconds);
|
||||||
typedef EFI_STATUS (*PEFI_SET_WATCHDOG_TIMER)(IN UINT_PTR Timeout, IN UINT64 WatchdogCode, IN UINT_PTR DataSize, IN PUINT16 WatchdogData);
|
typedef EFI_STATUS (*PEFI_SET_WATCHDOG_TIMER)(IN UINT_PTR Timeout, IN UINT64 WatchdogCode, IN UINT_PTR DataSize, IN PWCHAR WatchdogData);
|
||||||
typedef EFI_STATUS (*PEFI_CONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN PEFI_HANDLE DriverImageHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath, IN UCHAR Recursive);
|
typedef EFI_STATUS (*PEFI_CONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN PEFI_HANDLE DriverImageHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath, IN BOOLEAN Recursive);
|
||||||
typedef EFI_STATUS (*PEFI_DISCONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle, IN EFI_HANDLE ChildHandle);
|
typedef EFI_STATUS (*PEFI_DISCONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle, IN EFI_HANDLE ChildHandle);
|
||||||
typedef EFI_STATUS (*PEFI_OPEN_PROTOCOL)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, OUT PVOID *Interface, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes);
|
typedef EFI_STATUS (*PEFI_OPEN_PROTOCOL)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, OUT PVOID *Interface, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes);
|
||||||
typedef EFI_STATUS (*PEFI_CLOSE_PROTOCOL)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle);
|
typedef EFI_STATUS (*PEFI_CLOSE_PROTOCOL)(IN EFI_HANDLE Handle, IN PEFI_GUID Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle);
|
||||||
@@ -684,18 +685,18 @@ typedef EFI_STATUS (*PEFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(IN OUT PEFI_HA
|
|||||||
typedef EFI_STATUS (*PEFI_CALCULATE_CRC32)(IN PVOID Data, IN UINT_PTR DataSize, OUT PUINT32 Crc32);
|
typedef EFI_STATUS (*PEFI_CALCULATE_CRC32)(IN PVOID Data, IN UINT_PTR DataSize, OUT PUINT32 Crc32);
|
||||||
typedef EFI_STATUS (*PEFI_COPY_MEM)(IN OUT PVOID Destination, IN PVOID Source, IN UINT_PTR Length);
|
typedef EFI_STATUS (*PEFI_COPY_MEM)(IN OUT PVOID Destination, IN PVOID Source, IN UINT_PTR Length);
|
||||||
typedef EFI_STATUS (*PEFI_SET_MEM)(IN OUT PVOID Buffer, IN UINT_PTR Size, IN UINT8 Value);
|
typedef EFI_STATUS (*PEFI_SET_MEM)(IN OUT PVOID Buffer, IN UINT_PTR Size, IN UINT8 Value);
|
||||||
typedef EFI_STATUS (*PEFI_INPUT_RESET)(IN PEFI_SIMPLE_TEXT_INPUT_PROTOCOL This, IN UCHAR ExtendedVerification);
|
typedef EFI_STATUS (*PEFI_INPUT_RESET)(IN PEFI_SIMPLE_TEXT_INPUT_PROTOCOL This, IN BOOLEAN ExtendedVerification);
|
||||||
typedef EFI_STATUS (*PEFI_INPUT_READ_KEY)(IN PEFI_SIMPLE_TEXT_INPUT_PROTOCOL This, OUT PEFI_INPUT_KEY Key);
|
typedef EFI_STATUS (*PEFI_INPUT_READ_KEY)(IN PEFI_SIMPLE_TEXT_INPUT_PROTOCOL This, OUT PEFI_INPUT_KEY Key);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_RESET)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UCHAR ExtendedVerification);
|
typedef EFI_STATUS (*PEFI_TEXT_RESET)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN BOOLEAN ExtendedVerification);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_OUTPUT_STRING)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN PUINT16 String);
|
typedef EFI_STATUS (*PEFI_TEXT_OUTPUT_STRING)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN PWCHAR String);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_TEST_STRING)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN PUINT16 String);
|
typedef EFI_STATUS (*PEFI_TEXT_TEST_STRING)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN PWCHAR String);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_QUERY_MODE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR ModeNumber, OUT PUINT_PTR Columns, OUT PUINT_PTR Rows);
|
typedef EFI_STATUS (*PEFI_TEXT_QUERY_MODE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR ModeNumber, OUT PUINT_PTR Columns, OUT PUINT_PTR Rows);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_SET_MODE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR ModeNumber);
|
typedef EFI_STATUS (*PEFI_TEXT_SET_MODE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR ModeNumber);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_SET_ATTRIBUTE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR Attribute);
|
typedef EFI_STATUS (*PEFI_TEXT_SET_ATTRIBUTE)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR Attribute);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_CLEAR_SCREEN)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This);
|
typedef EFI_STATUS (*PEFI_TEXT_CLEAR_SCREEN)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_SET_CURSOR_POSITION)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR Column, IN UINT_PTR Row);
|
typedef EFI_STATUS (*PEFI_TEXT_SET_CURSOR_POSITION)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UINT_PTR Column, IN UINT_PTR Row);
|
||||||
typedef EFI_STATUS (*PEFI_TEXT_ENABLE_CURSOR)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN UCHAR Enable);
|
typedef EFI_STATUS (*PEFI_TEXT_ENABLE_CURSOR)(IN PEFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This, IN BOOLEAN Enable);
|
||||||
typedef EFI_STATUS (*PEFI_INPUT_RESET_EX)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, IN UCHAR ExtendedVerification);
|
typedef EFI_STATUS (*PEFI_INPUT_RESET_EX)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, IN BOOLEAN ExtendedVerification);
|
||||||
typedef EFI_STATUS (*PEFI_INPUT_READ_KEY_EX)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, OUT PEFI_KEY_DATA KeyData);
|
typedef EFI_STATUS (*PEFI_INPUT_READ_KEY_EX)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, OUT PEFI_KEY_DATA KeyData);
|
||||||
typedef EFI_STATUS (*PEFI_SET_STATE)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, IN PUINT8 KeyToggleState);
|
typedef EFI_STATUS (*PEFI_SET_STATE)(IN PEFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This, IN PUINT8 KeyToggleState);
|
||||||
typedef EFI_STATUS (*PEFI_KEY_NOTIFY_FUNCTION)(IN PEFI_KEY_DATA KeyData);
|
typedef EFI_STATUS (*PEFI_KEY_NOTIFY_FUNCTION)(IN PEFI_KEY_DATA KeyData);
|
||||||
@@ -737,11 +738,11 @@ typedef EFI_STATUS (*EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)(IN PEFI_PCI_IO_PROT
|
|||||||
typedef EFI_STATUS (*EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES)(IN PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This, OUT PUINT64 Supports, OUT PUINT64 Attributes);
|
typedef EFI_STATUS (*EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES)(IN PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This, OUT PUINT64 Supports, OUT PUINT64 Attributes);
|
||||||
typedef EFI_STATUS (*EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(IN PEFI_PCI_IO_PROTOCOL This, IN UINT64 Attributes, IN UINT8 BarIndex, IN OUT PUINT64 Offset, IN OUT PUINT64 Length);
|
typedef EFI_STATUS (*EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(IN PEFI_PCI_IO_PROTOCOL This, IN UINT64 Attributes, IN UINT8 BarIndex, IN OUT PUINT64 Offset, IN OUT PUINT64 Length);
|
||||||
typedef EFI_STATUS (*EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES)(IN PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This, IN UINT64 Attributes, IN OUT PUINT64 ResourceBase, IN OUT PUINT64 ResourceLength);
|
typedef EFI_STATUS (*EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES)(IN PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This, IN UINT64 Attributes, IN OUT PUINT64 ResourceBase, IN OUT PUINT64 ResourceLength);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_RESET)(IN PEFI_BLOCK_IO_PROTOCOL This, IN UCHAR ExtendedVerification);
|
typedef EFI_STATUS (*PEFI_BLOCK_RESET)(IN PEFI_BLOCK_IO_PROTOCOL This, IN BOOLEAN ExtendedVerification);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_READ)(IN PEFI_BLOCK_IO_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINT_PTR BufferSize, OUT PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_BLOCK_READ)(IN PEFI_BLOCK_IO_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINT_PTR BufferSize, OUT PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_WRITE)(IN PEFI_BLOCK_IO_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_BLOCK_WRITE)(IN PEFI_BLOCK_IO_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_FLUSH)(IN PEFI_BLOCK_IO_PROTOCOL This);
|
typedef EFI_STATUS (*PEFI_BLOCK_FLUSH)(IN PEFI_BLOCK_IO_PROTOCOL This);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_RESET_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN UCHAR ExtendedVerification);
|
typedef EFI_STATUS (*PEFI_BLOCK_RESET_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN BOOLEAN ExtendedVerification);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_READ_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN OUT PEFI_BLOCK_IO2_TOKEN Token, IN UINT_PTR BufferSize, OUT PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_BLOCK_READ_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN OUT PEFI_BLOCK_IO2_TOKEN Token, IN UINT_PTR BufferSize, OUT PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_WRITE_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN OUT PEFI_BLOCK_IO2_TOKEN Token, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_BLOCK_WRITE_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN UINT32 MediaId, IN EFI_LBA LBA, IN OUT PEFI_BLOCK_IO2_TOKEN Token, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_BLOCK_FLUSH_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN OUT PEFI_BLOCK_IO2_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_BLOCK_FLUSH_EX)(IN PEFI_BLOCK_IO2_PROTOCOL This, IN OUT PEFI_BLOCK_IO2_TOKEN Token);
|
||||||
@@ -752,7 +753,7 @@ typedef EFI_STATUS (*PEFI_DISK_READ_EX)(IN PEFI_DISK_IO2_PROTOCOL This, IN UINT3
|
|||||||
typedef EFI_STATUS (*PEFI_DISK_WRITE_EX)(IN PEFI_DISK_IO2_PROTOCOL This, IN UINT32 MediaId, IN UINT64 Offset, IN OUT PEFI_DISK_IO2_TOKEN Token, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_DISK_WRITE_EX)(IN PEFI_DISK_IO2_PROTOCOL This, IN UINT32 MediaId, IN UINT64 Offset, IN OUT PEFI_DISK_IO2_TOKEN Token, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_DISK_FLUSH_EX)(IN PEFI_DISK_IO2_PROTOCOL This, IN OUT PEFI_DISK_IO2_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_DISK_FLUSH_EX)(IN PEFI_DISK_IO2_PROTOCOL This, IN OUT PEFI_DISK_IO2_TOKEN Token);
|
||||||
typedef EFI_STATUS (*PEFI_VOLUME_OPEN)(IN PEFI_SIMPLE_FILE_SYSTEM_PROTOCOL This, OUT PEFI_FILE_HANDLE *Root);
|
typedef EFI_STATUS (*PEFI_VOLUME_OPEN)(IN PEFI_SIMPLE_FILE_SYSTEM_PROTOCOL This, OUT PEFI_FILE_HANDLE *Root);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_OPEN)(IN PEFI_FILE_HANDLE File, OUT PEFI_FILE_HANDLE *NewHandle, IN PUINT16 FileName, IN UINT64 OpenMode, IN UINT64 Attributes);
|
typedef EFI_STATUS (*PEFI_FILE_OPEN)(IN PEFI_FILE_HANDLE File, OUT PEFI_FILE_HANDLE *NewHandle, IN PWCHAR FileName, IN UINT64 OpenMode, IN UINT64 Attributes);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_CLOSE)(IN PEFI_FILE_HANDLE File);
|
typedef EFI_STATUS (*PEFI_FILE_CLOSE)(IN PEFI_FILE_HANDLE File);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_DELETE)(IN PEFI_FILE_HANDLE File);
|
typedef EFI_STATUS (*PEFI_FILE_DELETE)(IN PEFI_FILE_HANDLE File);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_READ)(IN PEFI_FILE_HANDLE File, IN OUT PUINT_PTR BufferSize, OUT PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_FILE_READ)(IN PEFI_FILE_HANDLE File, IN OUT PUINT_PTR BufferSize, OUT PVOID Buffer);
|
||||||
@@ -762,7 +763,7 @@ typedef EFI_STATUS (*PEFI_FILE_GET_POSITION)(IN PEFI_FILE_HANDLE File, OUT PUINT
|
|||||||
typedef EFI_STATUS (*PEFI_FILE_GET_INFO)(IN PEFI_FILE_HANDLE File, IN PEFI_GUID InformationType, IN OUT PUINT_PTR BufferSize, OUT PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_FILE_GET_INFO)(IN PEFI_FILE_HANDLE File, IN PEFI_GUID InformationType, IN OUT PUINT_PTR BufferSize, OUT PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_SET_INFO)(IN PEFI_FILE_HANDLE File, IN PEFI_GUID InformationType, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
typedef EFI_STATUS (*PEFI_FILE_SET_INFO)(IN PEFI_FILE_HANDLE File, IN PEFI_GUID InformationType, IN UINT_PTR BufferSize, IN PVOID Buffer);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_FLUSH)(IN PEFI_FILE_HANDLE File);
|
typedef EFI_STATUS (*PEFI_FILE_FLUSH)(IN PEFI_FILE_HANDLE File);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_OPEN_EX)(IN PEFI_FILE_HANDLE File, OUT PEFI_FILE_HANDLE *NewHandle, IN PUINT16 FileName, IN UINT64 OpenMode, IN UINT64 Attributes, IN OUT PEFI_FILE_IO_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_FILE_OPEN_EX)(IN PEFI_FILE_HANDLE File, OUT PEFI_FILE_HANDLE *NewHandle, IN PWCHAR FileName, IN UINT64 OpenMode, IN UINT64 Attributes, IN OUT PEFI_FILE_IO_TOKEN Token);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_READ_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_FILE_READ_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_WRITE_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_FILE_WRITE_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
||||||
typedef EFI_STATUS (*PEFI_FILE_FLUSH_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
typedef EFI_STATUS (*PEFI_FILE_FLUSH_EX)(IN PEFI_FILE_HANDLE File, IN OUT PEFI_FILE_IO_TOKEN Token);
|
||||||
@@ -806,10 +807,10 @@ typedef EFI_STATUS (*PEFI_SERVICE_BINDING_DESTROY_CHILD)(IN PEFI_SERVICE_BINDING
|
|||||||
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_SUPPORTED)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath);
|
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_SUPPORTED)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath);
|
||||||
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_START)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath);
|
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_START)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN PEFI_DEVICE_PATH_PROTOCOL RemainingDevicePath);
|
||||||
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_STOP)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN UINT_PTR NumberOfChildren, IN PEFI_HANDLE ChildHandleBuffer);
|
typedef EFI_STATUS (*PEFI_DRIVER_BINDING_PROTOCOL_STOP)(IN PEFI_DRIVER_BINDING_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN UINT_PTR NumberOfChildren, IN PEFI_HANDLE ChildHandleBuffer);
|
||||||
typedef EFI_STATUS (*PEFI_COMPONENT_NAME_GET_DRIVER_NAME)(IN PEFI_COMPONENT_NAME_PROTOCOL This, IN PUINT8 Language, OUT PUINT16 *DriverName);
|
typedef EFI_STATUS (*PEFI_COMPONENT_NAME_GET_DRIVER_NAME)(IN PEFI_COMPONENT_NAME_PROTOCOL This, IN PUINT8 Language, OUT PWCHAR *DriverName);
|
||||||
typedef EFI_STATUS (*PEFI_COMPONENT_NAME_GET_CONTROLLER_NAME)(IN PEFI_COMPONENT_NAME_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle, IN PUINT8 Language, OUT PUINT16 *ControllerName);
|
typedef EFI_STATUS (*PEFI_COMPONENT_NAME_GET_CONTROLLER_NAME)(IN PEFI_COMPONENT_NAME_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle, IN PUINT8 Language, OUT PWCHAR *ControllerName);
|
||||||
typedef EFI_STATUS (*PEFI_COMPONENT_NAME2_GET_DRIVER_NAME)(IN PEFI_COMPONENT_NAME2_PROTOCOL This, IN PUINT8 Language, OUT PUINT16 *DriverName);
|
typedef EFI_STATUS (*PEFI_COMPONENT_NAME2_GET_DRIVER_NAME)(IN PEFI_COMPONENT_NAME2_PROTOCOL This, IN PUINT8 Language, OUT PWCHAR *DriverName);
|
||||||
typedef EFI_STATUS (*PEFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)(IN PEFI_COMPONENT_NAME2_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle, IN PUINT8 Language, OUT PUINT16 *ControllerName);
|
typedef EFI_STATUS (*PEFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)(IN PEFI_COMPONENT_NAME2_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle, IN PUINT8 Language, OUT PWCHAR *ControllerName);
|
||||||
typedef EFI_STATUS (*PEFI_RNG_GET_INFO)(IN PEFI_RNG_PROTOCOL This, IN OUT PUINT_PTR RNGAlgorithmListSize, OUT PEFI_GUID RNGAlgorithmList);
|
typedef EFI_STATUS (*PEFI_RNG_GET_INFO)(IN PEFI_RNG_PROTOCOL This, IN OUT PUINT_PTR RNGAlgorithmListSize, OUT PEFI_GUID RNGAlgorithmList);
|
||||||
typedef EFI_STATUS (*PEFI_RNG_GET_RNG)(IN PEFI_RNG_PROTOCOL This, IN PEFI_GUID RNGAlgorithm, IN UINT_PTR RNGValueLength, OUT PUINT8 RNGValue);
|
typedef EFI_STATUS (*PEFI_RNG_GET_RNG)(IN PEFI_RNG_PROTOCOL This, IN PEFI_GUID RNGAlgorithm, IN UINT_PTR RNGValueLength, OUT PUINT8 RNGValue);
|
||||||
typedef EFI_STATUS (*PEFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER)(IN PEFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN OUT PEFI_HANDLE DriverImageHandle);
|
typedef EFI_STATUS (*PEFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER)(IN PEFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL This, IN EFI_HANDLE ControllerHandle, IN OUT PEFI_HANDLE DriverImageHandle);
|
||||||
@@ -845,7 +846,7 @@ typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_START)(IN PEFI_PXE_BASE_CODE_PROTOCOL Th
|
|||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_STOP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_STOP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_DHCP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UCHAR SortOffers);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_DHCP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UCHAR SortOffers);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_DISCOVER)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 Type, IN PUINT16 Layer, IN UCHAR UseBis, IN OUT PEFI_PXE_BASE_CODE_DISCOVER_INFO Info);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_DISCOVER)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 Type, IN PUINT16 Layer, IN UCHAR UseBis, IN OUT PEFI_PXE_BASE_CODE_DISCOVER_INFO Info);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_MTFTP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT PVOID *BufferPtr, IN UCHAR Overwrite, IN OUT PUINT64 BufferSize, IN PUINT_PTR BlockSize, IN PEFI_IP_ADDRESS ServerIp, IN PUINT8 Filename, IN PEFI_PXE_BASE_CODE_MTFTP_INFO Info, IN UCHAR DontUseBuffer);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_MTFTP)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT PVOID *BufferPtr, IN UCHAR Overwrite, IN OUT PUINT64 BufferSize, IN PUINT_PTR BlockSize, IN PEFI_IP_ADDRESS ServerIp, IN PWCHAR Filename, IN PEFI_PXE_BASE_CODE_MTFTP_INFO Info, IN UCHAR DontUseBuffer);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_UDP_WRITE)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 OpFlags, IN PEFI_IP_ADDRESS DestIp, IN PUINT16 DestPort, IN PEFI_IP_ADDRESS GatewayIp, IN PEFI_IP_ADDRESS SrcIp, IN OUT PUINT16 SrcPort, IN PUINT_PTR HeaderSize, IN PVOID HeaderPtr, IN PUINT_PTR BufferSize, IN PVOID BufferPtr);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_UDP_WRITE)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 OpFlags, IN PEFI_IP_ADDRESS DestIp, IN PUINT16 DestPort, IN PEFI_IP_ADDRESS GatewayIp, IN PEFI_IP_ADDRESS SrcIp, IN OUT PUINT16 SrcPort, IN PUINT_PTR HeaderSize, IN PVOID HeaderPtr, IN PUINT_PTR BufferSize, IN PVOID BufferPtr);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_UDP_READ)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 OpFlags, IN OUT PEFI_IP_ADDRESS DestIp, IN OUT PUINT16 DestPort, IN OUT PEFI_IP_ADDRESS SrcIp, IN OUT PUINT16 SrcPort, IN PUINT_PTR HeaderSize, IN PVOID HeaderPtr, IN OUT PUINT_PTR BufferSize, IN PVOID BufferPtr);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_UDP_READ)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN UINT16 OpFlags, IN OUT PEFI_IP_ADDRESS DestIp, IN OUT PUINT16 DestPort, IN OUT PEFI_IP_ADDRESS SrcIp, IN OUT PUINT16 SrcPort, IN PUINT_PTR HeaderSize, IN PVOID HeaderPtr, IN OUT PUINT_PTR BufferSize, IN PVOID BufferPtr);
|
||||||
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_SET_IP_FILTER)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN PEFI_PXE_BASE_CODE_IP_FILTER NewFilter);
|
typedef EFI_STATUS (*PEFI_PXE_BASE_CODE_SET_IP_FILTER)(IN PEFI_PXE_BASE_CODE_PROTOCOL This, IN PEFI_PXE_BASE_CODE_IP_FILTER NewFilter);
|
||||||
@@ -952,7 +953,7 @@ typedef struct _EFI_TIME_CAPABILITIES
|
|||||||
{
|
{
|
||||||
UINT32 Resolution;
|
UINT32 Resolution;
|
||||||
UINT32 Accuracy;
|
UINT32 Accuracy;
|
||||||
UCHAR SetsToZero;
|
BOOLEAN SetsToZero;
|
||||||
} EFI_TIME_CAPABILITIES, *PEFI_TIME_CAPABILITIES;
|
} EFI_TIME_CAPABILITIES, *PEFI_TIME_CAPABILITIES;
|
||||||
|
|
||||||
/* EFI Open Protocol Information Entry */
|
/* EFI Open Protocol Information Entry */
|
||||||
@@ -1072,14 +1073,14 @@ typedef struct _EFI_SIMPLE_TEXT_OUTPUT_MODE
|
|||||||
INT32 Attribute;
|
INT32 Attribute;
|
||||||
INT32 CursorColumn;
|
INT32 CursorColumn;
|
||||||
INT32 CursorRow;
|
INT32 CursorRow;
|
||||||
UCHAR CursorVisible;
|
BOOLEAN CursorVisible;
|
||||||
} EFI_SIMPLE_TEXT_OUTPUT_MODE, *PEFI_SIMPLE_TEXT_OUTPUT_MODE;
|
} EFI_SIMPLE_TEXT_OUTPUT_MODE, *PEFI_SIMPLE_TEXT_OUTPUT_MODE;
|
||||||
|
|
||||||
/* The keystroke information for the key that was pressed */
|
/* The keystroke information for the key that was pressed */
|
||||||
typedef struct _EFI_INPUT_KEY
|
typedef struct _EFI_INPUT_KEY
|
||||||
{
|
{
|
||||||
UINT16 ScanCode;
|
UINT16 ScanCode;
|
||||||
UINT16 UnicodeChar;
|
WCHAR UnicodeChar;
|
||||||
} EFI_INPUT_KEY, *PEFI_INPUT_KEY;
|
} EFI_INPUT_KEY, *PEFI_INPUT_KEY;
|
||||||
|
|
||||||
/* EFI Key State information */
|
/* EFI Key State information */
|
||||||
@@ -1111,7 +1112,7 @@ typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
|
|||||||
typedef struct _EFI_SYSTEM_TABLE
|
typedef struct _EFI_SYSTEM_TABLE
|
||||||
{
|
{
|
||||||
EFI_TABLE_HEADER Hdr;
|
EFI_TABLE_HEADER Hdr;
|
||||||
PUINT16 FirmwareVendor;
|
PWCHAR FirmwareVendor;
|
||||||
UINT32 FirmwareRevision;
|
UINT32 FirmwareRevision;
|
||||||
EFI_HANDLE ConsoleInHandle;
|
EFI_HANDLE ConsoleInHandle;
|
||||||
PEFI_SIMPLE_TEXT_INPUT_PROTOCOL ConIn;
|
PEFI_SIMPLE_TEXT_INPUT_PROTOCOL ConIn;
|
||||||
@@ -1458,7 +1459,7 @@ typedef struct _EFI_CDROM_DEVICE_PATH
|
|||||||
typedef struct _EFI_FILEPATH_DEVICE_PATH
|
typedef struct _EFI_FILEPATH_DEVICE_PATH
|
||||||
{
|
{
|
||||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||||
UINT16 PathName[1];
|
WCHAR PathName[1];
|
||||||
} EFI_FILEPATH_DEVICE_PATH, *PEFI_FILEPATH_DEVICE_PATH;
|
} EFI_FILEPATH_DEVICE_PATH, *PEFI_FILEPATH_DEVICE_PATH;
|
||||||
|
|
||||||
/* Media Protocol device path node */
|
/* Media Protocol device path node */
|
||||||
@@ -1687,11 +1688,11 @@ typedef struct _EFI_BLOCK_DEVICE_DATA
|
|||||||
typedef struct _EFI_BLOCK_IO_MEDIA
|
typedef struct _EFI_BLOCK_IO_MEDIA
|
||||||
{
|
{
|
||||||
UINT32 MediaId;
|
UINT32 MediaId;
|
||||||
UCHAR RemovableMedia;
|
BOOLEAN RemovableMedia;
|
||||||
UCHAR MediaPresent;
|
BOOLEAN MediaPresent;
|
||||||
UCHAR LogicalPartition;
|
BOOLEAN LogicalPartition;
|
||||||
UCHAR ReadOnly;
|
BOOLEAN ReadOnly;
|
||||||
UCHAR WriteCaching;
|
BOOLEAN WriteCaching;
|
||||||
UINT32 BlockSize;
|
UINT32 BlockSize;
|
||||||
UINT32 IoAlign;
|
UINT32 IoAlign;
|
||||||
EFI_LBA LastBlock;
|
EFI_LBA LastBlock;
|
||||||
@@ -1799,7 +1800,7 @@ typedef struct _EFI_FILE_INFO
|
|||||||
EFI_TIME LastAccessTime;
|
EFI_TIME LastAccessTime;
|
||||||
EFI_TIME ModificationTime;
|
EFI_TIME ModificationTime;
|
||||||
UINT64 Attribute;
|
UINT64 Attribute;
|
||||||
UINT16 FileName[1];
|
WCHAR FileName[1];
|
||||||
} EFI_FILE_INFO, *PEFI_FILE_INFO;
|
} EFI_FILE_INFO, *PEFI_FILE_INFO;
|
||||||
|
|
||||||
/* EFI File System Info structure */
|
/* EFI File System Info structure */
|
||||||
@@ -2321,7 +2322,7 @@ typedef struct _EFI_GPT_PARTITION_ENTRY
|
|||||||
EFI_LBA StartingLBA;
|
EFI_LBA StartingLBA;
|
||||||
EFI_LBA EndingLBA;
|
EFI_LBA EndingLBA;
|
||||||
UINT64 Attributes;
|
UINT64 Attributes;
|
||||||
UINT16 PartitionName[36];
|
WCHAR PartitionName[36];
|
||||||
} EFI_GPT_PARTITION_ENTRY, *PEFI_GPT_PARTITION_ENTRY;
|
} EFI_GPT_PARTITION_ENTRY, *PEFI_GPT_PARTITION_ENTRY;
|
||||||
|
|
||||||
/* EFI file header */
|
/* EFI file header */
|
||||||
|
@@ -11,24 +11,23 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of library source code files
|
# Specify list of library source code files
|
||||||
list(APPEND LIBXTLDR_SOURCE
|
list(APPEND LIBXTLDR_SOURCE
|
||||||
${XTLDR_SOURCE_DIR}/library/modproto.c)
|
${XTLDR_SOURCE_DIR}/library/modproto.cc)
|
||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_SOURCE
|
list(APPEND XTLDR_SOURCE
|
||||||
${XTLDR_SOURCE_DIR}/arch/${ARCH}/memory.c
|
${XTLDR_SOURCE_DIR}/arch/${ARCH}/memory.cc
|
||||||
${XTLDR_SOURCE_DIR}/bootutil.c
|
${XTLDR_SOURCE_DIR}/bootutil.cc
|
||||||
${XTLDR_SOURCE_DIR}/config.c
|
${XTLDR_SOURCE_DIR}/config.cc
|
||||||
${XTLDR_SOURCE_DIR}/console.c
|
${XTLDR_SOURCE_DIR}/console.cc
|
||||||
${XTLDR_SOURCE_DIR}/debug.c
|
${XTLDR_SOURCE_DIR}/data.cc
|
||||||
${XTLDR_SOURCE_DIR}/efiutils.c
|
${XTLDR_SOURCE_DIR}/debug.cc
|
||||||
${XTLDR_SOURCE_DIR}/globals.c
|
${XTLDR_SOURCE_DIR}/efiutils.cc
|
||||||
${XTLDR_SOURCE_DIR}/hardware.c
|
${XTLDR_SOURCE_DIR}/memory.cc
|
||||||
${XTLDR_SOURCE_DIR}/memory.c
|
${XTLDR_SOURCE_DIR}/protocol.cc
|
||||||
${XTLDR_SOURCE_DIR}/protocol.c
|
${XTLDR_SOURCE_DIR}/shell.cc
|
||||||
${XTLDR_SOURCE_DIR}/shell.c
|
${XTLDR_SOURCE_DIR}/textui.cc
|
||||||
${XTLDR_SOURCE_DIR}/textui.c
|
${XTLDR_SOURCE_DIR}/volume.cc
|
||||||
${XTLDR_SOURCE_DIR}/volume.c
|
${XTLDR_SOURCE_DIR}/xtldr.cc)
|
||||||
${XTLDR_SOURCE_DIR}/xtldr.c)
|
|
||||||
|
|
||||||
# Link static XTLDR library
|
# Link static XTLDR library
|
||||||
add_library(libxtldr ${LIBXTLDR_SOURCE})
|
add_library(libxtldr ${LIBXTLDR_SOURCE})
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/arch/amd64/memory.c
|
* FILE: xtldr/arch/amd64/memory.cc
|
||||||
* DESCRIPTION: XT Boot Loader AMD64 specific memory management
|
* DESCRIPTION: XT Boot Loader AMD64 specific memory management
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
* Aiken Harris <harraiken91@gmail.com>
|
* Aiken Harris <harraiken91@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,17 +25,19 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::BuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN ULONG_PTR SelfMapAddress)
|
IN ULONG_PTR SelfMapAddress)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListEntry, ModulesList, ModulesListEntry;
|
PLIST_ENTRY ListEntry, ModulesList, ModulesListEntry;
|
||||||
PXTBL_MEMORY_MAPPING Mapping;
|
PXTBL_MEMORY_MAPPING Mapping;
|
||||||
PXTBL_MODULE_INFO ModuleInfo;
|
PXTBL_MODULE_INFO ModuleInfo;
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
|
PVOID LoaderBase;
|
||||||
|
ULONGLONG LoaderSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Allocate pages for the Page Map */
|
/* Allocate pages for the Page Map */
|
||||||
Status = BlAllocateMemoryPages(1, &Address);
|
Status = AllocatePages(AllocateAnyPages, 1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -44,18 +46,27 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
/* Assign and zero-fill memory used by page mappings */
|
/* Assign and zero-fill memory used by page mappings */
|
||||||
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
||||||
RtlZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
RTL::Memory::ZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
||||||
|
|
||||||
/* Add page mapping itself to memory mapping */
|
/* Add page mapping itself to memory mapping */
|
||||||
Status = BlpSelfMapPml(PageMap, SelfMapAddress);
|
Status = Memory::SelfMapPml(PageMap, SelfMapAddress);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* PML mapping failed */
|
/* PML mapping failed */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Map the trampoline code area */
|
||||||
|
Status = MapVirtualMemory(PageMap, (PVOID)MM_TRAMPOLINE_ADDRESS,(PVOID)MM_TRAMPOLINE_ADDRESS,
|
||||||
|
1, LoaderFirmwareTemporary);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Mapping trampoline code failed */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get list of XTLDR modules */
|
/* Get list of XTLDR modules */
|
||||||
ModulesList = BlGetModulesList();
|
ModulesList = Protocol::GetModulesList();
|
||||||
ModulesListEntry = ModulesList->Flink;
|
ModulesListEntry = ModulesList->Flink;
|
||||||
while(ModulesListEntry != ModulesList)
|
while(ModulesListEntry != ModulesList)
|
||||||
{
|
{
|
||||||
@@ -63,7 +74,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
ModuleInfo = CONTAIN_RECORD(ModulesListEntry, XTBL_MODULE_INFO, Flink);
|
ModuleInfo = CONTAIN_RECORD(ModulesListEntry, XTBL_MODULE_INFO, Flink);
|
||||||
|
|
||||||
/* Map module code */
|
/* Map module code */
|
||||||
Status = BlMapVirtualMemory(PageMap, ModuleInfo->ModuleBase, ModuleInfo->ModuleBase,
|
Status = MapVirtualMemory(PageMap, ModuleInfo->ModuleBase, ModuleInfo->ModuleBase,
|
||||||
EFI_SIZE_TO_PAGES(ModuleInfo->ModuleSize), LoaderFirmwareTemporary);
|
EFI_SIZE_TO_PAGES(ModuleInfo->ModuleSize), LoaderFirmwareTemporary);
|
||||||
|
|
||||||
/* Check if mapping succeeded */
|
/* Check if mapping succeeded */
|
||||||
@@ -77,12 +88,15 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
ModulesListEntry = ModulesListEntry->Flink;
|
ModulesListEntry = ModulesListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get boot loader image information */
|
||||||
|
XtLoader::GetLoaderImageInformation(&LoaderBase, &LoaderSize);
|
||||||
|
|
||||||
/* Make sure boot loader image base and size are set */
|
/* Make sure boot loader image base and size are set */
|
||||||
if(BlpStatus.LoaderBase && BlpStatus.LoaderSize)
|
if(LoaderBase && LoaderSize)
|
||||||
{
|
{
|
||||||
/* Map boot loader code as well */
|
/* Map boot loader code as well */
|
||||||
Status = BlMapVirtualMemory(PageMap, BlpStatus.LoaderBase, BlpStatus.LoaderBase,
|
Status = MapVirtualMemory(PageMap, LoaderBase, LoaderBase,
|
||||||
EFI_SIZE_TO_PAGES(BlpStatus.LoaderSize), LoaderFirmwareTemporary);
|
EFI_SIZE_TO_PAGES(LoaderSize), LoaderFirmwareTemporary);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Mapping boot loader code failed */
|
/* Mapping boot loader code failed */
|
||||||
@@ -96,7 +110,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate through and map all the mappings*/
|
/* Iterate through and map all the mappings*/
|
||||||
BlDebugPrint(L"Mapping and dumping EFI memory:\n");
|
Debug::Print(L"Mapping and dumping EFI memory:\n");
|
||||||
ListEntry = PageMap->MemoryMap.Flink;
|
ListEntry = PageMap->MemoryMap.Flink;
|
||||||
while(ListEntry != &PageMap->MemoryMap)
|
while(ListEntry != &PageMap->MemoryMap)
|
||||||
{
|
{
|
||||||
@@ -107,11 +121,11 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(Mapping->VirtualAddress)
|
if(Mapping->VirtualAddress)
|
||||||
{
|
{
|
||||||
/* Dump memory mapping */
|
/* Dump memory mapping */
|
||||||
BlDebugPrint(L" Type=%02lu, PhysicalBase=%.16P, VirtualBase=%.16P, Pages=%llu\n", Mapping->MemoryType,
|
Debug::Print(L" Type=%02lu, PhysicalBase=%.16P, VirtualBase=%.16P, Pages=%llu\n", Mapping->MemoryType,
|
||||||
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
|
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
|
||||||
|
|
||||||
/* Map memory */
|
/* Map memory */
|
||||||
Status = BlMapPage(PageMap, (UINT_PTR)Mapping->VirtualAddress,
|
Status = MapPage(PageMap, (UINT_PTR)Mapping->VirtualAddress,
|
||||||
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages);
|
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -128,114 +142,6 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does the actual virtual memory mapping.
|
|
||||||
*
|
|
||||||
* @param PageMap
|
|
||||||
* Supplies a pointer to the page mapping structure.
|
|
||||||
*
|
|
||||||
* @param VirtualAddress
|
|
||||||
* Supplies a virtual address of the mapping.
|
|
||||||
*
|
|
||||||
* @param PhysicalAddress
|
|
||||||
* Supplies a physical address of the mapping.
|
|
||||||
*
|
|
||||||
* @param NumberOfPages
|
|
||||||
* Supplies a number of the pages of the mapping.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN ULONG_PTR VirtualAddress,
|
|
||||||
IN ULONG_PTR PhysicalAddress,
|
|
||||||
IN ULONG NumberOfPages)
|
|
||||||
{
|
|
||||||
PVOID Pml1, Pml2, Pml3, Pml4, Pml5;
|
|
||||||
SIZE_T Pml1Entry, Pml2Entry, Pml3Entry, Pml4Entry, Pml5Entry;
|
|
||||||
PHARDWARE_PTE PmlTable;
|
|
||||||
SIZE_T PageFrameNumber;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
/* Set the Page Frame Number (PFN) */
|
|
||||||
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
|
||||||
|
|
||||||
/* Do the recursive mapping */
|
|
||||||
while(NumberOfPages > 0)
|
|
||||||
{
|
|
||||||
/* Calculate the indices in the various Page Tables from the virtual address */
|
|
||||||
Pml5Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_LA57_SHIFT)) >> MM_LA57_SHIFT;
|
|
||||||
Pml4Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PXI_SHIFT)) >> MM_PXI_SHIFT;
|
|
||||||
Pml3Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PPI_SHIFT)) >> MM_PPI_SHIFT;
|
|
||||||
Pml2Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PDI_SHIFT)) >> MM_PDI_SHIFT;
|
|
||||||
Pml1Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PTI_SHIFT)) >> MM_PTI_SHIFT;
|
|
||||||
|
|
||||||
/* Check page map level */
|
|
||||||
if(PageMap->PageMapLevel == 5)
|
|
||||||
{
|
|
||||||
/* Five level Page Map */
|
|
||||||
Pml5 = PageMap->PtePointer;
|
|
||||||
|
|
||||||
/* Get PML4 */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml5, Pml5Entry, &Pml4);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory mapping failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Four level Page Map */
|
|
||||||
Pml4 = PageMap->PtePointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get PML3 */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml4, Pml4Entry, &Pml3);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory mapping failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get PML 2 */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml3, Pml3Entry, &Pml2);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory mapping failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get PML1 */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory mapping failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set paging entry settings */
|
|
||||||
PmlTable = (PHARDWARE_PTE)Pml1;
|
|
||||||
RtlZeroMemory(&PmlTable[Pml1Entry], sizeof(HARDWARE_PTE));
|
|
||||||
PmlTable[Pml1Entry].PageFrameNumber = PageFrameNumber;
|
|
||||||
PmlTable[Pml1Entry].Valid = 1;
|
|
||||||
PmlTable[Pml1Entry].Writable = 1;
|
|
||||||
|
|
||||||
/* Take next virtual address and PFN */
|
|
||||||
VirtualAddress += EFI_PAGE_SIZE;
|
|
||||||
PageFrameNumber++;
|
|
||||||
|
|
||||||
/* Decrease number of pages left */
|
|
||||||
NumberOfPages--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns next level of the Page Table.
|
* Returns next level of the Page Table.
|
||||||
*
|
*
|
||||||
@@ -257,7 +163,7 @@ BlMapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::GetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID PageTable,
|
IN PVOID PageTable,
|
||||||
IN SIZE_T Entry,
|
IN SIZE_T Entry,
|
||||||
OUT PVOID *NextPageTable)
|
OUT PVOID *NextPageTable)
|
||||||
@@ -279,7 +185,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allocate pages for new PML entry */
|
/* Allocate pages for new PML entry */
|
||||||
Status = BlAllocateMemoryPages(1, &Address);
|
Status = AllocatePages(AllocateAnyPages, 1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -287,7 +193,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add new memory mapping */
|
/* Add new memory mapping */
|
||||||
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
|
Status = MapVirtualMemory(PageMap, NULLPTR, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory mapping failure */
|
/* Memory mapping failure */
|
||||||
@@ -295,7 +201,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fill allocated memory with zeros */
|
/* Fill allocated memory with zeros */
|
||||||
RtlZeroMemory((PVOID)(ULONGLONG)Address, EFI_PAGE_SIZE);
|
RTL::Memory::ZeroMemory((PVOID)(ULONGLONG)Address, EFI_PAGE_SIZE);
|
||||||
|
|
||||||
/* Set paging entry settings */
|
/* Set paging entry settings */
|
||||||
PmlTable[Entry].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
PmlTable[Entry].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
||||||
@@ -311,6 +217,114 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the actual virtual memory mapping.
|
||||||
|
*
|
||||||
|
* @param PageMap
|
||||||
|
* Supplies a pointer to the page mapping structure.
|
||||||
|
*
|
||||||
|
* @param VirtualAddress
|
||||||
|
* Supplies a virtual address of the mapping.
|
||||||
|
*
|
||||||
|
* @param PhysicalAddress
|
||||||
|
* Supplies a physical address of the mapping.
|
||||||
|
*
|
||||||
|
* @param NumberOfPages
|
||||||
|
* Supplies a number of the pages of the mapping.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Memory::MapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN ULONG_PTR VirtualAddress,
|
||||||
|
IN ULONG_PTR PhysicalAddress,
|
||||||
|
IN ULONG NumberOfPages)
|
||||||
|
{
|
||||||
|
PVOID Pml1, Pml2, Pml3, Pml4, Pml5;
|
||||||
|
SIZE_T Pml1Entry, Pml2Entry, Pml3Entry, Pml4Entry, Pml5Entry;
|
||||||
|
PHARDWARE_PTE PmlTable;
|
||||||
|
SIZE_T PageFrameNumber;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Set the Page Frame Number (PFN) */
|
||||||
|
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
||||||
|
|
||||||
|
/* Do the recursive mapping */
|
||||||
|
while(NumberOfPages > 0)
|
||||||
|
{
|
||||||
|
/* Calculate the indices in the various Page Tables from the virtual address */
|
||||||
|
Pml5Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_P5I_SHIFT)) >> MM_P5I_SHIFT;
|
||||||
|
Pml4Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PXI_SHIFT)) >> MM_PXI_SHIFT;
|
||||||
|
Pml3Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PPI_SHIFT)) >> MM_PPI_SHIFT;
|
||||||
|
Pml2Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PDI_SHIFT)) >> MM_PDI_SHIFT;
|
||||||
|
Pml1Entry = (VirtualAddress & ((ULONGLONG)0x1FF << MM_PTI_SHIFT)) >> MM_PTI_SHIFT;
|
||||||
|
|
||||||
|
/* Check page map level */
|
||||||
|
if(PageMap->PageMapLevel == 5)
|
||||||
|
{
|
||||||
|
/* Five level Page Map */
|
||||||
|
Pml5 = PageMap->PtePointer;
|
||||||
|
|
||||||
|
/* Get PML4 */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml5, Pml5Entry, &Pml4);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory mapping failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Four level Page Map */
|
||||||
|
Pml4 = PageMap->PtePointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get PML3 */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml4, Pml4Entry, &Pml3);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory mapping failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get PML 2 */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml3, Pml3Entry, &Pml2);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory mapping failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get PML1 */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory mapping failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set paging entry settings */
|
||||||
|
PmlTable = (PHARDWARE_PTE)Pml1;
|
||||||
|
RTL::Memory::ZeroMemory(&PmlTable[Pml1Entry], sizeof(HARDWARE_PTE));
|
||||||
|
PmlTable[Pml1Entry].PageFrameNumber = PageFrameNumber;
|
||||||
|
PmlTable[Pml1Entry].Valid = 1;
|
||||||
|
PmlTable[Pml1Entry].Writable = 1;
|
||||||
|
|
||||||
|
/* Take next virtual address and PFN */
|
||||||
|
VirtualAddress += EFI_PAGE_SIZE;
|
||||||
|
PageFrameNumber++;
|
||||||
|
|
||||||
|
/* Decrease number of pages left */
|
||||||
|
NumberOfPages--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a recursive self mapping for all PML levels.
|
* Creates a recursive self mapping for all PML levels.
|
||||||
*
|
*
|
||||||
@@ -326,7 +340,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::SelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN ULONG_PTR SelfMapAddress)
|
IN ULONG_PTR SelfMapAddress)
|
||||||
{
|
{
|
||||||
PHARDWARE_PTE PmlBase;
|
PHARDWARE_PTE PmlBase;
|
||||||
@@ -338,21 +352,20 @@ BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
/* Check page map level */
|
/* Check page map level */
|
||||||
if(PageMap->PageMapLevel == 5)
|
if(PageMap->PageMapLevel == 5)
|
||||||
{
|
{
|
||||||
/* Self-mapping for PML5 is not supported */
|
/* Calculate PML index based on provided self map address for PML5 */
|
||||||
BlDebugPrint(L"PML5 self-mapping not supported yet!\n");
|
PmlIndex = (SelfMapAddress >> MM_P5I_SHIFT) & 0x1FF;
|
||||||
return STATUS_EFI_UNSUPPORTED;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Calculate PML index based on provided self map address */
|
/* Calculate PML index based on provided self map address for PML4 */
|
||||||
PmlIndex = (SelfMapAddress >> MM_PXI_SHIFT) & 0x1FF;
|
PmlIndex = (SelfMapAddress >> MM_PXI_SHIFT) & 0x1FF;
|
||||||
|
}
|
||||||
|
|
||||||
/* Add self-mapping for PML4 */
|
/* Add self-mapping */
|
||||||
RtlZeroMemory(&PmlBase[PmlIndex], sizeof(HARDWARE_PTE));
|
RTL::Memory::ZeroMemory(&PmlBase[PmlIndex], sizeof(HARDWARE_PTE));
|
||||||
PmlBase[PmlIndex].PageFrameNumber = (UINT_PTR)PageMap->PtePointer / EFI_PAGE_SIZE;
|
PmlBase[PmlIndex].PageFrameNumber = (UINT_PTR)PageMap->PtePointer / EFI_PAGE_SIZE;
|
||||||
PmlBase[PmlIndex].Valid = 1;
|
PmlBase[PmlIndex].Valid = 1;
|
||||||
PmlBase[PmlIndex].Writable = 1;
|
PmlBase[PmlIndex].Writable = 1;
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/arch/i686/memory.c
|
* FILE: xtldr/arch/i686/memory.cc
|
||||||
* DESCRIPTION: XT Boot Loader i686 specific memory management
|
* DESCRIPTION: XT Boot Loader i686 specific memory management
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
* Aiken Harris <harraiken91@gmail.com>
|
* Aiken Harris <harraiken91@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,13 +22,15 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::BuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN ULONG_PTR SelfMapAddress)
|
IN ULONG_PTR SelfMapAddress)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListEntry, ModulesList, ModulesListEntry;
|
PLIST_ENTRY ListEntry, ModulesList, ModulesListEntry;
|
||||||
EFI_PHYSICAL_ADDRESS Address, DirectoryAddress;
|
EFI_PHYSICAL_ADDRESS Address, DirectoryAddress;
|
||||||
PXTBL_MODULE_INFO ModuleInfo;
|
PXTBL_MODULE_INFO ModuleInfo;
|
||||||
PXTBL_MEMORY_MAPPING Mapping;
|
PXTBL_MEMORY_MAPPING Mapping;
|
||||||
|
PVOID LoaderBase;
|
||||||
|
ULONGLONG LoaderSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
@@ -36,7 +38,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(PageMap->PageMapLevel == 3)
|
if(PageMap->PageMapLevel == 3)
|
||||||
{
|
{
|
||||||
/* Allocate a page for the 3-level page map structure (PAE enabled) */
|
/* Allocate a page for the 3-level page map structure (PAE enabled) */
|
||||||
Status = BlAllocateMemoryPages(1, &Address);
|
Status = AllocatePages(AllocateAnyPages, 1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failed, cannot proceed with page map creation */
|
/* Memory allocation failed, cannot proceed with page map creation */
|
||||||
@@ -45,10 +47,10 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
/* Assign the allocated page to the page map and zero it out */
|
/* Assign the allocated page to the page map and zero it out */
|
||||||
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
||||||
RtlZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
RTL::Memory::ZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
||||||
|
|
||||||
/* Allocate 4 pages for the Page Directories (PDs) */
|
/* Allocate 4 pages for the Page Directories (PDs) */
|
||||||
Status = BlAllocateMemoryPages(4, &DirectoryAddress);
|
Status = AllocatePages(AllocateAnyPages, 4, &DirectoryAddress);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failed, cannot proceed with page map creation */
|
/* Memory allocation failed, cannot proceed with page map creation */
|
||||||
@@ -56,21 +58,21 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Zero-fill the allocated memory for the Page Directories */
|
/* Zero-fill the allocated memory for the Page Directories */
|
||||||
RtlZeroMemory((PVOID)DirectoryAddress, EFI_PAGE_SIZE * 4);
|
RTL::Memory::ZeroMemory((PVOID)DirectoryAddress, EFI_PAGE_SIZE * 4);
|
||||||
|
|
||||||
/* Fill the PDPT with pointers to the Page Directories */
|
/* Fill the PDPT with pointers to the Page Directories */
|
||||||
for(Index = 0; Index < 4; Index++)
|
for(Index = 0; Index < 4; Index++)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&((PHARDWARE_PTE)PageMap->PtePointer)[Index], sizeof(HARDWARE_PTE));
|
RTL::Memory::ZeroMemory(&((PHARDWARE_MODERN_PTE)PageMap->PtePointer)[Index], sizeof(HARDWARE_MODERN_PTE));
|
||||||
((PHARDWARE_PTE)PageMap->PtePointer)[Index].PageFrameNumber = DirectoryAddress / EFI_PAGE_SIZE;
|
((PHARDWARE_MODERN_PTE)PageMap->PtePointer)[Index].PageFrameNumber = DirectoryAddress / EFI_PAGE_SIZE;
|
||||||
((PHARDWARE_PTE)PageMap->PtePointer)[Index].Valid = 1;
|
((PHARDWARE_MODERN_PTE)PageMap->PtePointer)[Index].Valid = 1;
|
||||||
DirectoryAddress += EFI_PAGE_SIZE;
|
DirectoryAddress += EFI_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allocate a page for the 2-level page map structure (PAE disabled) */
|
/* Allocate a page for the 2-level page map structure (PAE disabled) */
|
||||||
Status = BlAllocateMemoryPages(1, &Address);
|
Status = AllocatePages(AllocateAnyPages, 1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failed, cannot proceed with page map creation */
|
/* Memory allocation failed, cannot proceed with page map creation */
|
||||||
@@ -79,19 +81,28 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
/* Assign the allocated page to the page map and zero it out */
|
/* Assign the allocated page to the page map and zero it out */
|
||||||
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
PageMap->PtePointer = (PVOID)(UINT_PTR)Address;
|
||||||
RtlZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
RTL::Memory::ZeroMemory(PageMap->PtePointer, EFI_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add page mapping itself to memory mapping */
|
/* Add page mapping itself to memory mapping */
|
||||||
Status = BlpSelfMapPml(PageMap, SelfMapAddress);
|
Status = SelfMapPml(PageMap, SelfMapAddress);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* PML mapping failed */
|
/* PML mapping failed */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Map the trampoline code area */
|
||||||
|
Status = MapVirtualMemory(PageMap, (PVOID)MM_TRAMPOLINE_ADDRESS,(PVOID)MM_TRAMPOLINE_ADDRESS,
|
||||||
|
1, LoaderFirmwareTemporary);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Mapping trampoline code failed */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get list of XTLDR modules */
|
/* Get list of XTLDR modules */
|
||||||
ModulesList = BlGetModulesList();
|
ModulesList = Protocol::GetModulesList();
|
||||||
ModulesListEntry = ModulesList->Flink;
|
ModulesListEntry = ModulesList->Flink;
|
||||||
while(ModulesListEntry != ModulesList)
|
while(ModulesListEntry != ModulesList)
|
||||||
{
|
{
|
||||||
@@ -99,7 +110,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
ModuleInfo = CONTAIN_RECORD(ModulesListEntry, XTBL_MODULE_INFO, Flink);
|
ModuleInfo = CONTAIN_RECORD(ModulesListEntry, XTBL_MODULE_INFO, Flink);
|
||||||
|
|
||||||
/* Map module code */
|
/* Map module code */
|
||||||
Status = BlMapVirtualMemory(PageMap, ModuleInfo->ModuleBase, ModuleInfo->ModuleBase,
|
Status = MapVirtualMemory(PageMap, ModuleInfo->ModuleBase, ModuleInfo->ModuleBase,
|
||||||
EFI_SIZE_TO_PAGES(ModuleInfo->ModuleSize), LoaderFirmwareTemporary);
|
EFI_SIZE_TO_PAGES(ModuleInfo->ModuleSize), LoaderFirmwareTemporary);
|
||||||
|
|
||||||
/* Check if mapping succeeded */
|
/* Check if mapping succeeded */
|
||||||
@@ -113,12 +124,15 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
ModulesListEntry = ModulesListEntry->Flink;
|
ModulesListEntry = ModulesListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get boot loader image information */
|
||||||
|
XtLoader::GetLoaderImageInformation(&LoaderBase, &LoaderSize);
|
||||||
|
|
||||||
/* Make sure boot loader image base and size are set */
|
/* Make sure boot loader image base and size are set */
|
||||||
if(BlpStatus.LoaderBase && BlpStatus.LoaderSize)
|
if(LoaderBase && LoaderSize)
|
||||||
{
|
{
|
||||||
/* Map boot loader code as well */
|
/* Map boot loader code as well */
|
||||||
Status = BlMapVirtualMemory(PageMap, BlpStatus.LoaderBase, BlpStatus.LoaderBase,
|
Status = MapVirtualMemory(PageMap, LoaderBase, LoaderBase,
|
||||||
EFI_SIZE_TO_PAGES(BlpStatus.LoaderSize), LoaderFirmwareTemporary);
|
EFI_SIZE_TO_PAGES(LoaderSize), LoaderFirmwareTemporary);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Mapping boot loader code failed */
|
/* Mapping boot loader code failed */
|
||||||
@@ -132,7 +146,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate through and map all the mappings*/
|
/* Iterate through and map all the mappings*/
|
||||||
BlDebugPrint(L"Mapping and dumping EFI memory:\n");
|
Debug::Print(L"Mapping and dumping EFI memory:\n");
|
||||||
ListEntry = PageMap->MemoryMap.Flink;
|
ListEntry = PageMap->MemoryMap.Flink;
|
||||||
while(ListEntry != &PageMap->MemoryMap)
|
while(ListEntry != &PageMap->MemoryMap)
|
||||||
{
|
{
|
||||||
@@ -143,11 +157,11 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(Mapping->VirtualAddress)
|
if(Mapping->VirtualAddress)
|
||||||
{
|
{
|
||||||
/* Dump memory mapping */
|
/* Dump memory mapping */
|
||||||
BlDebugPrint(L" Type=%02lu, PhysicalBase=%.8P, VirtualBase=%.8P, Pages=%llu\n", Mapping->MemoryType,
|
Debug::Print(L" Type=%02lu, PhysicalBase=%.8P, VirtualBase=%.8P, Pages=%llu\n", Mapping->MemoryType,
|
||||||
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
|
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
|
||||||
|
|
||||||
/* Map memory */
|
/* Map memory */
|
||||||
Status = BlMapPage(PageMap, (UINT_PTR)Mapping->VirtualAddress,
|
Status = MapPage(PageMap, (UINT_PTR)Mapping->VirtualAddress,
|
||||||
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages);
|
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -164,116 +178,6 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does the actual virtual memory mapping.
|
|
||||||
*
|
|
||||||
* @param PageMap
|
|
||||||
* Supplies a pointer to the page mapping structure.
|
|
||||||
*
|
|
||||||
* @param VirtualAddress
|
|
||||||
* Supplies a virtual address of the mapping.
|
|
||||||
*
|
|
||||||
* @param PhysicalAddress
|
|
||||||
* Supplies a physical address of the mapping.
|
|
||||||
*
|
|
||||||
* @param NumberOfPages
|
|
||||||
* Supplies a number of the pages of the mapping.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN ULONG_PTR VirtualAddress,
|
|
||||||
IN ULONG_PTR PhysicalAddress,
|
|
||||||
IN ULONG NumberOfPages)
|
|
||||||
{
|
|
||||||
SIZE_T PageFrameNumber;
|
|
||||||
PVOID Pml1, Pml2, Pml3;
|
|
||||||
SIZE_T Pml1Entry, Pml2Entry, Pml3Entry;
|
|
||||||
PHARDWARE_PTE PmlTable;
|
|
||||||
PHARDWARE_LEGACY_PTE LegacyPmlTable;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
/* Set the Page Frame Number (PFN) */
|
|
||||||
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
|
||||||
|
|
||||||
/* Map all requested pages */
|
|
||||||
while(NumberOfPages > 0)
|
|
||||||
{
|
|
||||||
/* Check the paging mode to use the correct page table structure */
|
|
||||||
if(PageMap->PageMapLevel == 3)
|
|
||||||
{
|
|
||||||
/* Calculate the indices for PAE page tables */
|
|
||||||
Pml3Entry = (VirtualAddress >> 30) & 0x3;
|
|
||||||
Pml2Entry = (VirtualAddress >> 21) & 0x1FF;
|
|
||||||
Pml1Entry = (VirtualAddress >> 12) & 0x1FF;
|
|
||||||
|
|
||||||
/* Get Page Directory Pointer Table (PML3) */
|
|
||||||
Pml3 = PageMap->PtePointer;
|
|
||||||
|
|
||||||
/* Get Page Directory (PML2) */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml3, Pml3Entry, &Pml2);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to get the Page Table, abort mapping */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get Page Table (PML1) */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to get the Page Table, abort mapping */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the 64-bit PTE entry */
|
|
||||||
PmlTable = (PHARDWARE_PTE)Pml1;
|
|
||||||
RtlZeroMemory(&PmlTable[Pml1Entry], sizeof(HARDWARE_PTE));
|
|
||||||
PmlTable[Pml1Entry].PageFrameNumber = PageFrameNumber;
|
|
||||||
PmlTable[Pml1Entry].Valid = 1;
|
|
||||||
PmlTable[Pml1Entry].Writable = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Calculate the indices for non-PAE page tables */
|
|
||||||
Pml2Entry = (VirtualAddress >> 22) & 0x3FF;
|
|
||||||
Pml1Entry = (VirtualAddress >> 12) & 0x3FF;
|
|
||||||
|
|
||||||
/* Get Page Directory (PML2) */
|
|
||||||
Pml2 = PageMap->PtePointer;
|
|
||||||
|
|
||||||
/* Get Page Table (PML1) */
|
|
||||||
Status = BlpGetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to get the Page Table, abort mapping */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the 32-bit PTE entry */
|
|
||||||
LegacyPmlTable = (PHARDWARE_LEGACY_PTE)Pml1;
|
|
||||||
RtlZeroMemory(&LegacyPmlTable[Pml1Entry], sizeof(HARDWARE_LEGACY_PTE));
|
|
||||||
LegacyPmlTable[Pml1Entry].PageFrameNumber = (UINT32)PageFrameNumber;
|
|
||||||
LegacyPmlTable[Pml1Entry].Valid = 1;
|
|
||||||
LegacyPmlTable[Pml1Entry].Writable = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Take next virtual address and PFN */
|
|
||||||
VirtualAddress += EFI_PAGE_SIZE;
|
|
||||||
PageFrameNumber++;
|
|
||||||
|
|
||||||
/* Decrease number of pages left */
|
|
||||||
NumberOfPages--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns next level of the Page Table.
|
* Returns next level of the Page Table.
|
||||||
*
|
*
|
||||||
@@ -295,7 +199,7 @@ BlMapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::GetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID PageTable,
|
IN PVOID PageTable,
|
||||||
IN SIZE_T Entry,
|
IN SIZE_T Entry,
|
||||||
OUT PVOID *NextPageTable)
|
OUT PVOID *NextPageTable)
|
||||||
@@ -304,14 +208,14 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
ULONGLONG PmlPointer = 0;
|
ULONGLONG PmlPointer = 0;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PHARDWARE_LEGACY_PTE LegacyPmlTable;
|
PHARDWARE_LEGACY_PTE LegacyPmlTable;
|
||||||
PHARDWARE_PTE PmlTable;
|
PHARDWARE_MODERN_PTE PmlTable;
|
||||||
BOOLEAN ValidPte = FALSE;
|
BOOLEAN ValidPte = FALSE;
|
||||||
|
|
||||||
/* Check page map level to determine PTE size */
|
/* Check page map level to determine PTE size */
|
||||||
if(PageMap->PageMapLevel >= 3)
|
if(PageMap->PageMapLevel >= 3)
|
||||||
{
|
{
|
||||||
/* 64-bit PTE for PML3 (PAE enabled) */
|
/* 64-bit PTE for PML3 (PAE enabled) */
|
||||||
PmlTable = (PHARDWARE_PTE)PageTable;
|
PmlTable = (PHARDWARE_MODERN_PTE)PageTable;
|
||||||
if(PmlTable[Entry].Valid)
|
if(PmlTable[Entry].Valid)
|
||||||
{
|
{
|
||||||
/* Get page frame number from page table entry */
|
/* Get page frame number from page table entry */
|
||||||
@@ -340,7 +244,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allocate pages for new PML entry */
|
/* Allocate pages for new PML entry */
|
||||||
Status = BlAllocateMemoryPages(1, &Address);
|
Status = AllocatePages(AllocateAnyPages, 1, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -348,7 +252,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add new memory mapping */
|
/* Add new memory mapping */
|
||||||
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
|
Status = MapVirtualMemory(PageMap, NULLPTR, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory mapping failure */
|
/* Memory mapping failure */
|
||||||
@@ -356,13 +260,13 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fill allocated memory with zeros */
|
/* Fill allocated memory with zeros */
|
||||||
RtlZeroMemory((PVOID)(ULONGLONG)Address, EFI_PAGE_SIZE);
|
RTL::Memory::ZeroMemory((PVOID)(ULONGLONG)Address, EFI_PAGE_SIZE);
|
||||||
|
|
||||||
/* Set paging entry settings based on level */
|
/* Set paging entry settings based on level */
|
||||||
if(PageMap->PageMapLevel >= 3)
|
if(PageMap->PageMapLevel >= 3)
|
||||||
{
|
{
|
||||||
/* 64-bit PTE for PML3 (PAE enabled) */
|
/* 64-bit PTE for PML3 (PAE enabled) */
|
||||||
PmlTable = (PHARDWARE_PTE)PageTable;
|
PmlTable = (PHARDWARE_MODERN_PTE)PageTable;
|
||||||
PmlTable[Entry].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
PmlTable[Entry].PageFrameNumber = Address / EFI_PAGE_SIZE;
|
||||||
PmlTable[Entry].Valid = 1;
|
PmlTable[Entry].Valid = 1;
|
||||||
PmlTable[Entry].Writable = 1;
|
PmlTable[Entry].Writable = 1;
|
||||||
@@ -387,6 +291,116 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the actual virtual memory mapping.
|
||||||
|
*
|
||||||
|
* @param PageMap
|
||||||
|
* Supplies a pointer to the page mapping structure.
|
||||||
|
*
|
||||||
|
* @param VirtualAddress
|
||||||
|
* Supplies a virtual address of the mapping.
|
||||||
|
*
|
||||||
|
* @param PhysicalAddress
|
||||||
|
* Supplies a physical address of the mapping.
|
||||||
|
*
|
||||||
|
* @param NumberOfPages
|
||||||
|
* Supplies a number of the pages of the mapping.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Memory::MapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN ULONG_PTR VirtualAddress,
|
||||||
|
IN ULONG_PTR PhysicalAddress,
|
||||||
|
IN ULONG NumberOfPages)
|
||||||
|
{
|
||||||
|
SIZE_T PageFrameNumber;
|
||||||
|
PVOID Pml1, Pml2, Pml3;
|
||||||
|
SIZE_T Pml1Entry, Pml2Entry, Pml3Entry;
|
||||||
|
PHARDWARE_LEGACY_PTE LegacyPmlTable;
|
||||||
|
PHARDWARE_MODERN_PTE PmlTable;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Set the Page Frame Number (PFN) */
|
||||||
|
PageFrameNumber = PhysicalAddress >> EFI_PAGE_SHIFT;
|
||||||
|
|
||||||
|
/* Map all requested pages */
|
||||||
|
while(NumberOfPages > 0)
|
||||||
|
{
|
||||||
|
/* Check the paging mode to use the correct page table structure */
|
||||||
|
if(PageMap->PageMapLevel == 3)
|
||||||
|
{
|
||||||
|
/* Calculate the indices for PAE page tables */
|
||||||
|
Pml3Entry = (VirtualAddress >> 30) & 0x3;
|
||||||
|
Pml2Entry = (VirtualAddress >> 21) & 0x1FF;
|
||||||
|
Pml1Entry = (VirtualAddress >> 12) & 0x1FF;
|
||||||
|
|
||||||
|
/* Get Page Directory Pointer Table (PML3) */
|
||||||
|
Pml3 = PageMap->PtePointer;
|
||||||
|
|
||||||
|
/* Get Page Directory (PML2) */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml3, Pml3Entry, &Pml2);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to get the Page Table, abort mapping */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get Page Table (PML1) */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to get the Page Table, abort mapping */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the 64-bit PTE entry */
|
||||||
|
PmlTable = (PHARDWARE_MODERN_PTE)Pml1;
|
||||||
|
RTL::Memory::ZeroMemory(&PmlTable[Pml1Entry], sizeof(HARDWARE_MODERN_PTE));
|
||||||
|
PmlTable[Pml1Entry].PageFrameNumber = PageFrameNumber;
|
||||||
|
PmlTable[Pml1Entry].Valid = 1;
|
||||||
|
PmlTable[Pml1Entry].Writable = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Calculate the indices for non-PAE page tables */
|
||||||
|
Pml2Entry = (VirtualAddress >> 22) & 0x3FF;
|
||||||
|
Pml1Entry = (VirtualAddress >> 12) & 0x3FF;
|
||||||
|
|
||||||
|
/* Get Page Directory (PML2) */
|
||||||
|
Pml2 = PageMap->PtePointer;
|
||||||
|
|
||||||
|
/* Get Page Table (PML1) */
|
||||||
|
Status = GetNextPageTable(PageMap, Pml2, Pml2Entry, &Pml1);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to get the Page Table, abort mapping */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the 32-bit PTE entry */
|
||||||
|
LegacyPmlTable = (PHARDWARE_LEGACY_PTE)Pml1;
|
||||||
|
RTL::Memory::ZeroMemory(&LegacyPmlTable[Pml1Entry], sizeof(HARDWARE_LEGACY_PTE));
|
||||||
|
LegacyPmlTable[Pml1Entry].PageFrameNumber = (UINT32)PageFrameNumber;
|
||||||
|
LegacyPmlTable[Pml1Entry].Valid = 1;
|
||||||
|
LegacyPmlTable[Pml1Entry].Writable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Take next virtual address and PFN */
|
||||||
|
VirtualAddress += EFI_PAGE_SIZE;
|
||||||
|
PageFrameNumber++;
|
||||||
|
|
||||||
|
/* Decrease number of pages left */
|
||||||
|
NumberOfPages--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a recursive self mapping for all PML levels.
|
* Creates a recursive self mapping for all PML levels.
|
||||||
*
|
*
|
||||||
@@ -402,11 +416,11 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::SelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN ULONG_PTR SelfMapAddress)
|
IN ULONG_PTR SelfMapAddress)
|
||||||
{
|
{
|
||||||
PHARDWARE_LEGACY_PTE LegacyPml;
|
PHARDWARE_LEGACY_PTE LegacyPml;
|
||||||
PHARDWARE_PTE Pml;
|
PHARDWARE_MODERN_PTE Pml;
|
||||||
ULONGLONG PmlIndex;
|
ULONGLONG PmlIndex;
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
@@ -417,13 +431,13 @@ BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
PmlIndex = (SelfMapAddress >> MM_PDI_SHIFT) & 0x1FF;
|
PmlIndex = (SelfMapAddress >> MM_PDI_SHIFT) & 0x1FF;
|
||||||
|
|
||||||
/* Get Page Directory */
|
/* Get Page Directory */
|
||||||
Pml = (PHARDWARE_PTE)(((PHARDWARE_PTE)PageMap->PtePointer)[SelfMapAddress >> MM_PPI_SHIFT].PageFrameNumber * EFI_PAGE_SIZE);
|
Pml = (PHARDWARE_MODERN_PTE)(((PHARDWARE_MODERN_PTE)PageMap->PtePointer)[SelfMapAddress >> MM_PPI_SHIFT].PageFrameNumber * EFI_PAGE_SIZE);
|
||||||
|
|
||||||
/* Add self-mapping for PML3 (PAE enabled) */
|
/* Add self-mapping for PML3 (PAE enabled) */
|
||||||
for(Index = 0; Index < 4; Index++)
|
for(Index = 0; Index < 4; Index++)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&Pml[PmlIndex + Index], sizeof(HARDWARE_PTE));
|
RTL::Memory::ZeroMemory(&Pml[PmlIndex + Index], sizeof(HARDWARE_MODERN_PTE));
|
||||||
Pml[PmlIndex + Index].PageFrameNumber = ((PHARDWARE_PTE)PageMap->PtePointer)[Index].PageFrameNumber;
|
Pml[PmlIndex + Index].PageFrameNumber = ((PHARDWARE_MODERN_PTE)PageMap->PtePointer)[Index].PageFrameNumber;
|
||||||
Pml[PmlIndex + Index].Valid = 1;
|
Pml[PmlIndex + Index].Valid = 1;
|
||||||
Pml[PmlIndex + Index].Writable = 1;
|
Pml[PmlIndex + Index].Writable = 1;
|
||||||
}
|
}
|
||||||
@@ -436,7 +450,7 @@ BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
PmlIndex = (SelfMapAddress >> MM_PDI_LEGACY_SHIFT);
|
PmlIndex = (SelfMapAddress >> MM_PDI_LEGACY_SHIFT);
|
||||||
|
|
||||||
/* Add self-mapping for PML2 (PAE disabled) */
|
/* Add self-mapping for PML2 (PAE disabled) */
|
||||||
RtlZeroMemory(&LegacyPml[PmlIndex], sizeof(HARDWARE_LEGACY_PTE));
|
RTL::Memory::ZeroMemory(&LegacyPml[PmlIndex], sizeof(HARDWARE_LEGACY_PTE));
|
||||||
LegacyPml[PmlIndex].PageFrameNumber = (UINT_PTR)PageMap->PtePointer / EFI_PAGE_SIZE;
|
LegacyPml[PmlIndex].PageFrameNumber = (UINT_PTR)PageMap->PtePointer / EFI_PAGE_SIZE;
|
||||||
LegacyPml[PmlIndex].Valid = 1;
|
LegacyPml[PmlIndex].Valid = 1;
|
||||||
LegacyPml[PmlIndex].Writable = 1;
|
LegacyPml[PmlIndex].Writable = 1;
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/bootutil.c
|
* FILE: xtldr/bootutil.cc
|
||||||
* DESCRIPTION: Helper functions used by the boot protocol during system startup
|
* DESCRIPTION: Helper functions used by the boot protocol during system startup
|
||||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,21 +24,21 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
BlGetBooleanParameter(IN CONST PWCHAR Parameters,
|
BootUtils::GetBooleanParameter(IN PCWSTR Parameters,
|
||||||
IN CONST PWCHAR Needle)
|
IN PCWSTR Needle)
|
||||||
{
|
{
|
||||||
PWCHAR CurrentPosition, TokenEnd, TokenStart;
|
PCWSTR CurrentPosition, TokenEnd, TokenStart;
|
||||||
SIZE_T NeedleLength, TokenLength;
|
SIZE_T NeedleLength, TokenLength;
|
||||||
|
|
||||||
/* Validate input data and ensure the option is not an empty string */
|
/* Validate input data and ensure the option is not an empty string */
|
||||||
if(Parameters == NULL || Needle == NULL || *Needle == L'\0')
|
if(Parameters == NULLPTR || Needle == NULLPTR || *Needle == L'\0')
|
||||||
{
|
{
|
||||||
/* One of the parameters was invalid */
|
/* One of the parameters was invalid */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentPosition = Parameters;
|
CurrentPosition = Parameters;
|
||||||
NeedleLength = RtlWideStringLength(Needle, 0);
|
NeedleLength = RTL::WideString::WideStringLength(Needle, 0);
|
||||||
|
|
||||||
/* Iterate through the entire parameters string */
|
/* Iterate through the entire parameters string */
|
||||||
while(*CurrentPosition != L'\0')
|
while(*CurrentPosition != L'\0')
|
||||||
@@ -71,7 +71,7 @@ BlGetBooleanParameter(IN CONST PWCHAR Parameters,
|
|||||||
if(TokenLength == NeedleLength)
|
if(TokenLength == NeedleLength)
|
||||||
{
|
{
|
||||||
/* Length matches, compare the strings */
|
/* Length matches, compare the strings */
|
||||||
if(RtlCompareWideStringInsensitive(TokenStart, Needle, NeedleLength) == 0)
|
if(RTL::WideString::CompareWideStringInsensitive(TokenStart, Needle, NeedleLength) == 0)
|
||||||
{
|
{
|
||||||
/* A match was found */
|
/* A match was found */
|
||||||
return TRUE;
|
return TRUE;
|
655
xtldr/config.c
655
xtldr/config.c
@@ -1,655 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/config.c
|
|
||||||
* DESCRIPTION: XT Boot Loader Configuration
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xtldr.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a boolean value of the specified configuration key.
|
|
||||||
*
|
|
||||||
* @param ConfigName
|
|
||||||
* Specifies the configuration key to return its boolean representation.
|
|
||||||
*
|
|
||||||
* @return This routine returns a boolean representation of the configuration value.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
BlGetConfigBooleanValue(IN CONST PWCHAR ConfigName)
|
|
||||||
{
|
|
||||||
PWCHAR Value;
|
|
||||||
|
|
||||||
/* Get config value */
|
|
||||||
Value = BlGetConfigValue(ConfigName);
|
|
||||||
|
|
||||||
/* Check if option is enabled */
|
|
||||||
if(RtlCompareWideStringInsensitive(Value, L"ENABLED", 0) == 0 ||
|
|
||||||
RtlCompareWideStringInsensitive(Value, L"ON", 0) == 0 ||
|
|
||||||
RtlCompareWideStringInsensitive(Value, L"TRUE", 0) == 0 ||
|
|
||||||
RtlCompareWideStringInsensitive(Value, L"YES", 0) == 0)
|
|
||||||
{
|
|
||||||
/* This option is enabled */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return FALSE by default */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a value of the specified configuration key.
|
|
||||||
*
|
|
||||||
* @param ConfigName
|
|
||||||
* Specifies the configuration key to return its value.
|
|
||||||
*
|
|
||||||
* @return This routine returns a pointer to the configuration value, or NULL if key was not found.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
PWCHAR
|
|
||||||
BlGetConfigValue(IN CONST PWCHAR ConfigName)
|
|
||||||
{
|
|
||||||
PXTBL_CONFIG_ENTRY ConfigEntry;
|
|
||||||
PLIST_ENTRY ConfigListEntry;
|
|
||||||
SIZE_T KeyLength, ValueLength;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
PWCHAR Value;
|
|
||||||
|
|
||||||
/* Get config entry name length */
|
|
||||||
KeyLength = RtlWideStringLength(ConfigName, 0);
|
|
||||||
|
|
||||||
/* Iterate through config entries */
|
|
||||||
ConfigListEntry = BlpConfig.Flink;
|
|
||||||
while(ConfigListEntry != &BlpConfig)
|
|
||||||
{
|
|
||||||
/* Get config entry */
|
|
||||||
ConfigEntry = CONTAIN_RECORD(ConfigListEntry, XTBL_CONFIG_ENTRY, Flink);
|
|
||||||
|
|
||||||
/* Check if requested configuration found */
|
|
||||||
if(RtlCompareWideStringInsensitive(ConfigEntry->Name, ConfigName, KeyLength) == 0)
|
|
||||||
{
|
|
||||||
/* Get value length */
|
|
||||||
ValueLength = RtlWideStringLength(ConfigEntry->Value, 0);
|
|
||||||
|
|
||||||
/* Allocate memory for value */
|
|
||||||
Status = BlAllocateMemoryPool((ValueLength + 1) * sizeof(WCHAR), (PVOID *)&Value);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory allocation failure, return NULL */
|
|
||||||
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%zX)\n", Status);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy value and return it */
|
|
||||||
RtlCopyMemory(Value, ConfigEntry->Value, ValueLength * sizeof(WCHAR));
|
|
||||||
Value[ValueLength] = L'\0';
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move to the next config entry */
|
|
||||||
ConfigListEntry = ConfigListEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Config entry not found, return NULL */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates existing configuration value.
|
|
||||||
*
|
|
||||||
* @param ConfigName
|
|
||||||
* Specifies the configuration key to update.
|
|
||||||
*
|
|
||||||
* @param ConfigValue
|
|
||||||
* Specifies the new configuration value.
|
|
||||||
*
|
|
||||||
* @return This routine returns status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlSetConfigValue(IN CONST PWCHAR ConfigName,
|
|
||||||
IN CONST PWCHAR ConfigValue)
|
|
||||||
{
|
|
||||||
PXTBL_CONFIG_ENTRY ConfigEntry;
|
|
||||||
PLIST_ENTRY ConfigListEntry;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
SIZE_T Length;
|
|
||||||
|
|
||||||
/* Get config entry name length */
|
|
||||||
Length = RtlWideStringLength(ConfigName, 0);
|
|
||||||
|
|
||||||
/* Iterate through config entries */
|
|
||||||
ConfigListEntry = BlpConfig.Flink;
|
|
||||||
while(ConfigListEntry != &BlpConfig)
|
|
||||||
{
|
|
||||||
/* Get config entry */
|
|
||||||
ConfigEntry = CONTAIN_RECORD(ConfigListEntry, XTBL_CONFIG_ENTRY, Flink);
|
|
||||||
|
|
||||||
/* Check if requested configuration found */
|
|
||||||
if(RtlCompareWideStringInsensitive(ConfigEntry->Name, ConfigName, Length) == 0)
|
|
||||||
{
|
|
||||||
/* Check new config value length */
|
|
||||||
Length = RtlWideStringLength(ConfigValue, 0);
|
|
||||||
|
|
||||||
/* Reallocate memory for new config value */
|
|
||||||
Status = BlFreeMemoryPool(ConfigEntry->Value);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Successfully freed memory, allocate a new pool */
|
|
||||||
Status = BlAllocateMemoryPool((Length + 1) * sizeof(WCHAR), (PVOID *)&ConfigEntry->Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check memory reallocation status */
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to reallocate memory */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update config value */
|
|
||||||
RtlCopyMemory(ConfigEntry->Value, ConfigValue, Length * sizeof(WCHAR));
|
|
||||||
ConfigEntry->Value[Length] = L'\0';
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move to the next config entry */
|
|
||||||
ConfigListEntry = ConfigListEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Config entry not found */
|
|
||||||
return STATUS_EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads and parses XTLDR configuration file.
|
|
||||||
*
|
|
||||||
* @return This routine returns status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpLoadConfiguration()
|
|
||||||
{
|
|
||||||
PLIST_ENTRY SectionListEntry;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
PCHAR ConfigData;
|
|
||||||
|
|
||||||
/* Initialize configuration pointer */
|
|
||||||
RtlInitializeListHead(&BlpConfigSections);
|
|
||||||
|
|
||||||
/* Read data from configuration file */
|
|
||||||
Status = BlpReadConfigFile(XTBL_LOADER_DIRECTORY_PATH, L"XTLDR.INI", &ConfigData);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to read config file, try with architecture specific directory */
|
|
||||||
Status = BlpReadConfigFile(XTBL_ARCH_LOADER_DIRECTORY_PATH, L"XTLDR.INI", &ConfigData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if configuration was read successfully */
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to load configuration */
|
|
||||||
BlDebugPrint(L"Failed to load FS0:/EFI/BOOT/XTLDR/XTLDR.INI configuration file (Status Code: 0x%zX)\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse configuration data */
|
|
||||||
Status = BlpParseConfigFile(ConfigData, &BlpConfigSections);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to parse configuration */
|
|
||||||
BlDebugPrint(L"Failed to parse FS0:/EFI/BOOT/XTLDR/XTLDR.INI configuration file (Status Code: 0x%zX)\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Iterate through config sections */
|
|
||||||
SectionListEntry = BlpConfigSections.Flink;
|
|
||||||
while(SectionListEntry != &BlpConfigSections)
|
|
||||||
{
|
|
||||||
/* Get config section */
|
|
||||||
PXTBL_CONFIG_SECTION Section = CONTAIN_RECORD(SectionListEntry, XTBL_CONFIG_SECTION, Flink);
|
|
||||||
|
|
||||||
/* Look for global XTLDR configuration section */
|
|
||||||
if(RtlCompareWideStringInsensitive(Section->SectionName, L"XTLDR", 5) == 0)
|
|
||||||
{
|
|
||||||
/* Update global configuration */
|
|
||||||
BlpUpdateConfiguration(&Section->Options);
|
|
||||||
|
|
||||||
/* Remove XTLDR section from the list */
|
|
||||||
RtlRemoveEntryList(SectionListEntry);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move to the next section */
|
|
||||||
SectionListEntry = SectionListEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update boot menu OS list */
|
|
||||||
BlpMenuList = &BlpConfigSections;
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses command line arguments and updates global configuration.
|
|
||||||
*
|
|
||||||
* @return This routine does not return any value.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpParseCommandLine(VOID)
|
|
||||||
{
|
|
||||||
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
|
|
||||||
PEFI_LOADED_IMAGE_PROTOCOL LoadedImage;
|
|
||||||
PWCHAR Argument, Key, LastArg, Value;
|
|
||||||
PXTBL_CONFIG_ENTRY Option;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
SIZE_T KeyLength, ValueLength;
|
|
||||||
LIST_ENTRY Config;
|
|
||||||
|
|
||||||
/* Initialize configuration list */
|
|
||||||
RtlInitializeListHead(&Config);
|
|
||||||
|
|
||||||
/* Handle loaded image protocol */
|
|
||||||
Status = EfiSystemTable->BootServices->HandleProtocol(EfiImageHandle, &LIPGuid, (PVOID *)&LoadedImage);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Check if launched from UEFI shell */
|
|
||||||
if(LoadedImage && LoadedImage->LoadOptions)
|
|
||||||
{
|
|
||||||
/* Tokenize provided options */
|
|
||||||
Argument = RtlTokenizeWideString(LoadedImage->LoadOptions, L" ", &LastArg);
|
|
||||||
|
|
||||||
/* Iterate over all arguments passed to boot loader */
|
|
||||||
while(Argument != NULL)
|
|
||||||
{
|
|
||||||
/* Store key name */
|
|
||||||
Key = Argument;
|
|
||||||
|
|
||||||
/* Find end of the key */
|
|
||||||
while(*Argument != L'=' && *Argument != L'\0' && *Argument != L'\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
Argument++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark end of the key and advance to the next character */
|
|
||||||
*Argument = L'\0';
|
|
||||||
Argument++;
|
|
||||||
|
|
||||||
/* Store value */
|
|
||||||
Value = Argument;
|
|
||||||
|
|
||||||
/* Find end of the value */
|
|
||||||
while(*Argument != L'\0' && *Argument != L'\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
Argument++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark end of the value and advance to the next character */
|
|
||||||
*Argument = L'\0';
|
|
||||||
Argument++;
|
|
||||||
|
|
||||||
/* Get length of the key and its value */
|
|
||||||
KeyLength = RtlWideStringLength(Key, 0);
|
|
||||||
ValueLength = RtlWideStringLength(Value, 0);
|
|
||||||
|
|
||||||
/* Check if argument is valid */
|
|
||||||
if(KeyLength == 0 || ValueLength == 0)
|
|
||||||
{
|
|
||||||
/* Invalid argument, skip to the next one */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for new option */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Allocate more memory for option name */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Allocate even more memory for option value */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Some memory allocation failed */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set entry name and value */
|
|
||||||
RtlCopyMemory(Option->Name, Key, (KeyLength * sizeof(WCHAR)));
|
|
||||||
RtlCopyMemory(Option->Value, Value, (ValueLength * sizeof(WCHAR)));
|
|
||||||
Option->Name[KeyLength] = L'\0';
|
|
||||||
Option->Value[ValueLength] = L'\0';
|
|
||||||
|
|
||||||
/* Add entry to the list */
|
|
||||||
RtlInsertTailList(&Config, &Option->Flink);
|
|
||||||
|
|
||||||
/* Take next argument */
|
|
||||||
Argument = RtlTokenizeWideString(NULL, L" ", &LastArg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update global configuration */
|
|
||||||
BlpUpdateConfiguration(&Config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses configuration INI file.
|
|
||||||
*
|
|
||||||
* @param RawConfig
|
|
||||||
* Suplies a pointer to configuration INI file to be parsed.
|
|
||||||
*
|
|
||||||
* @param Configuration
|
|
||||||
* Supplies a pointer to memory region where parsed configuration will be stored.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpParseConfigFile(IN CONST PCHAR RawConfig,
|
|
||||||
OUT PLIST_ENTRY Configuration)
|
|
||||||
{
|
|
||||||
SIZE_T SectionLength, KeyLength, ValueLength;
|
|
||||||
PCHAR InputData, Key, SectionName, Value;
|
|
||||||
PXTBL_CONFIG_SECTION Section;
|
|
||||||
PXTBL_CONFIG_ENTRY Option;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
/* Initialize pointers */
|
|
||||||
InputData = RawConfig;
|
|
||||||
Section = NULL;
|
|
||||||
Option = NULL;
|
|
||||||
SectionName = NULL;
|
|
||||||
Key = NULL;
|
|
||||||
Value = NULL;
|
|
||||||
|
|
||||||
/* Analyze configuration data until end of file is reached */
|
|
||||||
while(*InputData != '\0')
|
|
||||||
{
|
|
||||||
if(*InputData == ';' || *InputData == '#')
|
|
||||||
{
|
|
||||||
/* Skip comment until end of the line */
|
|
||||||
while(*InputData != '\0' && *InputData != '\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(*InputData == ' ' || *InputData == '\t' || *InputData == '\r' || *InputData == '\n')
|
|
||||||
{
|
|
||||||
/* Skip whitespaces */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
else if(*InputData == '[')
|
|
||||||
{
|
|
||||||
/* Skip leading bracket */
|
|
||||||
InputData++;
|
|
||||||
|
|
||||||
/* Store section name */
|
|
||||||
SectionName = InputData;
|
|
||||||
|
|
||||||
/* Find end of the section name */
|
|
||||||
while(*InputData != ']' && *InputData != '\0' && *InputData != '\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if end of the section name is reached */
|
|
||||||
if(*InputData != ']')
|
|
||||||
{
|
|
||||||
/* Section name does not end */
|
|
||||||
return STATUS_EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark end of the section name and advance to the next character */
|
|
||||||
*InputData = '\0';
|
|
||||||
InputData++;
|
|
||||||
|
|
||||||
/* Remove leading and trailing spaces from section name */
|
|
||||||
SectionName = RtlTrimString(SectionName);
|
|
||||||
|
|
||||||
/* Find length of the section name */
|
|
||||||
SectionLength = RtlStringLength(SectionName, 0);
|
|
||||||
|
|
||||||
/* Allocate memory for new section */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_SECTION), (PVOID*)&Section);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Allocate more memory for section name */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (SectionLength + 1), (PVOID*)&Section->SectionName);
|
|
||||||
}
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Some memory allocation failed */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize new section and convert its name to wide string */
|
|
||||||
RtlInitializeListHead(&Section->Options);
|
|
||||||
RtlStringToWideString(Section->SectionName, &SectionName, SectionLength);
|
|
||||||
|
|
||||||
/* Ensure string is NULL-terminated and add new section to the configuration list */
|
|
||||||
Section->SectionName[SectionLength] = L'\0';
|
|
||||||
RtlInsertTailList(Configuration, &Section->Flink);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Store key */
|
|
||||||
Key = InputData;
|
|
||||||
|
|
||||||
/* Find end of the key */
|
|
||||||
while(*InputData != '=' && *InputData != '\0' && *InputData != '\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if end of the key is reached */
|
|
||||||
if(*InputData != '=')
|
|
||||||
{
|
|
||||||
/* Key name does not end */
|
|
||||||
return STATUS_EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark end of the key and advance to the next character */
|
|
||||||
*InputData = 0;
|
|
||||||
InputData++;
|
|
||||||
|
|
||||||
/* Skip all leading spaces in the value */
|
|
||||||
while(*InputData == ' ')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store value */
|
|
||||||
Value = InputData;
|
|
||||||
|
|
||||||
/* Find end of the value */
|
|
||||||
while(*InputData != '\0' && *InputData != '\n')
|
|
||||||
{
|
|
||||||
/* Advance to the next character */
|
|
||||||
InputData++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark end of the value and advance to the next character */
|
|
||||||
*InputData = 0;
|
|
||||||
InputData++;
|
|
||||||
|
|
||||||
/* Remove leading and trailing spaces from key and value */
|
|
||||||
Key = RtlTrimString(Key);
|
|
||||||
Value = RtlTrimString(Value);
|
|
||||||
|
|
||||||
/* Find length of the key and its value */
|
|
||||||
KeyLength = RtlStringLength(Key, 0);
|
|
||||||
ValueLength = RtlStringLength(Value, 0);
|
|
||||||
|
|
||||||
/* Allocate memory for new option */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Allocate more memory for option name */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Allocate even more memory for option value */
|
|
||||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Some memory allocation failed */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove leading quotes from the value */
|
|
||||||
if(*Value == '"' || *Value == '\'')
|
|
||||||
{
|
|
||||||
Value++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove trailing quotes from the value */
|
|
||||||
if(Value[ValueLength - 2] == '"' || Value[ValueLength - 2] == '\'')
|
|
||||||
{
|
|
||||||
Value[ValueLength - 2] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert key and value to wide strings */
|
|
||||||
RtlStringToWideString(Option->Name, &Key, RtlStringLength(Key, 0) + 1);
|
|
||||||
RtlStringToWideString(Option->Value, &Value, RtlStringLength(Value, 0) + 1);
|
|
||||||
|
|
||||||
/* Ensure strings are NULL-terminated and add new option to the list */
|
|
||||||
Option->Name[KeyLength] = L'\0';
|
|
||||||
Option->Value[ValueLength] = L'\0';
|
|
||||||
RtlInsertTailList(&Section->Options, &Option->Flink);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads configuration file from the specified directory on the FS0:/ drive.
|
|
||||||
*
|
|
||||||
* @param ConfigDirectory
|
|
||||||
* Specifies a path to the directory containing the configuration file.
|
|
||||||
*
|
|
||||||
* @param ConfigFile
|
|
||||||
* Specifies the name of the configuration file.
|
|
||||||
*
|
|
||||||
* @param ConfigData
|
|
||||||
* Provides a buffer to store the data read from the configuration file.
|
|
||||||
*
|
|
||||||
* @return This routine returns status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpReadConfigFile(IN CONST PWCHAR ConfigDirectory,
|
|
||||||
IN CONST PWCHAR ConfigFile,
|
|
||||||
OUT PCHAR *ConfigData)
|
|
||||||
{
|
|
||||||
PEFI_FILE_HANDLE DirHandle, FsHandle;
|
|
||||||
EFI_HANDLE DiskHandle;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
SIZE_T FileSize;
|
|
||||||
|
|
||||||
/* Open EFI volume */
|
|
||||||
Status = BlOpenVolume(NULL, &DiskHandle, &FsHandle);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open a volume */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open specified directory, containing the configuration file and close the FS immediately */
|
|
||||||
Status = FsHandle->Open(FsHandle, &DirHandle, ConfigDirectory, EFI_FILE_MODE_READ, 0);
|
|
||||||
FsHandle->Close(FsHandle);
|
|
||||||
|
|
||||||
/* Check if directory opened successfully */
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open directory */
|
|
||||||
BlCloseVolume(DiskHandle);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read configuration file and close directory */
|
|
||||||
Status = BlReadFile(DirHandle, ConfigFile, (PVOID *)ConfigData, &FileSize);
|
|
||||||
DirHandle->Close(DirHandle);
|
|
||||||
|
|
||||||
/* Close EFI volume */
|
|
||||||
BlCloseVolume(DiskHandle);
|
|
||||||
|
|
||||||
/* Return read status */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds new XTLDR configuration entries to the global configuration list. Existing entries are not overwritten.
|
|
||||||
*
|
|
||||||
* @param NewConfig
|
|
||||||
* Supplies a pointer to a linked list containing new configuration entries.
|
|
||||||
*
|
|
||||||
* @return This routine does not return any value.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpUpdateConfiguration(IN PLIST_ENTRY NewConfig)
|
|
||||||
{
|
|
||||||
PXTBL_CONFIG_ENTRY ConfigEntry;
|
|
||||||
PLIST_ENTRY ConfigListEntry, NextListEntry;
|
|
||||||
|
|
||||||
/* Iterate through new config entries */
|
|
||||||
ConfigListEntry = NewConfig->Flink;
|
|
||||||
while(ConfigListEntry != NewConfig)
|
|
||||||
{
|
|
||||||
/* Get new config entry */
|
|
||||||
ConfigEntry = CONTAIN_RECORD(ConfigListEntry, XTBL_CONFIG_ENTRY, Flink);
|
|
||||||
|
|
||||||
/* Get next config entry */
|
|
||||||
NextListEntry = ConfigListEntry->Flink;
|
|
||||||
|
|
||||||
/* Make sure config entry does not exist yet */
|
|
||||||
if(BlGetConfigValue(ConfigEntry->Name) == NULL)
|
|
||||||
{
|
|
||||||
/* Remove new config entry from input list and put it into global config list */
|
|
||||||
RtlRemoveEntryList(&ConfigEntry->Flink);
|
|
||||||
RtlInsertTailList(&BlpConfig, &ConfigEntry->Flink);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move to the next new config entry */
|
|
||||||
ConfigListEntry = NextListEntry;
|
|
||||||
}
|
|
||||||
}
|
|
1052
xtldr/config.cc
Normal file
1052
xtldr/config.cc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/console.c
|
* FILE: xtldr/console.cc
|
||||||
* DESCRIPTION: EFI console support
|
* DESCRIPTION: EFI console support
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,19 +21,19 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlClearConsoleLine(IN ULONGLONG LineNo)
|
Console::ClearLine(IN ULONGLONG LineNo)
|
||||||
{
|
{
|
||||||
UINT_PTR Index, ResX, ResY;
|
UINT_PTR Index, ResX, ResY;
|
||||||
|
|
||||||
/* Query console mode */
|
/* Query console mode */
|
||||||
BlQueryConsoleMode(&ResX, &ResY);
|
QueryMode(&ResX, &ResY);
|
||||||
|
|
||||||
/* Set cursor position and clear line */
|
/* Set cursor position and clear line */
|
||||||
BlSetCursorPosition(0, LineNo);
|
SetCursorPosition(0, LineNo);
|
||||||
for(Index = 0; Index < ResX; Index++)
|
for(Index = 0; Index < ResX; Index++)
|
||||||
{
|
{
|
||||||
/* Clear line */
|
/* Clear line */
|
||||||
BlConsoleWrite(L" ");
|
Write(L" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,10 +46,10 @@ BlClearConsoleLine(IN ULONGLONG LineNo)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlClearConsoleScreen()
|
Console::ClearScreen()
|
||||||
{
|
{
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
EfiSystemTable->ConOut->ClearScreen(EfiSystemTable->ConOut);
|
XtLoader::GetEfiSystemTable()->ConOut->ClearScreen(XtLoader::GetEfiSystemTable()->ConOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,9 +61,9 @@ BlClearConsoleScreen()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlDisableConsoleCursor()
|
Console::DisableCursor()
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, FALSE);
|
XtLoader::GetEfiSystemTable()->ConOut->EnableCursor(XtLoader::GetEfiSystemTable()->ConOut, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,9 +75,39 @@ BlDisableConsoleCursor()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlEnableConsoleCursor()
|
Console::EnableCursor()
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, TRUE);
|
XtLoader::GetEfiSystemTable()->ConOut->EnableCursor(XtLoader::GetEfiSystemTable()->ConOut, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine initializes the EFI console.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
Console::InitializeConsole()
|
||||||
|
{
|
||||||
|
/* Clear console buffers */
|
||||||
|
XtLoader::GetEfiSystemTable()->ConIn->Reset(XtLoader::GetEfiSystemTable()->ConIn, TRUE);
|
||||||
|
XtLoader::GetEfiSystemTable()->ConOut->Reset(XtLoader::GetEfiSystemTable()->ConOut, TRUE);
|
||||||
|
XtLoader::GetEfiSystemTable()->StdErr->Reset(XtLoader::GetEfiSystemTable()->StdErr, TRUE);
|
||||||
|
|
||||||
|
/* Make sure that current console mode is 80x25 characters, as some broken EFI implementations might
|
||||||
|
* set different mode that do not fit on the screen, causing a text to be displayed offscreen */
|
||||||
|
if(XtLoader::GetEfiSystemTable()->ConOut->Mode->Mode != 0)
|
||||||
|
{
|
||||||
|
/* Set console mode to 0, which is standard, 80x25 text mode */
|
||||||
|
SetMode(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clear screen and enable cursor */
|
||||||
|
SetAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
|
||||||
|
ClearScreen();
|
||||||
|
EnableCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,30 +125,30 @@ BlEnableConsoleCursor()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlConsolePrint(IN PUSHORT Format,
|
Console::Print(IN PCWSTR Format,
|
||||||
IN ...)
|
IN ...)
|
||||||
{
|
{
|
||||||
RTL_PRINT_CONTEXT ConsolePrintContext, SerialPrintContext;
|
RTL_PRINT_CONTEXT ConsolePrintContext, SerialPrintContext;
|
||||||
VA_LIST Arguments;
|
VA_LIST Arguments;
|
||||||
|
|
||||||
/* Initialise the print contexts */
|
/* Initialise the print contexts */
|
||||||
ConsolePrintContext.WriteWideCharacter = BlpConsolePutChar;
|
ConsolePrintContext.WriteWideCharacter = PutChar;
|
||||||
SerialPrintContext.WriteWideCharacter = BlpDebugPutChar;
|
SerialPrintContext.WriteWideCharacter = Debug::PutChar;
|
||||||
|
|
||||||
/* Initialise the va_list */
|
/* Initialise the va_list */
|
||||||
VA_START(Arguments, Format);
|
VA_START(Arguments, Format);
|
||||||
|
|
||||||
/* Format and print the string to the stdout */
|
/* Format and print the string to the stdout */
|
||||||
RtlFormatWideString(&ConsolePrintContext, (PWCHAR)Format, Arguments);
|
RTL::WideString::FormatWideString(&ConsolePrintContext, (PWCHAR)Format, Arguments);
|
||||||
|
|
||||||
/* Print to serial console only if not running under OVMF */
|
/* Print to serial console only if not running under OVMF */
|
||||||
if(RtlCompareWideString(EfiSystemTable->FirmwareVendor, L"EDK II", 6) != 0)
|
if(RTL::WideString::CompareWideString(XtLoader::GetEfiSystemTable()->FirmwareVendor, L"EDK II", 6) != 0)
|
||||||
{
|
{
|
||||||
/* Check if debugging enabled and if EFI serial port is fully initialized */
|
/* Check if debugging enabled and if EFI serial port is fully initialized */
|
||||||
if(DEBUG && (BlpStatus.SerialPort.Flags & COMPORT_FLAG_INIT))
|
if(DEBUG && Debug::SerialPortReady())
|
||||||
{
|
{
|
||||||
/* Format and print the string to the serial console */
|
/* Format and print the string to the serial console */
|
||||||
RtlFormatWideString(&SerialPrintContext, (PWCHAR)Format, Arguments);
|
RTL::WideString::FormatWideString(&SerialPrintContext, (PWCHAR)Format, Arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,50 +157,35 @@ BlConsolePrint(IN PUSHORT Format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the string on the device at the current cursor location.
|
* Writes a character to the default EFI console.
|
||||||
*
|
*
|
||||||
* @param String
|
* @param Character
|
||||||
* The string to be displayed.
|
* The integer promotion of the character to be written.
|
||||||
*
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine returns a status code.
|
||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
XTSTATUS
|
||||||
BlConsoleWrite(IN PUSHORT String)
|
Console::PutChar(IN WCHAR Character)
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, String);
|
WCHAR Buffer[2];
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* Check if character is a newline ('\n') */
|
||||||
* This routine initializes the EFI console.
|
if(Character == L'\n')
|
||||||
*
|
|
||||||
* @return This routine returns status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlInitializeConsole()
|
|
||||||
{
|
|
||||||
/* Clear console buffers */
|
|
||||||
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE);
|
|
||||||
EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE);
|
|
||||||
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE);
|
|
||||||
|
|
||||||
/* Make sure that current console mode is 80x25 characters, as some broken EFI implementations might
|
|
||||||
* set different mode that do not fit on the screen, causing a text to be displayed offscreen */
|
|
||||||
if(EfiSystemTable->ConOut->Mode->Mode != 0)
|
|
||||||
{
|
{
|
||||||
/* Set console mode to 0, which is standard, 80x25 text mode */
|
/* Print carriage return ('\r') as well */
|
||||||
BlSetConsoleMode(0);
|
PutChar(L'\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear screen and enable cursor */
|
/* Write character to the screen console */
|
||||||
BlSetConsoleAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
|
Buffer[0] = Character;
|
||||||
BlClearConsoleScreen();
|
Buffer[1] = 0;
|
||||||
BlEnableConsoleCursor();
|
XtLoader::GetEfiSystemTable()->ConOut->OutputString(XtLoader::GetEfiSystemTable()->ConOut, Buffer);
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,10 +203,11 @@ BlInitializeConsole()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlQueryConsoleMode(OUT PUINT_PTR ResX,
|
Console::QueryMode(OUT PUINT_PTR ResX,
|
||||||
OUT PUINT_PTR ResY)
|
OUT PUINT_PTR ResY)
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->QueryMode(EfiSystemTable->ConOut, EfiSystemTable->ConOut->Mode->Mode, ResX, ResY);
|
XtLoader::GetEfiSystemTable()->ConOut->QueryMode(XtLoader::GetEfiSystemTable()->ConOut,
|
||||||
|
XtLoader::GetEfiSystemTable()->ConOut->Mode->Mode, ResX, ResY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -206,9 +222,9 @@ BlQueryConsoleMode(OUT PUINT_PTR ResX,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlReadKeyStroke(OUT PEFI_INPUT_KEY Key)
|
Console::ReadKeyStroke(OUT PEFI_INPUT_KEY Key)
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConIn->ReadKeyStroke(EfiSystemTable->ConIn, Key);
|
XtLoader::GetEfiSystemTable()->ConIn->ReadKeyStroke(XtLoader::GetEfiSystemTable()->ConIn, Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,9 +236,9 @@ BlReadKeyStroke(OUT PEFI_INPUT_KEY Key)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlResetConsoleInputBuffer()
|
Console::ResetInputBuffer()
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, FALSE);
|
XtLoader::GetEfiSystemTable()->ConIn->Reset(XtLoader::GetEfiSystemTable()->ConIn, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,26 +253,9 @@ BlResetConsoleInputBuffer()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlSetConsoleAttributes(IN ULONGLONG Attributes)
|
Console::SetAttributes(IN ULONGLONG Attributes)
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->SetAttribute(EfiSystemTable->ConOut, Attributes);
|
XtLoader::GetEfiSystemTable()->ConOut->SetAttribute(XtLoader::GetEfiSystemTable()->ConOut, Attributes);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the output console device to the requested mode.
|
|
||||||
*
|
|
||||||
* @param Mode
|
|
||||||
* Supplies a text mode number to set.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlSetConsoleMode(IN ULONGLONG Mode)
|
|
||||||
{
|
|
||||||
return EfiSystemTable->ConOut->SetMode(EfiSystemTable->ConOut, Mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,40 +273,42 @@ BlSetConsoleMode(IN ULONGLONG Mode)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlSetCursorPosition(IN ULONGLONG PosX,
|
Console::SetCursorPosition(IN ULONGLONG PosX,
|
||||||
IN ULONGLONG PosY)
|
IN ULONGLONG PosY)
|
||||||
{
|
{
|
||||||
EfiSystemTable->ConOut->SetCursorPosition(EfiSystemTable->ConOut, PosX, PosY);
|
XtLoader::GetEfiSystemTable()->ConOut->SetCursorPosition(XtLoader::GetEfiSystemTable()->ConOut, PosX, PosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a character to the default EFI console.
|
* Sets the output console device to the requested mode.
|
||||||
*
|
*
|
||||||
* @param Character
|
* @param Mode
|
||||||
* The integer promotion of the character to be written.
|
* Supplies a text mode number to set.
|
||||||
*
|
*
|
||||||
* @return This routine returns a status code.
|
* @return This routine returns a status code.
|
||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
XTSTATUS
|
EFI_STATUS
|
||||||
BlpConsolePutChar(IN USHORT Character)
|
Console::SetMode(IN ULONGLONG Mode)
|
||||||
{
|
{
|
||||||
USHORT Buffer[2];
|
return XtLoader::GetEfiSystemTable()->ConOut->SetMode(XtLoader::GetEfiSystemTable()->ConOut, Mode);
|
||||||
|
}
|
||||||
/* Check if character is a newline ('\n') */
|
|
||||||
if(Character == L'\n')
|
/**
|
||||||
{
|
* Displays the string on the device at the current cursor location.
|
||||||
/* Print carriage return ('\r') as well */
|
*
|
||||||
BlpConsolePutChar(L'\r');
|
* @param String
|
||||||
}
|
* The string to be displayed.
|
||||||
|
*
|
||||||
/* Write character to the screen console */
|
* @return This routine does not return any value.
|
||||||
Buffer[0] = Character;
|
*
|
||||||
Buffer[1] = 0;
|
* @since XT 1.0
|
||||||
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, Buffer);
|
*/
|
||||||
|
XTCDECL
|
||||||
/* Return success */
|
VOID
|
||||||
return STATUS_SUCCESS;
|
Console::Write(IN PCWSTR String)
|
||||||
|
{
|
||||||
|
XtLoader::GetEfiSystemTable()->ConOut->OutputString(XtLoader::GetEfiSystemTable()->ConOut, (PWSTR)String);
|
||||||
}
|
}
|
60
xtldr/data.cc
Normal file
60
xtldr/data.cc
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/data.cc
|
||||||
|
* DESCRIPTION: XT Boot Loader global and static data
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
* Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* XT Boot Loader menu list */
|
||||||
|
PLIST_ENTRY Configuration::BootMenuList = NULLPTR;
|
||||||
|
|
||||||
|
/* XT Boot Loader configuration list */
|
||||||
|
LIST_ENTRY Configuration::Config;
|
||||||
|
|
||||||
|
/* XT Boot Loader loaded configuration */
|
||||||
|
LIST_ENTRY Configuration::ConfigSections;
|
||||||
|
|
||||||
|
/* List of user-editable boot options */
|
||||||
|
PCWSTR Configuration::EditableConfigOptions[] = {
|
||||||
|
L"BootModules", L"SystemType", L"SystemPath",
|
||||||
|
L"KernelFile", L"InitrdFile", L"HalFile",
|
||||||
|
L"Parameters", NULLPTR
|
||||||
|
};
|
||||||
|
|
||||||
|
/* XT Boot Loader serial ports list */
|
||||||
|
ULONG Debug::ComPortList[COMPORT_COUNT] = COMPORT_ADDRESS;
|
||||||
|
|
||||||
|
/* A list of enabled debug ports */
|
||||||
|
ULONG Debug::EnabledDebugPorts;
|
||||||
|
|
||||||
|
/* XT Boot Loader serial port handle */
|
||||||
|
CPPORT Debug::SerialPort;
|
||||||
|
|
||||||
|
/* XT Boot Loader registered boot protocol list */
|
||||||
|
LIST_ENTRY Protocol::BootProtocols;
|
||||||
|
|
||||||
|
/* XT Boot Loader protocol */
|
||||||
|
XTBL_LOADER_PROTOCOL Protocol::LoaderProtocol;
|
||||||
|
|
||||||
|
/* XT Boot Loader loaded modules list */
|
||||||
|
LIST_ENTRY Protocol::LoadedModules;
|
||||||
|
|
||||||
|
/* List of available block devices */
|
||||||
|
LIST_ENTRY Volume::EfiBlockDevices;
|
||||||
|
|
||||||
|
/* Pointer to the boot menu callback routine */
|
||||||
|
PBL_XT_BOOT_MENU XtLoader::BootMenu = NULLPTR;
|
||||||
|
|
||||||
|
/* EFI Image Handle */
|
||||||
|
EFI_HANDLE XtLoader::EfiImageHandle;
|
||||||
|
|
||||||
|
/* EFI System Table */
|
||||||
|
PEFI_SYSTEM_TABLE XtLoader::EfiSystemTable;
|
||||||
|
|
||||||
|
/* XT Boot Loader status data */
|
||||||
|
XTBL_STATUS XtLoader::LoaderStatus = {0};
|
287
xtldr/debug.c
287
xtldr/debug.c
@@ -1,287 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/debug.c
|
|
||||||
* DESCRIPTION: XT Boot Loader debugging support
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xtldr.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine formats the input string and prints it out to the debug ports.
|
|
||||||
*
|
|
||||||
* @param Format
|
|
||||||
* The formatted string that is to be written to the output.
|
|
||||||
*
|
|
||||||
* @param ...
|
|
||||||
* Depending on the format string, this routine might expect a sequence of additional arguments.
|
|
||||||
*
|
|
||||||
* @return This routine does not return any value.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDebugPrint(IN PUSHORT Format,
|
|
||||||
IN ...)
|
|
||||||
{
|
|
||||||
RTL_PRINT_CONTEXT ConsolePrintContext, SerialPrintContext;
|
|
||||||
VA_LIST Arguments;
|
|
||||||
|
|
||||||
/* Check if debugging enabled and if EFI serial port is fully initialized */
|
|
||||||
if(DEBUG)
|
|
||||||
{
|
|
||||||
/* Initialize the print contexts */
|
|
||||||
ConsolePrintContext.WriteWideCharacter = BlpConsolePutChar;
|
|
||||||
SerialPrintContext.WriteWideCharacter = BlpDebugPutChar;
|
|
||||||
|
|
||||||
/* Initialise the va_list */
|
|
||||||
VA_START(Arguments, Format);
|
|
||||||
|
|
||||||
/* Check if serial debug port is enabled */
|
|
||||||
if((BlpStatus.DebugPort & XTBL_DEBUGPORT_SERIAL) && (BlpStatus.SerialPort.Flags & COMPORT_FLAG_INIT))
|
|
||||||
{
|
|
||||||
/* Format and print the string to the serial console */
|
|
||||||
RtlFormatWideString(&SerialPrintContext, (PWCHAR)Format, Arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if screen debug port is enabled and Boot Services are still available */
|
|
||||||
if((BlpStatus.DebugPort & XTBL_DEBUGPORT_SCREEN) && (BlpStatus.BootServices == TRUE))
|
|
||||||
{
|
|
||||||
/* Format and print the string to the screen */
|
|
||||||
RtlFormatWideString(&ConsolePrintContext, (PWCHAR)Format, Arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up the va_list */
|
|
||||||
VA_END(Arguments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a character to the serial console.
|
|
||||||
*
|
|
||||||
* @param Character
|
|
||||||
* The integer promotion of the character to be written.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
XTSTATUS
|
|
||||||
BlpDebugPutChar(IN USHORT Character)
|
|
||||||
{
|
|
||||||
USHORT Buffer[2];
|
|
||||||
|
|
||||||
/* Write character to the serial console */
|
|
||||||
Buffer[0] = Character;
|
|
||||||
Buffer[1] = 0;
|
|
||||||
HlComPortPutByte(&BlpStatus.SerialPort, Buffer[0]);
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine initializes the XTLDR debug console.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpInitializeDebugConsole()
|
|
||||||
{
|
|
||||||
ULONG PortAddress, PortNumber, BaudRate;
|
|
||||||
PWCHAR DebugConfiguration, DebugPort, LastPort;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
/* Set default serial port options */
|
|
||||||
PortAddress = 0;
|
|
||||||
PortNumber = 0;
|
|
||||||
BaudRate = 0;
|
|
||||||
|
|
||||||
/* Get debug configuration */
|
|
||||||
DebugConfiguration = BlGetConfigValue(L"DEBUG");
|
|
||||||
|
|
||||||
/* Make sure any debug options are provided and debug console is not initialized yet */
|
|
||||||
if(DebugConfiguration && BlpStatus.DebugPort == 0)
|
|
||||||
{
|
|
||||||
/* Find all debug ports */
|
|
||||||
DebugPort = RtlTokenizeWideString(DebugConfiguration, L";", &LastPort);
|
|
||||||
|
|
||||||
/* Iterate over all debug ports */
|
|
||||||
while(DebugPort != NULL)
|
|
||||||
{
|
|
||||||
/* Check what port is set for debugging */
|
|
||||||
if(RtlCompareWideStringInsensitive(DebugPort, L"COM", 3) == 0)
|
|
||||||
{
|
|
||||||
/* Read COM port number */
|
|
||||||
DebugPort += 3;
|
|
||||||
while(*DebugPort >= '0' && *DebugPort <= '9')
|
|
||||||
{
|
|
||||||
/* Get port number */
|
|
||||||
PortNumber *= 10;
|
|
||||||
PortNumber += *DebugPort - '0';
|
|
||||||
DebugPort++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if custom COM port address supplied */
|
|
||||||
if(PortNumber == 0 && RtlCompareWideStringInsensitive(DebugPort, L":0x", 3) == 0)
|
|
||||||
{
|
|
||||||
/* COM port address provided */
|
|
||||||
DebugPort += 3;
|
|
||||||
while((*DebugPort >= '0' && *DebugPort <= '9') ||
|
|
||||||
(*DebugPort >= 'A' && *DebugPort <= 'F') ||
|
|
||||||
(*DebugPort >= 'a' && *DebugPort <= 'f'))
|
|
||||||
{
|
|
||||||
/* Get port address */
|
|
||||||
PortAddress *= 16;
|
|
||||||
if(*DebugPort >= '0' && *DebugPort <= '9')
|
|
||||||
{
|
|
||||||
PortAddress += *DebugPort - '0';
|
|
||||||
}
|
|
||||||
else if(*DebugPort >= 'A' && *DebugPort <= 'F')
|
|
||||||
{
|
|
||||||
PortAddress += *DebugPort - 'A' + 10;
|
|
||||||
}
|
|
||||||
else if(*DebugPort >= 'a' && *DebugPort <= 'f')
|
|
||||||
{
|
|
||||||
PortAddress += *DebugPort - 'a' + 10;
|
|
||||||
}
|
|
||||||
DebugPort++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look for additional COM port parameters */
|
|
||||||
if(*DebugPort == ',')
|
|
||||||
{
|
|
||||||
/* Baud rate provided */
|
|
||||||
DebugPort++;
|
|
||||||
while(*DebugPort >= '0' && *DebugPort <= '9')
|
|
||||||
{
|
|
||||||
/* Get baud rate */
|
|
||||||
BaudRate *= 10;
|
|
||||||
BaudRate += *DebugPort - '0';
|
|
||||||
DebugPort++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable debug port */
|
|
||||||
BlpStatus.DebugPort |= XTBL_DEBUGPORT_SERIAL;
|
|
||||||
}
|
|
||||||
else if(RtlCompareWideStringInsensitive(DebugPort, L"SCREEN", 5) == 0)
|
|
||||||
{
|
|
||||||
/* Enable debug port */
|
|
||||||
BlpStatus.DebugPort |= XTBL_DEBUGPORT_SCREEN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Unsupported debug port specified */
|
|
||||||
BlConsolePrint(L"ERROR: Unsupported debug port ('%S') specified\n", DebugPort);
|
|
||||||
BlSleepExecution(3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Take next debug port */
|
|
||||||
DebugPort = RtlTokenizeWideString(NULL, L";", &LastPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if serial debug port is enabled */
|
|
||||||
if(BlpStatus.DebugPort & XTBL_DEBUGPORT_SERIAL)
|
|
||||||
{
|
|
||||||
/* Try to initialize COM port */
|
|
||||||
Status = BlpInitializeSerialPort(PortNumber, PortAddress, BaudRate);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Remove serial debug port, as COM port initialization failed and return */
|
|
||||||
BlpStatus.DebugPort &= ~XTBL_DEBUGPORT_SERIAL;
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine initializes the serial debug console.
|
|
||||||
*
|
|
||||||
* @param PortNumber
|
|
||||||
* Supplies a port number.
|
|
||||||
*
|
|
||||||
* @param PortAddress
|
|
||||||
* Supplies an address of the COM port.
|
|
||||||
*
|
|
||||||
* @param BaudRate
|
|
||||||
* Supplies an optional port baud rate.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpInitializeSerialPort(IN ULONG PortNumber,
|
|
||||||
IN ULONG PortAddress,
|
|
||||||
IN ULONG BaudRate)
|
|
||||||
{
|
|
||||||
EFI_STATUS EfiStatus;
|
|
||||||
XTSTATUS Status;
|
|
||||||
|
|
||||||
/* Check if custom COM port address supplied */
|
|
||||||
if(!PortAddress)
|
|
||||||
{
|
|
||||||
/* We support only a pre-defined number of ports */
|
|
||||||
if(PortNumber > COMPORT_COUNT)
|
|
||||||
{
|
|
||||||
/* Fail if wrong/unsupported port used */
|
|
||||||
return STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if serial port is set */
|
|
||||||
if(PortNumber == 0)
|
|
||||||
{
|
|
||||||
/* Use COM1 by default */
|
|
||||||
PortNumber = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set custom port address based on the port number and print debug message */
|
|
||||||
PortAddress = BlComPortList[PortNumber - 1];
|
|
||||||
BlConsolePrint(L"Initializing serial console at port COM%d\n", PortNumber);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Custom port address supplied, print debug message */
|
|
||||||
BlConsolePrint(L"Initializing serial console at COM port address: 0x%lX\n", PortAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize COM port */
|
|
||||||
Status = HlInitializeComPort(&BlpStatus.SerialPort, UlongToPtr(PortAddress), BaudRate);
|
|
||||||
|
|
||||||
/* Port not found under supplied address */
|
|
||||||
if(Status == STATUS_NOT_FOUND && PortAddress)
|
|
||||||
{
|
|
||||||
/* This might be PCI(E) serial controller, try to activate I/O space access first */
|
|
||||||
EfiStatus = BlpActivateSerialIOController();
|
|
||||||
if(EfiStatus == STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Try to reinitialize COM port */
|
|
||||||
BlConsolePrint(L"Enabled I/O space access for all PCI(E) serial controllers found\n");
|
|
||||||
Status = HlInitializeComPort(&BlpStatus.SerialPort, UlongToPtr(PortAddress), BaudRate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check COM port initialization status code */
|
|
||||||
if(Status != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Serial port initialization failed, mark as not ready */
|
|
||||||
return STATUS_EFI_NOT_READY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
402
xtldr/debug.cc
Normal file
402
xtldr/debug.cc
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/debug.cc
|
||||||
|
* DESCRIPTION: XT Boot Loader debugging support
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables I/O space access to all serial controllers found on the PCI(E) root bridge.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Debug::ActivateSerialIOController()
|
||||||
|
{
|
||||||
|
EFI_GUID PciGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
|
||||||
|
PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciDev;
|
||||||
|
USHORT Bus, Device, Function, Command;
|
||||||
|
UINT_PTR Index, PciHandleSize;
|
||||||
|
PEFI_HANDLE PciHandle = NULLPTR;
|
||||||
|
PCI_COMMON_HEADER PciHeader;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
ULONGLONG Address;
|
||||||
|
|
||||||
|
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
|
||||||
|
PciHandleSize = sizeof(EFI_HANDLE);
|
||||||
|
Status = Memory::AllocatePool(PciHandleSize, (PVOID*)&PciHandle);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory allocation failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get all instances of PciRootBridgeIo */
|
||||||
|
Status = XtLoader::GetEfiSystemTable()->BootServices->LocateHandle(ByProtocol, &PciGuid, NULLPTR,
|
||||||
|
&PciHandleSize, PciHandle);
|
||||||
|
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
||||||
|
{
|
||||||
|
/* Reallocate more memory as requested by UEFI */
|
||||||
|
Memory::FreePool(PciHandle);
|
||||||
|
Status = Memory::AllocatePool(PciHandleSize, (PVOID*)&PciHandle);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Memory reallocation failure */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Second attempt to get instances of PciRootBridgeIo */
|
||||||
|
Status = XtLoader::GetEfiSystemTable()->BootServices->LocateHandle(ByProtocol, &PciGuid, NULLPTR,
|
||||||
|
&PciHandleSize, PciHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure successfully obtained PciRootBridgeIo instances */
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to get PciRootBridgeIo instances */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enumerate all devices for each handle, which decides a segment and a bus number range */
|
||||||
|
for(Index = 0; Index < (PciHandleSize / sizeof(EFI_HANDLE)); Index++)
|
||||||
|
{
|
||||||
|
/* Get inferface from the protocol */
|
||||||
|
Status = XtLoader::GetEfiSystemTable()->BootServices->HandleProtocol(PciHandle[Index], &PciGuid, (PVOID*)&PciDev);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to get interface */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enumerate whole PCI bridge */
|
||||||
|
for(Bus = 0; Bus <= PCI_MAX_BRIDGE_NUMBER; Bus++)
|
||||||
|
{
|
||||||
|
/* Enumerate all devices for each bus */
|
||||||
|
for(Device = 0; Device < PCI_MAX_DEVICES; Device++)
|
||||||
|
{
|
||||||
|
/* Enumerate all functions for each devices */
|
||||||
|
for(Function = 0; Function < PCI_MAX_FUNCTION; Function++)
|
||||||
|
{
|
||||||
|
/* Read configuration space */
|
||||||
|
Address = ((ULONGLONG)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) +
|
||||||
|
(((UINT_PTR) Function) << 8) + ((UINT_PTR) 0)));
|
||||||
|
PciDev->Pci.Read(PciDev, EfiPciIoWidthUint32, Address, sizeof (PciHeader) / sizeof (UINT), &PciHeader);
|
||||||
|
|
||||||
|
/* Check if device exists */
|
||||||
|
if(PciHeader.VendorId == PCI_INVALID_VENDORID)
|
||||||
|
{
|
||||||
|
/* Skip non-existen device */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if device is serial controller or multiport serial controller */
|
||||||
|
if(PciHeader.BaseClass == 0x07 && (PciHeader.SubClass == 0x00 || PciHeader.SubClass == 0x02))
|
||||||
|
{
|
||||||
|
/* Enable I/O space access */
|
||||||
|
Address |= 0x4;
|
||||||
|
Command = PCI_ENABLE_IO_SPACE;
|
||||||
|
Status = PciDev->Pci.Write(PciDev, EfiPciIoWidthUint16, Address, 1, &Command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return SUCCESS */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine initializes the XTLDR debug console.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Debug::InitializeDebugConsole()
|
||||||
|
{
|
||||||
|
ULONG PortAddress, PortNumber, BaudRate;
|
||||||
|
PWCHAR DebugConfiguration, DebugPort, LastPort;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Set default serial port options */
|
||||||
|
PortAddress = 0;
|
||||||
|
PortNumber = 0;
|
||||||
|
BaudRate = 0;
|
||||||
|
|
||||||
|
/* Get debug configuration */
|
||||||
|
Configuration::GetValue(L"DEBUG", &DebugConfiguration);
|
||||||
|
|
||||||
|
/* Make sure any debug options are provided and debug console is not initialized yet */
|
||||||
|
if(DebugConfiguration && EnabledDebugPorts == 0)
|
||||||
|
{
|
||||||
|
/* Find all debug ports */
|
||||||
|
DebugPort = RTL::WideString::TokenizeWideString(DebugConfiguration, L";", &LastPort);
|
||||||
|
|
||||||
|
/* Iterate over all debug ports */
|
||||||
|
while(DebugPort != NULLPTR)
|
||||||
|
{
|
||||||
|
/* Check what port is set for debugging */
|
||||||
|
if(RTL::WideString::CompareWideStringInsensitive(DebugPort, L"COM", 3) == 0)
|
||||||
|
{
|
||||||
|
/* Read COM port number */
|
||||||
|
DebugPort += 3;
|
||||||
|
while(*DebugPort >= '0' && *DebugPort <= '9')
|
||||||
|
{
|
||||||
|
/* Get port number */
|
||||||
|
PortNumber *= 10;
|
||||||
|
PortNumber += *DebugPort - '0';
|
||||||
|
DebugPort++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if custom COM port address supplied */
|
||||||
|
if(PortNumber == 0 && RTL::WideString::CompareWideStringInsensitive(DebugPort, L":0x", 3) == 0)
|
||||||
|
{
|
||||||
|
/* COM port address provided */
|
||||||
|
DebugPort += 3;
|
||||||
|
while((*DebugPort >= '0' && *DebugPort <= '9') ||
|
||||||
|
(*DebugPort >= 'A' && *DebugPort <= 'F') ||
|
||||||
|
(*DebugPort >= 'a' && *DebugPort <= 'f'))
|
||||||
|
{
|
||||||
|
/* Get port address */
|
||||||
|
PortAddress *= 16;
|
||||||
|
if(*DebugPort >= '0' && *DebugPort <= '9')
|
||||||
|
{
|
||||||
|
PortAddress += *DebugPort - '0';
|
||||||
|
}
|
||||||
|
else if(*DebugPort >= 'A' && *DebugPort <= 'F')
|
||||||
|
{
|
||||||
|
PortAddress += *DebugPort - 'A' + 10;
|
||||||
|
}
|
||||||
|
else if(*DebugPort >= 'a' && *DebugPort <= 'f')
|
||||||
|
{
|
||||||
|
PortAddress += *DebugPort - 'a' + 10;
|
||||||
|
}
|
||||||
|
DebugPort++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look for additional COM port parameters */
|
||||||
|
if(*DebugPort == ',')
|
||||||
|
{
|
||||||
|
/* Baud rate provided */
|
||||||
|
DebugPort++;
|
||||||
|
while(*DebugPort >= '0' && *DebugPort <= '9')
|
||||||
|
{
|
||||||
|
/* Get baud rate */
|
||||||
|
BaudRate *= 10;
|
||||||
|
BaudRate += *DebugPort - '0';
|
||||||
|
DebugPort++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable debug port */
|
||||||
|
EnabledDebugPorts |= XTBL_DEBUGPORT_SERIAL;
|
||||||
|
}
|
||||||
|
else if(RTL::WideString::CompareWideStringInsensitive(DebugPort, L"SCREEN", 5) == 0)
|
||||||
|
{
|
||||||
|
/* Enable debug port */
|
||||||
|
EnabledDebugPorts |= XTBL_DEBUGPORT_SCREEN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Unsupported debug port specified */
|
||||||
|
Console::Print(L"ERROR: Unsupported debug port ('%S') specified\n", DebugPort);
|
||||||
|
EfiUtils::SleepExecution(3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Take next debug port */
|
||||||
|
DebugPort = RTL::WideString::TokenizeWideString(NULLPTR, L";", &LastPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if serial debug port is enabled */
|
||||||
|
if(EnabledDebugPorts & XTBL_DEBUGPORT_SERIAL)
|
||||||
|
{
|
||||||
|
/* Try to initialize COM port */
|
||||||
|
Status = InitializeSerialPort(PortNumber, PortAddress, BaudRate);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Remove serial debug port, as COM port initialization failed and return */
|
||||||
|
EnabledDebugPorts &= ~XTBL_DEBUGPORT_SERIAL;
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine initializes the serial debug console.
|
||||||
|
*
|
||||||
|
* @param PortNumber
|
||||||
|
* Supplies a port number.
|
||||||
|
*
|
||||||
|
* @param PortAddress
|
||||||
|
* Supplies an address of the COM port.
|
||||||
|
*
|
||||||
|
* @param BaudRate
|
||||||
|
* Supplies an optional port baud rate.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Debug::InitializeSerialPort(IN ULONG PortNumber,
|
||||||
|
IN ULONG PortAddress,
|
||||||
|
IN ULONG BaudRate)
|
||||||
|
{
|
||||||
|
EFI_STATUS EfiStatus;
|
||||||
|
XTSTATUS Status;
|
||||||
|
|
||||||
|
/* Check if custom COM port address supplied */
|
||||||
|
if(!PortAddress)
|
||||||
|
{
|
||||||
|
/* We support only a pre-defined number of ports */
|
||||||
|
if(PortNumber > COMPORT_COUNT)
|
||||||
|
{
|
||||||
|
/* Fail if wrong/unsupported port used */
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if serial port is set */
|
||||||
|
if(PortNumber == 0)
|
||||||
|
{
|
||||||
|
/* Use COM1 by default */
|
||||||
|
PortNumber = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set custom port address based on the port number and print debug message */
|
||||||
|
PortAddress = ComPortList[PortNumber - 1];
|
||||||
|
Console::Print(L"Initializing serial console at port COM%d\n", PortNumber);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Custom port address supplied, print debug message */
|
||||||
|
Console::Print(L"Initializing serial console at COM port address: 0x%lX\n", PortAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize COM port */
|
||||||
|
Status = HL::ComPort::InitializeComPort(&SerialPort, (PUCHAR)UlongToPtr(PortAddress), BaudRate);
|
||||||
|
|
||||||
|
/* Port not found under supplied address */
|
||||||
|
if(Status == STATUS_NOT_FOUND && PortAddress)
|
||||||
|
{
|
||||||
|
/* This might be PCI(E) serial controller, try to activate I/O space access first */
|
||||||
|
EfiStatus = ActivateSerialIOController();
|
||||||
|
if(EfiStatus == STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Try to reinitialize COM port */
|
||||||
|
Console::Print(L"Enabled I/O space access for all PCI(E) serial controllers found\n");
|
||||||
|
Status = HL::ComPort::InitializeComPort(&SerialPort, (PUCHAR)UlongToPtr(PortAddress), BaudRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check COM port initialization status code */
|
||||||
|
if(Status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Serial port initialization failed, mark as not ready */
|
||||||
|
return STATUS_EFI_NOT_READY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine formats the input string and prints it out to the debug ports.
|
||||||
|
*
|
||||||
|
* @param Format
|
||||||
|
* The formatted string that is to be written to the output.
|
||||||
|
*
|
||||||
|
* @param ...
|
||||||
|
* Depending on the format string, this routine might expect a sequence of additional arguments.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
VOID
|
||||||
|
Debug::Print(IN PCWSTR Format,
|
||||||
|
IN ...)
|
||||||
|
{
|
||||||
|
RTL_PRINT_CONTEXT ConsolePrintContext, SerialPrintContext;
|
||||||
|
VA_LIST Arguments;
|
||||||
|
|
||||||
|
/* Check if debugging enabled and if EFI serial port is fully initialized */
|
||||||
|
if(DEBUG)
|
||||||
|
{
|
||||||
|
/* Initialize the print contexts */
|
||||||
|
ConsolePrintContext.WriteWideCharacter = Console::PutChar;
|
||||||
|
SerialPrintContext.WriteWideCharacter = PutChar;
|
||||||
|
|
||||||
|
/* Initialise the va_list */
|
||||||
|
VA_START(Arguments, Format);
|
||||||
|
|
||||||
|
/* Check if serial debug port is enabled */
|
||||||
|
if((EnabledDebugPorts & XTBL_DEBUGPORT_SERIAL) && (SerialPort.Flags & COMPORT_FLAG_INIT))
|
||||||
|
{
|
||||||
|
/* Format and print the string to the serial console */
|
||||||
|
RTL::WideString::FormatWideString(&SerialPrintContext, (PWCHAR)Format, Arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if screen debug port is enabled and Boot Services are still available */
|
||||||
|
if((EnabledDebugPorts & XTBL_DEBUGPORT_SCREEN) && (XtLoader::GetBootServicesStatus() == TRUE))
|
||||||
|
{
|
||||||
|
/* Format and print the string to the screen */
|
||||||
|
RTL::WideString::FormatWideString(&ConsolePrintContext, (PWCHAR)Format, Arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clean up the va_list */
|
||||||
|
VA_END(Arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a character to the serial console.
|
||||||
|
*
|
||||||
|
* @param Character
|
||||||
|
* The integer promotion of the character to be written.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
XTSTATUS
|
||||||
|
Debug::PutChar(IN WCHAR Character)
|
||||||
|
{
|
||||||
|
WCHAR Buffer[2];
|
||||||
|
|
||||||
|
/* Write character to the serial console */
|
||||||
|
Buffer[0] = Character;
|
||||||
|
Buffer[1] = 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
|
||||||
|
BOOLEAN
|
||||||
|
Debug::SerialPortReady()
|
||||||
|
{
|
||||||
|
return (SerialPort.Flags & COMPORT_FLAG_INIT);
|
||||||
|
}
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/efiutils.c
|
* FILE: xtldr/efiutils.cc
|
||||||
* DESCRIPTION: EFI related routines for XT Boot Loader
|
* DESCRIPTION: EFI related routines for XT Boot Loader
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,29 +18,35 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlEnterFirmwareSetup()
|
EfiUtils::EnterFirmwareSetup()
|
||||||
{
|
{
|
||||||
EFI_GUID Guid = EFI_GLOBAL_VARIABLE_GUID;
|
EFI_GUID Guid = EFI_GLOBAL_VARIABLE_GUID;
|
||||||
PULONGLONG SetupSupport;
|
PULONGLONG SetupSupport = NULLPTR;
|
||||||
ULONGLONG Indications;
|
ULONGLONG Indications;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Check if booting into firmware interface is supported */
|
/* Check if booting into firmware interface is supported */
|
||||||
Status = BlGetEfiVariable(&Guid, L"OsIndicationsSupported", (PVOID*)&SetupSupport);
|
Status = GetEfiVariable(&Guid, L"OsIndicationsSupported", (PVOID*)&SetupSupport);
|
||||||
if(Status != STATUS_EFI_SUCCESS || !(*SetupSupport & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
|
if(Status != STATUS_EFI_SUCCESS || !(*SetupSupport & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
|
||||||
{
|
{
|
||||||
/* Reboot into firmware setup is not supported */
|
/* Reboot into firmware setup is not supported */
|
||||||
BlDebugPrint(L"WARNING: Reboot into firmware setup interface not supported\n");
|
Debug::Print(L"WARNING: Reboot into firmware setup interface not supported\n");
|
||||||
|
if(SetupSupport)
|
||||||
|
{
|
||||||
|
Memory::FreePool((PVOID)SetupSupport);
|
||||||
|
}
|
||||||
return STATUS_EFI_UNSUPPORTED;
|
return STATUS_EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Memory::FreePool((PVOID)SetupSupport);
|
||||||
|
|
||||||
/* Get the value of OsIndications variable */
|
/* Get the value of OsIndications variable */
|
||||||
Indications = 0;
|
Indications = 0;
|
||||||
Status = BlGetEfiVariable(&Guid, L"OsIndications", (PVOID)&Indications);
|
Status = GetEfiVariable(&Guid, L"OsIndications", (PVOID*)&Indications);
|
||||||
|
|
||||||
/* Enable FW setup on next boot */
|
/* Enable FW setup on next boot */
|
||||||
Indications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
|
Indications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
|
||||||
Status = BlSetEfiVariable(&Guid, L"OsIndications", (PVOID)&Indications, sizeof(Indications));
|
Status = SetEfiVariable(&Guid, L"OsIndications", (PVOID)&Indications, sizeof(Indications));
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to update OsIndications variable */
|
/* Failed to update OsIndications variable */
|
||||||
@@ -48,7 +54,7 @@ BlEnterFirmwareSetup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reboot into firmware setup */
|
/* Reboot into firmware setup */
|
||||||
BlRebootSystem();
|
RebootSystem();
|
||||||
|
|
||||||
/* Must not reach this point, just make the compiler happy */
|
/* Must not reach this point, just make the compiler happy */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
@@ -63,33 +69,33 @@ BlEnterFirmwareSetup()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlExitBootServices()
|
EfiUtils::ExitBootServices()
|
||||||
{
|
{
|
||||||
PEFI_MEMORY_MAP MemoryMap;
|
PEFI_MEMORY_MAP MemoryMap;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
ULONG Counter;
|
ULONG Counter;
|
||||||
|
|
||||||
/* Boot Services might be partially shutdown, so mark them as unavailable */
|
/* Boot Services might be partially shutdown, so mark them as unavailable */
|
||||||
BlpStatus.BootServices = FALSE;
|
XtLoader::DisableBootServices();
|
||||||
|
|
||||||
/* Allocate buffer for EFI memory map */
|
/* Allocate buffer for EFI memory map */
|
||||||
Status = BlAllocateMemoryPool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
Status = Memory::AllocatePool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%zX)\n", Status);
|
Debug::Print(L"ERROR: Memory allocation failure (Status Code: 0x%zX)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero fill the buffer and initialize counter */
|
/* Zero fill the buffer and initialize counter */
|
||||||
RtlZeroMemory(MemoryMap, sizeof(EFI_MEMORY_MAP));
|
RTL::Memory::ZeroMemory(MemoryMap, sizeof(EFI_MEMORY_MAP));
|
||||||
Counter = 0xFF;
|
Counter = 0xFF;
|
||||||
|
|
||||||
/* Attempt to exit boot services */
|
/* Attempt to exit boot services */
|
||||||
while(Counter > 0)
|
while(Counter > 0)
|
||||||
{
|
{
|
||||||
/* Get memory map each time as it can change between two calls */
|
/* Get memory map each time as it can change between two calls */
|
||||||
Status = BlGetMemoryMap(MemoryMap);
|
Status = Memory::GetMemoryMap(MemoryMap);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to get new memory map */
|
/* Failed to get new memory map */
|
||||||
@@ -97,7 +103,8 @@ BlExitBootServices()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Exit boot services */
|
/* Exit boot services */
|
||||||
Status = EfiSystemTable->BootServices->ExitBootServices(EfiImageHandle, MemoryMap->MapKey);
|
Status = XtLoader::GetEfiSystemTable()->BootServices->ExitBootServices(XtLoader::GetEfiImageHandle(),
|
||||||
|
MemoryMap->MapKey);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@@ -126,25 +133,26 @@ BlExitBootServices()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetConfigurationTable(IN PEFI_GUID TableGuid,
|
EfiUtils::GetConfigurationTable(IN PEFI_GUID TableGuid,
|
||||||
OUT PVOID *Table)
|
OUT PVOID *Table)
|
||||||
{
|
{
|
||||||
SIZE_T Index;
|
SIZE_T Index;
|
||||||
|
|
||||||
/* Iterate through all system configuration tables */
|
/* Iterate through all system configuration tables */
|
||||||
for(Index = 0; Index < EfiSystemTable->NumberOfTableEntries; Index++)
|
for(Index = 0; Index < XtLoader::GetEfiSystemTable()->NumberOfTableEntries; Index++)
|
||||||
{
|
{
|
||||||
/* Check if this table matches requested table */
|
/* Check if this table matches requested table */
|
||||||
if(RtlCompareGuids((PGUID)&(EfiSystemTable->ConfigurationTable[Index].VendorGuid), (PGUID)TableGuid))
|
if(RTL::Guid::CompareGuids((PGUID)&(XtLoader::GetEfiSystemTable()->ConfigurationTable[Index].VendorGuid),
|
||||||
|
(PGUID)TableGuid))
|
||||||
{
|
{
|
||||||
/* Found requested table, return success */
|
/* Found requested table, return success */
|
||||||
*Table = EfiSystemTable->ConfigurationTable[Index].VendorTable;
|
*Table = XtLoader::GetEfiSystemTable()->ConfigurationTable[Index].VendorTable;
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table not found */
|
/* Table not found */
|
||||||
*Table = NULL;
|
*Table = NULLPTR;
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,17 +174,17 @@ BlGetConfigurationTable(IN PEFI_GUID TableGuid,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetEfiVariable(IN PEFI_GUID Vendor,
|
EfiUtils::GetEfiVariable(IN PEFI_GUID Vendor,
|
||||||
IN PWCHAR VariableName,
|
IN PCWSTR VariableName,
|
||||||
OUT PVOID *VariableValue)
|
OUT PVOID *VariableValue)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
UINT_PTR Size;
|
UINT_PTR Size = 0;
|
||||||
|
|
||||||
/* Allocate a buffer for storing a variable's value */
|
/* Allocate a buffer for storing a variable's value */
|
||||||
Size = EFI_MAXIMUM_VARIABLE_SIZE * sizeof(PWCHAR);
|
Size = EFI_MAXIMUM_VARIABLE_SIZE * sizeof(PWCHAR);
|
||||||
Status = BlAllocateMemoryPool(Size, (PVOID*)&Buffer);
|
Status = Memory::AllocatePool(Size, (PVOID*)&Buffer);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -184,7 +192,8 @@ BlGetEfiVariable(IN PEFI_GUID Vendor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Attempt to get variable value */
|
/* Attempt to get variable value */
|
||||||
Status = EfiSystemTable->RuntimeServices->GetVariable(VariableName, Vendor, NULL, &Size, Buffer);
|
Status = XtLoader::GetEfiSystemTable()->RuntimeServices->GetVariable((PWCHAR)VariableName, Vendor, NULLPTR,
|
||||||
|
&Size, Buffer);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to get variable, probably not found such one */
|
/* Failed to get variable, probably not found such one */
|
||||||
@@ -210,7 +219,7 @@ BlGetEfiVariable(IN PEFI_GUID Vendor,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
BlGetRandomValue(IN OUT PULONGLONG RNGBuffer)
|
EfiUtils::GetRandomValue(IN OUT PULONGLONG RNGBuffer)
|
||||||
{
|
{
|
||||||
/* Recalculate RNG buffer with XORSHIFT */
|
/* Recalculate RNG buffer with XORSHIFT */
|
||||||
*RNGBuffer ^= *RNGBuffer >> 12;
|
*RNGBuffer ^= *RNGBuffer >> 12;
|
||||||
@@ -230,21 +239,21 @@ BlGetRandomValue(IN OUT PULONGLONG RNGBuffer)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
INT_PTR
|
INT_PTR
|
||||||
BlGetSecureBootStatus()
|
EfiUtils::GetSecureBootStatus()
|
||||||
{
|
{
|
||||||
EFI_GUID VarGuid = EFI_GLOBAL_VARIABLE_GUID;
|
EFI_GUID VarGuid = EFI_GLOBAL_VARIABLE_GUID;
|
||||||
INT_PTR SecureBootStatus = 0;
|
INT_PTR SecureBootStatus = 0;
|
||||||
UCHAR VarValue = 0;
|
INT_PTR VarValue = 0;
|
||||||
UINT_PTR Size;
|
UINT_PTR Size;
|
||||||
|
|
||||||
Size = sizeof(VarValue);
|
Size = sizeof(INT_PTR);
|
||||||
if(EfiSystemTable->RuntimeServices->GetVariable(L"SecureBoot", &VarGuid,
|
if(XtLoader::GetEfiSystemTable()->RuntimeServices->GetVariable((PWCHAR)L"SecureBoot", &VarGuid,
|
||||||
NULL, &Size, &VarValue) == STATUS_EFI_SUCCESS)
|
NULLPTR, &Size, &VarValue) == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
SecureBootStatus = (INT_PTR)VarValue;
|
SecureBootStatus = VarValue;
|
||||||
|
Size = sizeof(INT_PTR);
|
||||||
if((EfiSystemTable->RuntimeServices->GetVariable(L"SetupMode", &VarGuid,
|
if((XtLoader::GetEfiSystemTable()->RuntimeServices->GetVariable((PWCHAR)L"SetupMode", &VarGuid,
|
||||||
NULL, &Size, &VarValue) == STATUS_EFI_SUCCESS) && VarValue != 0)
|
NULLPTR, &Size, &VarValue) == STATUS_EFI_SUCCESS) && VarValue != 0)
|
||||||
{
|
{
|
||||||
SecureBootStatus = -1;
|
SecureBootStatus = -1;
|
||||||
}
|
}
|
||||||
@@ -266,7 +275,7 @@ BlGetSecureBootStatus()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlInitializeEntropy(PULONGLONG RNGBuffer)
|
EfiUtils::InitializeEntropy(PULONGLONG RNGBuffer)
|
||||||
{
|
{
|
||||||
EFI_GUID RngGuid = EFI_RNG_PROTOCOL_GUID;
|
EFI_GUID RngGuid = EFI_RNG_PROTOCOL_GUID;
|
||||||
PEFI_RNG_PROTOCOL Rng;
|
PEFI_RNG_PROTOCOL Rng;
|
||||||
@@ -274,11 +283,11 @@ BlInitializeEntropy(PULONGLONG RNGBuffer)
|
|||||||
ULONGLONG Seed;
|
ULONGLONG Seed;
|
||||||
|
|
||||||
/* Initialize variables */
|
/* Initialize variables */
|
||||||
Rng = NULL;
|
Rng = NULLPTR;
|
||||||
Seed = 0;
|
Seed = 0;
|
||||||
|
|
||||||
/* Locate RNG protocol */
|
/* Locate RNG protocol */
|
||||||
Status = EfiSystemTable->BootServices->LocateProtocol(&RngGuid, NULL, (PVOID *)&Rng);
|
Status = XtLoader::GetEfiSystemTable()->BootServices->LocateProtocol(&RngGuid, NULLPTR, (PVOID *)&Rng);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to locate RNG protocol, return status code */
|
/* Failed to locate RNG protocol, return status code */
|
||||||
@@ -286,7 +295,7 @@ BlInitializeEntropy(PULONGLONG RNGBuffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get RNG value using the default algorithm */
|
/* Get RNG value using the default algorithm */
|
||||||
Status = Rng->GetRNG(Rng, NULL, 8, (PUCHAR)&Seed);
|
Status = Rng->GetRNG(Rng, NULLPTR, 8, (PUCHAR)&Seed);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to get RNG value, return status code */
|
/* Failed to get RNG value, return status code */
|
||||||
@@ -319,13 +328,14 @@ BlInitializeEntropy(PULONGLONG RNGBuffer)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlLoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
EfiUtils::LoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
||||||
IN PVOID ImageData,
|
IN PVOID ImageData,
|
||||||
IN SIZE_T ImageSize,
|
IN SIZE_T ImageSize,
|
||||||
OUT PEFI_HANDLE ImageHandle)
|
OUT PEFI_HANDLE ImageHandle)
|
||||||
{
|
{
|
||||||
/* Load EFI image */
|
/* Load EFI image */
|
||||||
return EfiSystemTable->BootServices->LoadImage(FALSE, EfiImageHandle, DevicePath, ImageData, ImageSize, ImageHandle);
|
return XtLoader::GetEfiSystemTable()->BootServices->LoadImage(FALSE, XtLoader::GetEfiImageHandle(), DevicePath,
|
||||||
|
ImageData, ImageSize, ImageHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,10 +347,10 @@ BlLoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlRebootSystem()
|
EfiUtils::RebootSystem()
|
||||||
{
|
{
|
||||||
/* Reboot machine */
|
/* Reboot machine */
|
||||||
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetCold, STATUS_EFI_SUCCESS, 0, NULL);
|
return XtLoader::GetEfiSystemTable()->RuntimeServices->ResetSystem(EfiResetCold, STATUS_EFI_SUCCESS, 0, NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -364,8 +374,8 @@ BlRebootSystem()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlSetEfiVariable(IN PEFI_GUID Vendor,
|
EfiUtils::SetEfiVariable(IN PEFI_GUID Vendor,
|
||||||
IN PWCHAR VariableName,
|
IN PCWSTR VariableName,
|
||||||
IN PVOID VariableValue,
|
IN PVOID VariableValue,
|
||||||
IN UINT_PTR Size)
|
IN UINT_PTR Size)
|
||||||
{
|
{
|
||||||
@@ -373,7 +383,8 @@ BlSetEfiVariable(IN PEFI_GUID Vendor,
|
|||||||
|
|
||||||
/* Set EFI variable */
|
/* Set EFI variable */
|
||||||
Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
||||||
return EfiSystemTable->RuntimeServices->SetVariable(VariableName, Vendor, Attributes, Size, VariableValue);
|
return XtLoader::GetEfiSystemTable()->RuntimeServices->SetVariable((PWCHAR)VariableName, Vendor, Attributes,
|
||||||
|
Size, VariableValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -385,10 +396,10 @@ BlSetEfiVariable(IN PEFI_GUID Vendor,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlShutdownSystem()
|
EfiUtils::ShutdownSystem()
|
||||||
{
|
{
|
||||||
/* Shutdown machine */
|
/* Shutdown machine */
|
||||||
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, STATUS_EFI_SUCCESS, 0, NULL);
|
return XtLoader::GetEfiSystemTable()->RuntimeServices->ResetSystem(EfiResetShutdown, STATUS_EFI_SUCCESS, 0, NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -403,9 +414,9 @@ BlShutdownSystem()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlSleepExecution(IN ULONG_PTR Milliseconds)
|
EfiUtils::SleepExecution(IN ULONG_PTR Milliseconds)
|
||||||
{
|
{
|
||||||
EfiSystemTable->BootServices->Stall(Milliseconds * 1000);
|
XtLoader::GetEfiSystemTable()->BootServices->Stall(Milliseconds * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -420,9 +431,9 @@ BlSleepExecution(IN ULONG_PTR Milliseconds)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlStartEfiImage(IN EFI_HANDLE ImageHandle)
|
EfiUtils::StartEfiImage(IN EFI_HANDLE ImageHandle)
|
||||||
{
|
{
|
||||||
return EfiSystemTable->BootServices->StartImage(ImageHandle, NULL, NULL);
|
return XtLoader::GetEfiSystemTable()->BootServices->StartImage(ImageHandle, NULLPTR, NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -443,9 +454,9 @@ BlStartEfiImage(IN EFI_HANDLE ImageHandle)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlWaitForEfiEvent(IN UINT_PTR NumberOfEvents,
|
EfiUtils::WaitForEfiEvent(IN UINT_PTR NumberOfEvents,
|
||||||
IN PEFI_EVENT Event,
|
IN PEFI_EVENT Event,
|
||||||
OUT PUINT_PTR Index)
|
OUT PUINT_PTR Index)
|
||||||
{
|
{
|
||||||
return EfiSystemTable->BootServices->WaitForEvent(NumberOfEvents, Event, Index);
|
return XtLoader::GetEfiSystemTable()->BootServices->WaitForEvent(NumberOfEvents, Event, Index);
|
||||||
}
|
}
|
@@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/globals.c
|
|
||||||
* DESCRIPTION: XT Boot Loader global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xtldr.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* XT Boot Loader registered boot protocol list */
|
|
||||||
LIST_ENTRY BlpBootProtocols;
|
|
||||||
|
|
||||||
/* XT Boot Loader serial ports list */
|
|
||||||
ULONG BlComPortList[COMPORT_COUNT] = COMPORT_ADDRESS;
|
|
||||||
|
|
||||||
/* XT Boot Loader configuration list */
|
|
||||||
LIST_ENTRY BlpConfig;
|
|
||||||
|
|
||||||
/* XT Boot Loader loaded configuration */
|
|
||||||
LIST_ENTRY BlpConfigSections;
|
|
||||||
|
|
||||||
/* XT Boot Loader protocol */
|
|
||||||
XTBL_LOADER_PROTOCOL BlpLdrProtocol;
|
|
||||||
|
|
||||||
/* XT Boot Loader loaded modules list */
|
|
||||||
LIST_ENTRY BlpLoadedModules;
|
|
||||||
|
|
||||||
/* XT Boot Loader menu list */
|
|
||||||
PLIST_ENTRY BlpMenuList = NULL;
|
|
||||||
|
|
||||||
/* XT Boot Loader status data */
|
|
||||||
XTBL_STATUS BlpStatus = {0};
|
|
||||||
|
|
||||||
/* List of available block devices */
|
|
||||||
LIST_ENTRY EfiBlockDevices;
|
|
||||||
|
|
||||||
/* EFI Image Handle */
|
|
||||||
EFI_HANDLE EfiImageHandle;
|
|
||||||
|
|
||||||
/* EFI System Table */
|
|
||||||
PEFI_SYSTEM_TABLE EfiSystemTable;
|
|
112
xtldr/hardware.c
112
xtldr/hardware.c
@@ -1,112 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/hardware.c
|
|
||||||
* DESCRIPTION: EFI hardware support for XT Boot Loader
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xtldr.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables I/O space access to all serial controllers found on the PCI(E) root bridge.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpActivateSerialIOController()
|
|
||||||
{
|
|
||||||
EFI_GUID PciGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
|
|
||||||
PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciDev;
|
|
||||||
USHORT Bus, Device, Function, Command;
|
|
||||||
UINT_PTR Index, PciHandleSize;
|
|
||||||
PEFI_HANDLE PciHandle = NULL;
|
|
||||||
PCI_COMMON_HEADER PciHeader;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
ULONGLONG Address;
|
|
||||||
|
|
||||||
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
|
|
||||||
PciHandleSize = sizeof(EFI_HANDLE);
|
|
||||||
Status = BlAllocateMemoryPool(PciHandleSize, (PVOID*)&PciHandle);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory allocation failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get all instances of PciRootBridgeIo */
|
|
||||||
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULL, &PciHandleSize, PciHandle);
|
|
||||||
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
|
||||||
{
|
|
||||||
/* Reallocate more memory as requested by UEFI */
|
|
||||||
BlFreeMemoryPool(PciHandle);
|
|
||||||
Status = BlAllocateMemoryPool(PciHandleSize, (PVOID*)&PciHandle);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory reallocation failure */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Second attempt to get instances of PciRootBridgeIo */
|
|
||||||
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULL, &PciHandleSize, PciHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure successfully obtained PciRootBridgeIo instances */
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to get PciRootBridgeIo instances */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enumerate all devices for each handle, which decides a segment and a bus number range */
|
|
||||||
for(Index = 0; Index < (PciHandleSize / sizeof(EFI_HANDLE)); Index++)
|
|
||||||
{
|
|
||||||
/* Get inferface from the protocol */
|
|
||||||
Status = EfiSystemTable->BootServices->HandleProtocol(PciHandle[Index], &PciGuid, (PVOID*)&PciDev);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to get interface */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enumerate whole PCI bridge */
|
|
||||||
for(Bus = 0; Bus <= PCI_MAX_BRIDGE_NUMBER; Bus++)
|
|
||||||
{
|
|
||||||
/* Enumerate all devices for each bus */
|
|
||||||
for(Device = 0; Device < PCI_MAX_DEVICES; Device++)
|
|
||||||
{
|
|
||||||
/* Enumerate all functions for each devices */
|
|
||||||
for(Function = 0; Function < PCI_MAX_FUNCTION; Function++)
|
|
||||||
{
|
|
||||||
/* Read configuration space */
|
|
||||||
Address = ((ULONGLONG)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) +
|
|
||||||
(((UINT_PTR) Function) << 8) + ((UINT_PTR) 0)));
|
|
||||||
PciDev->Pci.Read(PciDev, 2, Address, sizeof (PciHeader) / sizeof (UINT), &PciHeader);
|
|
||||||
|
|
||||||
/* Check if device exists */
|
|
||||||
if(PciHeader.VendorId == PCI_INVALID_VENDORID)
|
|
||||||
{
|
|
||||||
/* Skip non-existen device */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if device is serial controller or multiport serial controller */
|
|
||||||
if(PciHeader.BaseClass == 0x07 && (PciHeader.SubClass == 0x00 || PciHeader.SubClass == 0x02))
|
|
||||||
{
|
|
||||||
/* Enable I/O space access */
|
|
||||||
Address |= 0x4;
|
|
||||||
Command = PCI_ENABLE_IO_SPACE;
|
|
||||||
Status = PciDev->Pci.Write(PciDev, 1, Address, 1, &Command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return SUCCESS */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/includes/globals.h
|
|
||||||
* DESCRIPTION: XTLDR global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_GLOBALS_H
|
|
||||||
#define __XTLDR_GLOBALS_H
|
|
||||||
|
|
||||||
#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;
|
|
||||||
|
|
||||||
/* 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_H */
|
|
142
xtldr/includes/libxtos.hh
Normal file
142
xtldr/includes/libxtos.hh
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/includes/libxtos.hh
|
||||||
|
* DESCRIPTION: XT Loader to LIBXTOS interface
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_LIBXTOS_HH
|
||||||
|
#define __XTLDR_LIBXTOS_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Minimal forward references for AR classes used by XTLDR */
|
||||||
|
namespace AR
|
||||||
|
{
|
||||||
|
class CpuFunc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL BOOLEAN CpuId(IN OUT PCPUID_REGISTERS Registers);
|
||||||
|
STATIC XTCDECL ULONG_PTR ReadControlRegister(IN USHORT ControlRegister);
|
||||||
|
STATIC XTCDECL ULONGLONG ReadModelSpecificRegister(IN ULONG Register);
|
||||||
|
STATIC XTCDECL VOID WriteControlRegister(IN USHORT ControlRegister,
|
||||||
|
IN UINT_PTR Value);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProcSup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI VOID GetTrampolineInformation(IN TRAMPOLINE_TYPE TrampolineType,
|
||||||
|
OUT PVOID *TrampolineCode,
|
||||||
|
OUT PULONG_PTR TrampolineSize);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Minimal forward references for HL classes used by XTLDR */
|
||||||
|
namespace HL
|
||||||
|
{
|
||||||
|
class ComPort
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL XTSTATUS InitializeComPort(IN OUT PCPPORT Port,
|
||||||
|
IN PUCHAR PortAddress,
|
||||||
|
IN ULONG BaudRate);
|
||||||
|
STATIC XTCDECL XTSTATUS WriteComPort(IN PCPPORT Port,
|
||||||
|
IN UCHAR Byte);
|
||||||
|
};
|
||||||
|
|
||||||
|
class IoPort
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL UCHAR ReadPort8(IN USHORT Port);
|
||||||
|
STATIC XTCDECL USHORT ReadPort16(IN USHORT Port);
|
||||||
|
STATIC XTCDECL ULONG ReadPort32(IN USHORT Port);
|
||||||
|
STATIC XTCDECL VOID WritePort8(IN USHORT Port,
|
||||||
|
IN UCHAR Value);
|
||||||
|
STATIC XTCDECL VOID WritePort16(IN USHORT Port,
|
||||||
|
IN USHORT Value);
|
||||||
|
STATIC XTCDECL VOID WritePort32(IN USHORT Port,
|
||||||
|
IN ULONG Value);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Minimal forward references for RTL classes used by XTLDR */
|
||||||
|
namespace RTL
|
||||||
|
{
|
||||||
|
class Guid
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI BOOLEAN CompareGuids(IN PGUID Guid1,
|
||||||
|
IN PGUID Guid2);
|
||||||
|
};
|
||||||
|
|
||||||
|
class LinkedList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL VOID InitializeListHead(IN PLIST_ENTRY ListHead);
|
||||||
|
STATIC XTCDECL VOID InsertHeadList(IN OUT PLIST_ENTRY ListHead,
|
||||||
|
IN PLIST_ENTRY Entry);
|
||||||
|
STATIC XTCDECL VOID InsertTailList(IN OUT PLIST_ENTRY ListHead,
|
||||||
|
IN PLIST_ENTRY Entry);
|
||||||
|
STATIC XTCDECL VOID RemoveEntryList(IN PLIST_ENTRY Entry);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Memory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI SIZE_T CompareMemory(IN PCVOID LeftBuffer,
|
||||||
|
IN PCVOID RightBuffer,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI VOID CopyMemory(OUT PVOID Destination,
|
||||||
|
IN PCVOID Source,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI VOID MoveMemory(OUT PVOID Destination,
|
||||||
|
IN PCVOID Source,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI VOID SetMemory(OUT PVOID Destination,
|
||||||
|
IN UCHAR Byte,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI VOID ZeroMemory(OUT PVOID Destination,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
};
|
||||||
|
|
||||||
|
class String
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI SIZE_T CompareString(IN PCSTR String1,
|
||||||
|
IN PCSTR String2,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI SIZE_T StringLength(IN PCSTR String,
|
||||||
|
IN SIZE_T MaxLength);
|
||||||
|
STATIC XTAPI SIZE_T StringToWideString(OUT PWCHAR Destination,
|
||||||
|
IN PCSTR *Source,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI PCHAR TrimString(IN PCHAR String);
|
||||||
|
};
|
||||||
|
|
||||||
|
class WideString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI SIZE_T CompareWideString(IN PCWSTR String1,
|
||||||
|
IN PCWSTR String2,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI SIZE_T CompareWideStringInsensitive(IN PCWSTR String1,
|
||||||
|
IN PCWSTR String2,
|
||||||
|
IN SIZE_T Length);
|
||||||
|
STATIC XTAPI PWCHAR ConcatenateWideString(OUT PWCHAR Destination,
|
||||||
|
IN PWCHAR Source,
|
||||||
|
IN SIZE_T Count);
|
||||||
|
STATIC XTAPI XTSTATUS FormatWideString(IN PRTL_PRINT_CONTEXT Context,
|
||||||
|
IN PCWSTR Format,
|
||||||
|
IN VA_LIST ArgumentList);
|
||||||
|
STATIC XTAPI PWCHAR TokenizeWideString(IN PWCHAR String,
|
||||||
|
IN PCWSTR Delimiter,
|
||||||
|
IN OUT PWCHAR *SavePtr);
|
||||||
|
STATIC XTAPI SIZE_T WideStringLength(IN PCWSTR String,
|
||||||
|
IN SIZE_T MaxLength);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __XTLDR_LIBXTOS_HH */
|
@@ -1,546 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/includes/xtldr.h
|
|
||||||
* DESCRIPTION: Top level header for XTLDR
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_XTLDR_H
|
|
||||||
#define __XTLDR_XTLDR_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <xtver.h>
|
|
||||||
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* XTLDR routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlAllocateMemoryPages(IN ULONGLONG NumberOfPages,
|
|
||||||
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlAllocateMemoryPool(IN UINT_PTR Size,
|
|
||||||
OUT PVOID *Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN ULONG_PTR SelfMapAddress);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlClearConsoleLine(IN ULONGLONG LineNo);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlClearConsoleScreen();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlCloseProtocol(IN PEFI_HANDLE Handle,
|
|
||||||
IN PEFI_GUID ProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlCloseVolume(IN PEFI_HANDLE VolumeHandle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlConsolePrint(IN PUSHORT Format,
|
|
||||||
IN ...);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlConsoleWrite(IN PUSHORT String);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDebugPrint(IN PUSHORT Format,
|
|
||||||
IN ...);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDisableConsoleCursor();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDisplayBootMenu();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDisplayErrorDialog(IN PWCHAR Caption,
|
|
||||||
IN PWCHAR Message);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDisplayInfoDialog(IN PWCHAR Caption,
|
|
||||||
IN PWCHAR Message);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlDisplayInputDialog(IN PWCHAR Caption,
|
|
||||||
IN PWCHAR Message,
|
|
||||||
IN OUT PWCHAR *InputFieldText);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
XTBL_DIALOG_HANDLE
|
|
||||||
BlDisplayProgressDialog(IN PWCHAR Caption,
|
|
||||||
IN PWCHAR Message,
|
|
||||||
IN UCHAR Percentage);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlEnableConsoleCursor();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlEnterFirmwareSetup();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlEnumerateBlockDevices();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlExitBootServices();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlFindBootProtocol(IN PWCHAR SystemType,
|
|
||||||
OUT PEFI_GUID BootProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
|
||||||
IN CONST PWCHAR FileSystemPath,
|
|
||||||
OUT PEFI_DEVICE_PATH_PROTOCOL* DevicePath);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlFreeMemoryPages(IN ULONGLONG NumberOfPages,
|
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlFreeMemoryPool(IN PVOID Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
BlGetBooleanParameter(IN CONST PWCHAR Parameters,
|
|
||||||
IN CONST PWCHAR Needle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
BlGetConfigBooleanValue(IN CONST PWCHAR ConfigName);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
PWCHAR
|
|
||||||
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlGetConfigurationTable(IN PEFI_GUID TableGuid,
|
|
||||||
OUT PVOID *Table);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlGetEfiPath(IN PWCHAR SystemPath,
|
|
||||||
OUT PWCHAR *EfiPath);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlGetEfiVariable(IN PEFI_GUID Vendor,
|
|
||||||
IN PWCHAR VariableName,
|
|
||||||
OUT PVOID *VariableValue);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlGetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
OUT PULONG NumberOfMappings);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
PLIST_ENTRY
|
|
||||||
BlGetModulesList();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONGLONG
|
|
||||||
BlGetRandomValue(IN OUT PULONGLONG RNGBuffer);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
INT_PTR
|
|
||||||
BlGetSecureBootStatus();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
PVOID
|
|
||||||
BlGetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN PVOID PhysicalAddress);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlGetVolumeDevicePath(IN PWCHAR SystemPath,
|
|
||||||
OUT PEFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
||||||
OUT PWCHAR *ArcName,
|
|
||||||
OUT PWCHAR *Path);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlInitializeBootLoader();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM *MenuEntries,
|
|
||||||
OUT PULONG EntriesCount,
|
|
||||||
OUT PULONG DefaultId);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlInitializeConsole();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlInitializeEntropy(PULONGLONG RNGBuffer);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN SHORT PageMapLevel,
|
|
||||||
IN PAGE_SIZE PageSize);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlInstallProtocol(IN PVOID Interface,
|
|
||||||
IN PEFI_GUID Guid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlInvokeBootProtocol(IN PWCHAR ShortName,
|
|
||||||
IN PLIST_ENTRY OptionsList);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlLoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
|
||||||
IN PVOID ImageData,
|
|
||||||
IN SIZE_T ImageSize,
|
|
||||||
OUT PEFI_HANDLE ImageHandle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlLoadModule(IN PWCHAR ModuleName);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlLoadModules(IN PWCHAR ModulesList);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlLocateProtocolHandles(OUT PEFI_HANDLE *Handles,
|
|
||||||
OUT PUINT_PTR Count,
|
|
||||||
IN PEFI_GUID ProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN OUT PVOID *DesiredVirtualAddress,
|
|
||||||
IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN ULONG_PTR VirtualAddress,
|
|
||||||
IN ULONG_PTR PhysicalAddress,
|
|
||||||
IN ULONG NumberOfPages);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN PVOID VirtualAddress,
|
|
||||||
IN PVOID PhysicalAddress,
|
|
||||||
IN ULONGLONG NumberOfPages,
|
|
||||||
IN LOADER_MEMORY_TYPE MemoryType);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
|
||||||
OUT PEFI_HANDLE DiskHandle,
|
|
||||||
OUT PEFI_FILE_HANDLE *FsHandle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlOpenProtocol(OUT PEFI_HANDLE Handle,
|
|
||||||
OUT PVOID *ProtocolHandler,
|
|
||||||
IN PEFI_GUID ProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlOpenProtocolHandle(IN EFI_HANDLE Handle,
|
|
||||||
OUT PVOID *ProtocolHandler,
|
|
||||||
IN PEFI_GUID ProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
PVOID
|
|
||||||
BlPhysicalAddressToVirtual(IN PVOID PhysicalAddress,
|
|
||||||
IN PVOID PhysicalBase,
|
|
||||||
IN PVOID VirtualBase);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlPhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN OUT PLIST_ENTRY ListHead,
|
|
||||||
IN PVOID PhysicalBase,
|
|
||||||
IN PVOID VirtualBase);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlQueryConsoleMode(OUT PUINT_PTR ResX,
|
|
||||||
OUT PUINT_PTR ResY);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
|
||||||
IN CONST PWCHAR FileName,
|
|
||||||
OUT PVOID *FileData,
|
|
||||||
OUT PSIZE_T FileSize);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlReadKeyStroke(OUT PEFI_INPUT_KEY Key);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlRebootSystem();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlRegisterBootMenu(PVOID BootMenuRoutine);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlRegisterBootProtocol(IN PWCHAR SystemType,
|
|
||||||
IN PEFI_GUID BootProtocolGuid);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlResetConsoleInputBuffer();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlSetConfigValue(IN CONST PWCHAR ConfigName,
|
|
||||||
IN CONST PWCHAR ConfigValue);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlSetConsoleAttributes(IN ULONGLONG Attributes);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlSetConsoleMode(IN ULONGLONG Mode);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlSetCursorPosition(IN ULONGLONG PosX,
|
|
||||||
IN ULONGLONG PosY);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlSetEfiVariable(IN PEFI_GUID Vendor,
|
|
||||||
IN PWCHAR VariableName,
|
|
||||||
IN PVOID VariableValue,
|
|
||||||
IN UINT_PTR Size);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlShutdownSystem();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlSleepExecution(IN ULONG_PTR Milliseconds);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlStartEfiImage(IN EFI_HANDLE ImageHandle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlStartLoaderShell();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlStartXtLoader(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlUpdateProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR Message,
|
|
||||||
IN UCHAR Percentage);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlWaitForEfiEvent(IN UINT_PTR NumberOfEvents,
|
|
||||||
IN PEFI_EVENT Event,
|
|
||||||
OUT PUINT_PTR Index);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpActivateSerialIOController();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
XTSTATUS
|
|
||||||
BlpConsolePutChar(IN USHORT Character);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
XTSTATUS
|
|
||||||
BlpDebugPutChar(IN USHORT Character);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDetermineDialogBoxSize(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR Message);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpDissectVolumeArcPath(IN PWCHAR SystemPath,
|
|
||||||
OUT PWCHAR *ArcName,
|
|
||||||
OUT PWCHAR *Path,
|
|
||||||
OUT PUSHORT DriveType,
|
|
||||||
OUT PULONG DriveNumber,
|
|
||||||
OUT PULONG PartNumber);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawBootMenu(OUT PXTBL_DIALOG_HANDLE Handle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawBootMenuEntry(IN PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR MenuEntry,
|
|
||||||
IN UINT Position,
|
|
||||||
IN BOOLEAN Highlighted);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR Caption,
|
|
||||||
IN PWCHAR Message);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawDialogButton(IN PXTBL_DIALOG_HANDLE Handle);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR InputFieldText);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawDialogMessage(IN PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN PWCHAR Message);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpDrawDialogProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
|
|
||||||
IN UCHAR Percentage);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
PEFI_DEVICE_PATH_PROTOCOL
|
|
||||||
BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpFindLastBlockDeviceNode(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
|
||||||
OUT PEFI_DEVICE_PATH_PROTOCOL *LastNode);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
BlpFindParentBlockDevice(IN PLIST_ENTRY BlockDevices,
|
|
||||||
IN PEFI_BLOCK_DEVICE_DATA ChildNode,
|
|
||||||
OUT PEFI_BLOCK_DEVICE_DATA *ParentNode);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
LONG
|
|
||||||
BlpGetLoaderMemoryType(IN EFI_MEMORY_TYPE EfiMemoryType);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpGetModuleInformation(IN PWCHAR SectionData,
|
|
||||||
IN ULONG SectionSize,
|
|
||||||
OUT PXTBL_MODULE_INFO ModuleInfo);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpGetModuleInfoStrings(IN PWCHAR SectionData,
|
|
||||||
IN ULONG SectionSize,
|
|
||||||
OUT PWCHAR **ModInfo,
|
|
||||||
OUT PULONG InfoCount);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN PVOID PageTable,
|
|
||||||
IN SIZE_T Entry,
|
|
||||||
OUT PVOID *NextPageTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpInitializeDebugConsole();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpInitializeSerialPort(IN ULONG PortNumber,
|
|
||||||
IN ULONG PortAddress,
|
|
||||||
IN ULONG BaudRate);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpInstallXtLoaderProtocol();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpLoadConfiguration();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpParseCommandLine(VOID);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpParseConfigFile(IN CONST PCHAR RawConfig,
|
|
||||||
OUT PLIST_ENTRY Configuration);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpPrintShellPrompt();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpReadConfigFile(IN CONST PWCHAR ConfigDirectory,
|
|
||||||
IN CONST PWCHAR ConfigFile,
|
|
||||||
OUT PCHAR *ConfigData);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlpSelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
|
||||||
IN ULONG_PTR SelfMapAddress);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
ULONGLONG
|
|
||||||
BlpStringReadPadding(IN PUSHORT *Format);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BlpUpdateConfiguration(IN PLIST_ENTRY NewConfig);
|
|
||||||
|
|
||||||
#endif /* __XTLDR_XTLDR_H */
|
|
351
xtldr/includes/xtldr.hh
Normal file
351
xtldr/includes/xtldr.hh
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/includes/xtldr.hh
|
||||||
|
* DESCRIPTION: Top level header for XTLDR
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_XTLDR_HH
|
||||||
|
#define __XTLDR_XTLDR_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
#include <xtver.h>
|
||||||
|
|
||||||
|
#include <libxtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
class BootUtils
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL BOOLEAN GetBooleanParameter(IN PCWSTR Parameters,
|
||||||
|
IN PCWSTR Needle);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Configuration
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC PLIST_ENTRY BootMenuList;
|
||||||
|
STATIC LIST_ENTRY Config;
|
||||||
|
STATIC LIST_ENTRY ConfigSections;
|
||||||
|
STATIC PCWSTR EditableConfigOptions[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL BOOLEAN GetBooleanValue(IN PCWSTR ConfigName);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetBootOptionValue(IN PLIST_ENTRY Options,
|
||||||
|
IN PCWSTR OptionName,
|
||||||
|
OUT PWCHAR *OptionValue);
|
||||||
|
STATIC XTCDECL VOID GetEditableOptions(OUT PCWSTR **OptionsArray,
|
||||||
|
OUT PULONG OptionsCount);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetValue(IN PCWSTR ConfigName,
|
||||||
|
OUT PWCHAR *ConfigValue);
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeBootMenuList(IN ULONG MaxNameLength,
|
||||||
|
OUT PXTBL_BOOTMENU_ITEM *MenuEntries,
|
||||||
|
OUT PULONG EntriesCount,
|
||||||
|
OUT PULONG DefaultId);
|
||||||
|
STATIC XTCDECL VOID InitializeConfiguration();
|
||||||
|
STATIC XTCDECL EFI_STATUS LoadConfiguration();
|
||||||
|
STATIC XTCDECL EFI_STATUS ParseCommandLine();
|
||||||
|
STATIC XTCDECL EFI_STATUS SetBootOptionValue(IN PLIST_ENTRY Options,
|
||||||
|
IN PCWSTR OptionName,
|
||||||
|
IN PCWSTR OptionValue);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL EFI_STATUS ParseConfigFile(IN CONST PCHAR RawConfig,
|
||||||
|
OUT PLIST_ENTRY Configuration);
|
||||||
|
STATIC XTCDECL EFI_STATUS ReadConfigFile(IN PCWSTR ConfigDirectory,
|
||||||
|
IN PCWSTR ConfigFile,
|
||||||
|
OUT PCHAR *ConfigData);
|
||||||
|
STATIC XTCDECL EFI_STATUS SetValue(IN PCWSTR ConfigName,
|
||||||
|
IN PCWSTR ConfigValue);
|
||||||
|
STATIC XTCDECL VOID UpdateConfiguration(IN PLIST_ENTRY NewConfig);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Console
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL VOID ClearLine(IN ULONGLONG LineNo);
|
||||||
|
STATIC XTCDECL VOID ClearScreen();
|
||||||
|
STATIC XTCDECL VOID DisableCursor();
|
||||||
|
STATIC XTCDECL VOID EnableCursor();
|
||||||
|
STATIC XTCDECL VOID InitializeConsole();
|
||||||
|
STATIC XTCDECL VOID Print(IN PCWSTR Format,
|
||||||
|
IN ...);
|
||||||
|
STATIC XTCDECL XTSTATUS PutChar(IN WCHAR Character);
|
||||||
|
STATIC XTCDECL VOID QueryMode(OUT PUINT_PTR ResX,
|
||||||
|
OUT PUINT_PTR ResY);
|
||||||
|
STATIC XTCDECL VOID ReadKeyStroke(OUT PEFI_INPUT_KEY Key);
|
||||||
|
STATIC XTCDECL VOID ResetInputBuffer();
|
||||||
|
STATIC XTCDECL VOID SetAttributes(IN ULONGLONG Attributes);
|
||||||
|
STATIC XTCDECL VOID SetCursorPosition(IN ULONGLONG PosX,
|
||||||
|
IN ULONGLONG PosY);
|
||||||
|
STATIC XTCDECL VOID Write(IN PCWSTR String);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL EFI_STATUS SetMode(IN ULONGLONG Mode);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Debug
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC ULONG ComPortList[COMPORT_COUNT];
|
||||||
|
STATIC ULONG EnabledDebugPorts;
|
||||||
|
STATIC CPPORT SerialPort;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeDebugConsole();
|
||||||
|
STATIC XTCDECL VOID Print(IN PCWSTR Format,
|
||||||
|
IN ...);
|
||||||
|
STATIC XTCDECL XTSTATUS PutChar(IN WCHAR Character);
|
||||||
|
STATIC XTCDECL BOOLEAN SerialPortReady();
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL EFI_STATUS ActivateSerialIOController();
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeSerialPort(IN ULONG PortNumber,
|
||||||
|
IN ULONG PortAddress,
|
||||||
|
IN ULONG BaudRate);
|
||||||
|
};
|
||||||
|
|
||||||
|
class EfiUtils
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS EnterFirmwareSetup();
|
||||||
|
STATIC XTCDECL EFI_STATUS ExitBootServices();
|
||||||
|
STATIC XTCDECL EFI_STATUS GetConfigurationTable(IN PEFI_GUID TableGuid,
|
||||||
|
OUT PVOID *Table);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetEfiVariable(IN PEFI_GUID Vendor,
|
||||||
|
IN PCWSTR VariableName,
|
||||||
|
OUT PVOID *VariableValue);
|
||||||
|
STATIC XTCDECL ULONGLONG GetRandomValue(IN OUT PULONGLONG RNGBuffer);
|
||||||
|
STATIC XTCDECL INT_PTR GetSecureBootStatus();
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeEntropy(PULONGLONG RNGBuffer);
|
||||||
|
STATIC XTCDECL EFI_STATUS LoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
||||||
|
IN PVOID ImageData,
|
||||||
|
IN SIZE_T ImageSize,
|
||||||
|
OUT PEFI_HANDLE ImageHandle);
|
||||||
|
STATIC XTCDECL EFI_STATUS RebootSystem();
|
||||||
|
STATIC XTCDECL EFI_STATUS SetEfiVariable(IN PEFI_GUID Vendor,
|
||||||
|
IN PCWSTR VariableName,
|
||||||
|
IN PVOID VariableValue,
|
||||||
|
IN UINT_PTR Size);
|
||||||
|
STATIC XTCDECL EFI_STATUS ShutdownSystem();
|
||||||
|
STATIC XTCDECL VOID SleepExecution(IN ULONG_PTR Milliseconds);
|
||||||
|
STATIC XTCDECL EFI_STATUS StartEfiImage(IN EFI_HANDLE ImageHandle);
|
||||||
|
STATIC XTCDECL EFI_STATUS WaitForEfiEvent(IN UINT_PTR NumberOfEvents,
|
||||||
|
IN PEFI_EVENT Event,
|
||||||
|
OUT PUINT_PTR Index);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Memory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS AllocatePages(IN EFI_ALLOCATE_TYPE AllocationType,
|
||||||
|
IN ULONGLONG NumberOfPages,
|
||||||
|
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
||||||
|
STATIC XTCDECL EFI_STATUS AllocatePool(IN UINT_PTR Size,
|
||||||
|
OUT PVOID *Memory);
|
||||||
|
STATIC XTCDECL EFI_STATUS BuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN ULONG_PTR SelfMapAddress);
|
||||||
|
STATIC XTCDECL EFI_STATUS FreePages(IN ULONGLONG NumberOfPages,
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Memory);
|
||||||
|
STATIC XTCDECL EFI_STATUS FreePool(IN PVOID Memory);
|
||||||
|
STATIC XTCDECL VOID GetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
OUT PULONG NumberOfMappings);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap);
|
||||||
|
STATIC XTCDECL PVOID GetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN PVOID PhysicalAddress);
|
||||||
|
STATIC XTCDECL VOID InitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN SHORT PageMapLevel,
|
||||||
|
IN PAGE_SIZE PageSize);
|
||||||
|
STATIC XTCDECL EFI_STATUS MapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN OUT PVOID *MemoryMapAddress,
|
||||||
|
IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine);
|
||||||
|
STATIC XTCDECL EFI_STATUS MapPage(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN ULONG_PTR VirtualAddress,
|
||||||
|
IN ULONG_PTR PhysicalAddress,
|
||||||
|
IN ULONG NumberOfPages);
|
||||||
|
STATIC XTCDECL EFI_STATUS MapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN PVOID VirtualAddress,
|
||||||
|
IN PVOID PhysicalAddress,
|
||||||
|
IN ULONGLONG NumberOfPages,
|
||||||
|
IN LOADER_MEMORY_TYPE MemoryType);
|
||||||
|
STATIC XTCDECL PVOID PhysicalAddressToVirtual(IN PVOID PhysicalAddress,
|
||||||
|
IN PVOID PhysicalBase,
|
||||||
|
IN PVOID VirtualBase);
|
||||||
|
STATIC XTCDECL EFI_STATUS PhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN OUT PLIST_ENTRY ListHead,
|
||||||
|
IN PVOID PhysicalBase,
|
||||||
|
IN PVOID VirtualBase);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL LOADER_MEMORY_TYPE GetLoaderMemoryType(IN EFI_MEMORY_TYPE EfiMemoryType);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN PVOID PageTable,
|
||||||
|
IN SIZE_T Entry,
|
||||||
|
OUT PVOID *NextPageTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS SelfMapPml(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
|
IN ULONG_PTR SelfMapAddress);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Protocol
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC LIST_ENTRY BootProtocols;
|
||||||
|
STATIC XTBL_LOADER_PROTOCOL LoaderProtocol;
|
||||||
|
STATIC LIST_ENTRY LoadedModules;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS CloseProtocol(IN PEFI_HANDLE Handle,
|
||||||
|
IN PEFI_GUID ProtocolGuid);
|
||||||
|
STATIC XTCDECL EFI_STATUS FindBootProtocol(IN PCWSTR SystemType,
|
||||||
|
OUT PEFI_GUID BootProtocolGuid);
|
||||||
|
STATIC XTCDECL PLIST_ENTRY GetModulesList();
|
||||||
|
STATIC XTCDECL EFI_STATUS InstallProtocol(IN PVOID Interface,
|
||||||
|
IN PEFI_GUID Guid);
|
||||||
|
STATIC XTCDECL VOID InitializeProtocol();
|
||||||
|
STATIC XTCDECL EFI_STATUS InvokeBootProtocol(IN PWCHAR ShortName,
|
||||||
|
IN PLIST_ENTRY OptionsList);
|
||||||
|
STATIC XTCDECL EFI_STATUS LoadModule(IN PWCHAR ModuleName);
|
||||||
|
STATIC XTCDECL EFI_STATUS LoadModules(IN PWCHAR ModulesList);
|
||||||
|
STATIC XTCDECL EFI_STATUS LocateProtocolHandles(OUT PEFI_HANDLE *Handles,
|
||||||
|
OUT PUINT_PTR Count,
|
||||||
|
IN PEFI_GUID ProtocolGuid);
|
||||||
|
STATIC XTCDECL EFI_STATUS OpenProtocol(OUT PEFI_HANDLE Handle,
|
||||||
|
OUT PVOID *ProtocolHandler,
|
||||||
|
IN PEFI_GUID ProtocolGuid);
|
||||||
|
STATIC XTCDECL EFI_STATUS OpenProtocolHandle(IN EFI_HANDLE Handle,
|
||||||
|
OUT PVOID *ProtocolHandler,
|
||||||
|
IN PEFI_GUID ProtocolGuid);
|
||||||
|
STATIC XTCDECL EFI_STATUS RegisterBootProtocol(IN PCWSTR SystemType,
|
||||||
|
IN PEFI_GUID BootProtocolGuid);
|
||||||
|
STATIC XTCDECL EFI_STATUS InstallXtLoaderProtocol();
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL EFI_STATUS GetModuleInformation(IN PWCHAR SectionData,
|
||||||
|
IN ULONG SectionSize,
|
||||||
|
OUT PXTBL_MODULE_INFO ModuleInfo);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetModuleInfoStrings(IN PWCHAR SectionData,
|
||||||
|
IN ULONG SectionSize,
|
||||||
|
OUT PWCHAR **ModInfo,
|
||||||
|
OUT PULONG InfoCount);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Shell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL VOID StartLoaderShell();
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL VOID PrintPrompt();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextUi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL VOID DisplayBootMenu();
|
||||||
|
STATIC XTCDECL VOID DisplayErrorDialog(IN PCWSTR Caption,
|
||||||
|
IN PCWSTR Message);
|
||||||
|
STATIC XTCDECL VOID DisplayInfoDialog(IN PCWSTR Caption,
|
||||||
|
IN PCWSTR Message);
|
||||||
|
STATIC XTCDECL VOID DisplayInputDialog(IN PCWSTR Caption,
|
||||||
|
IN PCWSTR Message,
|
||||||
|
IN OUT PWCHAR *InputFieldText);
|
||||||
|
STATIC XTCDECL XTBL_DIALOG_HANDLE DisplayProgressDialog(IN PCWSTR Caption,
|
||||||
|
IN PCWSTR Message,
|
||||||
|
IN UCHAR Percentage);
|
||||||
|
STATIC XTCDECL VOID UpdateProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PCWSTR Message,
|
||||||
|
IN UCHAR Percentage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL VOID DetermineDialogBoxSize(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PCWSTR Message);
|
||||||
|
STATIC XTCDECL VOID DisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry);
|
||||||
|
STATIC XTCDECL VOID DrawBootMenu(OUT PXTBL_DIALOG_HANDLE Handle);
|
||||||
|
STATIC XTCDECL VOID DrawBootMenuEntry(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PWCHAR MenuEntry,
|
||||||
|
IN UINT Position,
|
||||||
|
IN BOOLEAN Highlighted);
|
||||||
|
STATIC XTCDECL VOID DrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PCWSTR Caption,
|
||||||
|
IN PCWSTR Message);
|
||||||
|
STATIC XTCDECL VOID DrawButton(IN PXTBL_DIALOG_HANDLE Handle);
|
||||||
|
STATIC XTCDECL VOID DrawInputField(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PWCHAR InputFieldText);
|
||||||
|
STATIC XTCDECL VOID DrawMessage(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PCWSTR Message);
|
||||||
|
STATIC XTCDECL VOID DrawProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN UCHAR Percentage);
|
||||||
|
STATIC XTCDECL VOID DrawEditMenu(OUT PXTBL_DIALOG_HANDLE Handle);
|
||||||
|
STATIC XTCDECL EFI_STATUS DrawEditMenuEntry(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
IN PCWSTR OptionName,
|
||||||
|
IN PCWSTR OptionValue,
|
||||||
|
IN UINT Position,
|
||||||
|
IN BOOLEAN Highlighted);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Volume
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC LIST_ENTRY EfiBlockDevices;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS CloseVolume(IN PEFI_HANDLE VolumeHandle);
|
||||||
|
STATIC XTCDECL EFI_STATUS EnumerateBlockDevices();
|
||||||
|
STATIC XTCDECL EFI_STATUS FindDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
||||||
|
IN CONST PWCHAR FileSystemPath,
|
||||||
|
OUT PEFI_DEVICE_PATH_PROTOCOL* DevicePath);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetEfiPath(IN PWCHAR SystemPath,
|
||||||
|
OUT PWCHAR *EfiPath);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetDevicePath(IN PWCHAR SystemPath,
|
||||||
|
OUT PEFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
|
OUT PWCHAR *ArcName,
|
||||||
|
OUT PWCHAR *Path);
|
||||||
|
STATIC XTCDECL EFI_STATUS OpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
||||||
|
OUT PEFI_HANDLE DiskHandle,
|
||||||
|
OUT PEFI_FILE_HANDLE *FsHandle);
|
||||||
|
STATIC XTCDECL EFI_STATUS ReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
|
IN PCWSTR FileName,
|
||||||
|
OUT PVOID *FileData,
|
||||||
|
OUT PSIZE_T FileSize);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL EFI_STATUS DiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices);
|
||||||
|
STATIC XTCDECL EFI_STATUS DissectArcPath(IN PWCHAR SystemPath,
|
||||||
|
OUT PWCHAR *ArcName,
|
||||||
|
OUT PWCHAR *Path,
|
||||||
|
OUT PUSHORT DriveType,
|
||||||
|
OUT PULONG DriveNumber,
|
||||||
|
OUT PULONG PartNumber);
|
||||||
|
STATIC XTCDECL PEFI_DEVICE_PATH_PROTOCOL DuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath);
|
||||||
|
STATIC XTCDECL EFI_STATUS FindLastBlockDeviceNode(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
||||||
|
OUT PEFI_DEVICE_PATH_PROTOCOL *LastNode);
|
||||||
|
STATIC XTCDECL BOOLEAN FindParentBlockDevice(IN PLIST_ENTRY BlockDevices,
|
||||||
|
IN PEFI_BLOCK_DEVICE_DATA ChildNode,
|
||||||
|
OUT PEFI_BLOCK_DEVICE_DATA *ParentNode);
|
||||||
|
};
|
||||||
|
|
||||||
|
class XtLoader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC PBL_XT_BOOT_MENU BootMenu;
|
||||||
|
STATIC EFI_HANDLE EfiImageHandle;
|
||||||
|
STATIC PEFI_SYSTEM_TABLE EfiSystemTable;
|
||||||
|
STATIC XTBL_STATUS LoaderStatus;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL VOID DisableBootServices();
|
||||||
|
STATIC XTCDECL BOOLEAN GetBootServicesStatus();
|
||||||
|
STATIC XTCDECL EFI_HANDLE GetEfiImageHandle();
|
||||||
|
STATIC XTCDECL PEFI_SYSTEM_TABLE GetEfiSystemTable();
|
||||||
|
STATIC XTCDECL VOID GetLoaderImageInformation(PVOID *LoaderBase,
|
||||||
|
PULONGLONG LoaderSize);
|
||||||
|
STATIC XTCDECL INT_PTR GetSecureBootStatus();
|
||||||
|
STATIC XTCDECL VOID InitializeBootLoader(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
STATIC XTCDECL VOID RegisterBootMenu(IN PVOID BootMenuRoutine);
|
||||||
|
STATIC XTCDECL VOID ShowBootMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __XTLDR_XTLDR_HH */
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/library/modproto.c
|
* FILE: xtldr/library/modproto.cc
|
||||||
* DESCRIPTION: XT Boot Loader protocol support for XTLDR modules
|
* DESCRIPTION: XT Boot Loader protocol support for XTLDR modules
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
|
XTCLINK
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
||||||
@@ -32,13 +33,13 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
|||||||
OUT PXTBL_LOADER_PROTOCOL *ProtocolHandler)
|
OUT PXTBL_LOADER_PROTOCOL *ProtocolHandler)
|
||||||
{
|
{
|
||||||
EFI_GUID ProtocolGuid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
EFI_GUID ProtocolGuid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
||||||
PEFI_HANDLE Handles = NULL;
|
PEFI_HANDLE Handles = NULLPTR;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT_PTR Count;
|
UINT_PTR Count;
|
||||||
UINT Index;
|
UINT Index;
|
||||||
|
|
||||||
/* Try to locate the handles */
|
/* Try to locate the handles */
|
||||||
Status = SystemTable->BootServices->LocateHandleBuffer(ByProtocol, &ProtocolGuid, NULL, &Count, &Handles);
|
Status = SystemTable->BootServices->LocateHandleBuffer(ByProtocol, &ProtocolGuid, NULLPTR, &Count, &Handles);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Unable to get handles */
|
/* Unable to get handles */
|
||||||
@@ -53,7 +54,7 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
|||||||
{
|
{
|
||||||
/* Try to open protocol */
|
/* Try to open protocol */
|
||||||
Status = SystemTable->BootServices->OpenProtocol(Handles[Index], &ProtocolGuid,
|
Status = SystemTable->BootServices->OpenProtocol(Handles[Index], &ProtocolGuid,
|
||||||
(PVOID*)ProtocolHandler, ImageHandle, NULL,
|
(PVOID*)ProtocolHandler, ImageHandle, NULLPTR,
|
||||||
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
|
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
|
||||||
|
|
||||||
/* Check if successfully opened the loader protocol */
|
/* Check if successfully opened the loader protocol */
|
||||||
@@ -69,7 +70,7 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
|
|||||||
SystemTable->BootServices->FreePool(Handles);
|
SystemTable->BootServices->FreePool(Handles);
|
||||||
|
|
||||||
/* Make sure the loaded protocol has been found */
|
/* Make sure the loaded protocol has been found */
|
||||||
if(*ProtocolHandler == NULL)
|
if(*ProtocolHandler == NULLPTR)
|
||||||
{
|
{
|
||||||
/* Protocol not found */
|
/* Protocol not found */
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/memory.c
|
* FILE: xtldr/memory.cc
|
||||||
* DESCRIPTION: XT Boot Loader memory management
|
* DESCRIPTION: XT Boot Loader memory management
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtldr.h>
|
#include <xtldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,10 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlAllocateMemoryPages(IN ULONGLONG NumberOfPages,
|
Memory::AllocatePages(IN EFI_ALLOCATE_TYPE AllocationType,
|
||||||
|
IN ULONGLONG NumberOfPages,
|
||||||
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
||||||
{
|
{
|
||||||
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, NumberOfPages, Memory);
|
return XtLoader::GetEfiSystemTable()->BootServices->AllocatePages(AllocationType, EfiLoaderData,
|
||||||
|
NumberOfPages, Memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,11 +47,11 @@ BlAllocateMemoryPages(IN ULONGLONG NumberOfPages,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlAllocateMemoryPool(IN UINT_PTR Size,
|
Memory::AllocatePool(IN UINT_PTR Size,
|
||||||
OUT PVOID *Memory)
|
OUT PVOID *Memory)
|
||||||
{
|
{
|
||||||
/* Allocate pool */
|
/* Allocate pool */
|
||||||
return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
|
return XtLoader::GetEfiSystemTable()->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,10 +69,10 @@ BlAllocateMemoryPool(IN UINT_PTR Size,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlFreeMemoryPages(IN ULONGLONG NumberOfPages,
|
Memory::FreePages(IN ULONGLONG NumberOfPages,
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory)
|
IN EFI_PHYSICAL_ADDRESS Memory)
|
||||||
{
|
{
|
||||||
return EfiSystemTable->BootServices->FreePages(Memory, NumberOfPages);
|
return XtLoader::GetEfiSystemTable()->BootServices->FreePages(Memory, NumberOfPages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,10 +87,58 @@ BlFreeMemoryPages(IN ULONGLONG NumberOfPages,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlFreeMemoryPool(IN PVOID Memory)
|
Memory::FreePool(IN PVOID Memory)
|
||||||
{
|
{
|
||||||
/* Free pool */
|
/* Free pool */
|
||||||
return EfiSystemTable->BootServices->FreePool(Memory);
|
return XtLoader::GetEfiSystemTable()->BootServices->FreePool(Memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts EFI memory type to XTLDR memory type.
|
||||||
|
*
|
||||||
|
* @param EfiMemoryType
|
||||||
|
* Specifies EFI memory type.
|
||||||
|
*
|
||||||
|
* @return This routine returns a mapped XTLDR memory type.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
LOADER_MEMORY_TYPE
|
||||||
|
Memory::GetLoaderMemoryType(IN EFI_MEMORY_TYPE EfiMemoryType)
|
||||||
|
{
|
||||||
|
LOADER_MEMORY_TYPE MemoryType;
|
||||||
|
|
||||||
|
/* Check EFI memory type and convert to XTLDR memory type */
|
||||||
|
switch(EfiMemoryType)
|
||||||
|
{
|
||||||
|
case EfiACPIMemoryNVS:
|
||||||
|
case EfiACPIReclaimMemory:
|
||||||
|
case EfiPalCode:
|
||||||
|
case EfiReservedMemoryType:
|
||||||
|
MemoryType = LoaderSpecialMemory;
|
||||||
|
break;
|
||||||
|
case EfiRuntimeServicesCode:
|
||||||
|
case EfiRuntimeServicesData:
|
||||||
|
case EfiMemoryMappedIO:
|
||||||
|
case EfiMemoryMappedIOPortSpace:
|
||||||
|
MemoryType = LoaderFirmwarePermanent;
|
||||||
|
break;
|
||||||
|
case EfiBootServicesData:
|
||||||
|
case EfiLoaderCode:
|
||||||
|
case EfiLoaderData:
|
||||||
|
MemoryType = LoaderFirmwareTemporary;
|
||||||
|
break;
|
||||||
|
case EfiUnusableMemory:
|
||||||
|
MemoryType = LoaderBad;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MemoryType = LoaderFree;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return XTLDR memory type */
|
||||||
|
return MemoryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +156,7 @@ BlFreeMemoryPool(IN PVOID Memory)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlGetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::GetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
OUT PULONG NumberOfMappings)
|
OUT PULONG NumberOfMappings)
|
||||||
{
|
{
|
||||||
/* Return number of mappings */
|
/* Return number of mappings */
|
||||||
@@ -125,24 +175,27 @@ BlGetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
Memory::GetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if(MemoryMap == NULL)
|
if(MemoryMap == NULLPTR)
|
||||||
{
|
{
|
||||||
return STATUS_EFI_INVALID_PARAMETER;
|
return STATUS_EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryMap->Map = NULL;
|
MemoryMap->Map = NULLPTR;
|
||||||
MemoryMap->MapSize = 0;
|
MemoryMap->MapSize = 0;
|
||||||
|
|
||||||
/* Get memory map */
|
/* Get memory map */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Attempt do get EFI memory map */
|
/* Attempt do get EFI memory map */
|
||||||
Status = EfiSystemTable->BootServices->GetMemoryMap(&MemoryMap->MapSize, MemoryMap->Map, &MemoryMap->MapKey,
|
Status = XtLoader::GetEfiSystemTable()->BootServices->GetMemoryMap(&MemoryMap->MapSize,
|
||||||
&MemoryMap->DescriptorSize, &MemoryMap->DescriptorVersion);
|
MemoryMap->Map,
|
||||||
|
&MemoryMap->MapKey,
|
||||||
|
&MemoryMap->DescriptorSize,
|
||||||
|
&MemoryMap->DescriptorVersion);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Go further if succeeded */
|
/* Go further if succeeded */
|
||||||
@@ -154,19 +207,19 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
|||||||
if(MemoryMap->Map)
|
if(MemoryMap->Map)
|
||||||
{
|
{
|
||||||
/* Free allocated memory */
|
/* Free allocated memory */
|
||||||
BlFreeMemoryPool(MemoryMap->Map);
|
FreePool(MemoryMap->Map);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the desired amount of memory */
|
/* Allocate the desired amount of memory */
|
||||||
MemoryMap->MapSize += 2 * MemoryMap->DescriptorSize;
|
MemoryMap->MapSize += 2 * MemoryMap->DescriptorSize;
|
||||||
BlAllocateMemoryPool(MemoryMap->MapSize, (PVOID *)&MemoryMap->Map);
|
AllocatePool(MemoryMap->MapSize, (PVOID *)&MemoryMap->Map);
|
||||||
}
|
}
|
||||||
while(Status == STATUS_EFI_BUFFER_TOO_SMALL);
|
while(Status == STATUS_EFI_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
/* Make sure memory map is set */
|
/* Make sure memory map is set */
|
||||||
if(MemoryMap->Map == NULL)
|
if(MemoryMap->Map == NULLPTR)
|
||||||
{
|
{
|
||||||
/* Something went wrong */
|
/* Something went wrong */
|
||||||
return STATUS_EFI_NO_MAPPING;
|
return STATUS_EFI_NO_MAPPING;
|
||||||
@@ -191,7 +244,7 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
PVOID
|
PVOID
|
||||||
BlGetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::GetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID PhysicalAddress)
|
IN PVOID PhysicalAddress)
|
||||||
{
|
{
|
||||||
PXTBL_MEMORY_MAPPING Mapping;
|
PXTBL_MEMORY_MAPPING Mapping;
|
||||||
@@ -208,11 +261,11 @@ BlGetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(Mapping->VirtualAddress)
|
if(Mapping->VirtualAddress)
|
||||||
{
|
{
|
||||||
/* Check if provided physical address is in range of this mapping */
|
/* Check if provided physical address is in range of this mapping */
|
||||||
if((PhysicalAddress >= Mapping->PhysicalAddress) &&
|
if(((UINT_PTR)PhysicalAddress >= (UINT_PTR)Mapping->PhysicalAddress) &&
|
||||||
(PhysicalAddress < Mapping->PhysicalAddress + (Mapping->NumberOfPages * EFI_PAGE_SIZE)))
|
((UINT_PTR)PhysicalAddress < ((UINT_PTR)Mapping->PhysicalAddress + (Mapping->NumberOfPages * EFI_PAGE_SIZE))))
|
||||||
{
|
{
|
||||||
/* Calculate virtual address based on the mapping and return it */
|
/* Calculate virtual address based on the mapping and return it */
|
||||||
return PhysicalAddress - Mapping->PhysicalAddress + Mapping->VirtualAddress;
|
return (PVOID)(((UINT_PTR)PhysicalAddress - (UINT_PTR)Mapping->PhysicalAddress) + (UINT_PTR)Mapping->VirtualAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,12 +295,12 @@ BlGetVirtualAddress(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
Memory::InitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN SHORT PageMapLevel,
|
IN SHORT PageMapLevel,
|
||||||
IN PAGE_SIZE PageSize)
|
IN PAGE_SIZE PageSize)
|
||||||
{
|
{
|
||||||
/* Initialize memory mappings */
|
/* Initialize memory mappings */
|
||||||
RtlInitializeListHead(&PageMap->MemoryMap);
|
RTL::LinkedList::InitializeListHead(&PageMap->MemoryMap);
|
||||||
PageMap->MapSize = 0;
|
PageMap->MapSize = 0;
|
||||||
|
|
||||||
/* Set page map size/level and memory map address */
|
/* Set page map size/level and memory map address */
|
||||||
@@ -273,7 +326,7 @@ BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
Memory::MapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN OUT PVOID *MemoryMapAddress,
|
IN OUT PVOID *MemoryMapAddress,
|
||||||
IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine)
|
IN PBL_GET_MEMTYPE_ROUTINE GetMemoryTypeRoutine)
|
||||||
{
|
{
|
||||||
@@ -286,21 +339,21 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
SIZE_T Index;
|
SIZE_T Index;
|
||||||
|
|
||||||
/* Set virtual address as specified in argument */
|
/* Set virtual address as specified in argument */
|
||||||
VirtualAddress = *MemoryMapAddress;
|
VirtualAddress = (PUCHAR)*MemoryMapAddress;
|
||||||
|
|
||||||
/* Check if custom memory type routine is specified */
|
/* Check if custom memory type routine is specified */
|
||||||
if(GetMemoryTypeRoutine == NULL)
|
if(GetMemoryTypeRoutine == NULLPTR)
|
||||||
{
|
{
|
||||||
/* Use default memory type routine */
|
/* Use default memory type routine */
|
||||||
GetMemoryTypeRoutine = BlpGetLoaderMemoryType;
|
GetMemoryTypeRoutine = GetLoaderMemoryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and zero-fill buffer for EFI memory map */
|
/* Allocate and zero-fill buffer for EFI memory map */
|
||||||
BlAllocateMemoryPool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
AllocatePool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
||||||
RtlZeroMemory(MemoryMap, sizeof(EFI_MEMORY_MAP));
|
RTL::Memory::ZeroMemory(MemoryMap, sizeof(EFI_MEMORY_MAP));
|
||||||
|
|
||||||
/* Get EFI memory map */
|
/* Get EFI memory map */
|
||||||
Status = BlGetMemoryMap(MemoryMap);
|
Status = GetMemoryMap(MemoryMap);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to get EFI memory map */
|
/* Failed to get EFI memory map */
|
||||||
@@ -345,19 +398,19 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Convert EFI memory type into XTLDR memory type */
|
/* Convert EFI memory type into XTLDR memory type */
|
||||||
MemoryType = GetMemoryTypeRoutine(Descriptor->Type);
|
MemoryType = GetMemoryTypeRoutine((EFI_MEMORY_TYPE)Descriptor->Type);
|
||||||
|
|
||||||
/* Do memory mappings depending on memory type */
|
/* Do memory mappings depending on memory type */
|
||||||
if(MemoryType == LoaderFirmwareTemporary)
|
if(MemoryType == LoaderFirmwareTemporary)
|
||||||
{
|
{
|
||||||
/* Map EFI firmware code */
|
/* Map EFI firmware code */
|
||||||
Status = BlMapVirtualMemory(PageMap, (PVOID)Descriptor->PhysicalStart,
|
Status = MapVirtualMemory(PageMap, (PVOID)Descriptor->PhysicalStart,
|
||||||
(PVOID)Descriptor->PhysicalStart, Descriptor->NumberOfPages, MemoryType);
|
(PVOID)Descriptor->PhysicalStart, Descriptor->NumberOfPages, MemoryType);
|
||||||
}
|
}
|
||||||
else if(MemoryType != LoaderFree)
|
else if(MemoryType != LoaderFree)
|
||||||
{
|
{
|
||||||
/* Add any non-free memory mapping */
|
/* Add any non-free memory mapping */
|
||||||
Status = BlMapVirtualMemory(PageMap, VirtualAddress, (PVOID)Descriptor->PhysicalStart,
|
Status = MapVirtualMemory(PageMap, VirtualAddress, (PVOID)Descriptor->PhysicalStart,
|
||||||
Descriptor->NumberOfPages, MemoryType);
|
Descriptor->NumberOfPages, MemoryType);
|
||||||
|
|
||||||
/* Calculate next valid virtual address */
|
/* Calculate next valid virtual address */
|
||||||
@@ -366,7 +419,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Map all other memory as loader free */
|
/* Map all other memory as loader free */
|
||||||
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)Descriptor->PhysicalStart,
|
Status = MapVirtualMemory(PageMap, NULLPTR, (PVOID)Descriptor->PhysicalStart,
|
||||||
Descriptor->NumberOfPages, LoaderFree);
|
Descriptor->NumberOfPages, LoaderFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +436,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Always map first page */
|
/* Always map first page */
|
||||||
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)0, 1, LoaderFirmwarePermanent);
|
Status = MapVirtualMemory(PageMap, NULLPTR, (PVOID)0, 1, LoaderFirmwarePermanent);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Mapping failed */
|
/* Mapping failed */
|
||||||
@@ -391,7 +444,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Map BIOS ROM and VRAM */
|
/* Map BIOS ROM and VRAM */
|
||||||
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)0xA0000, 0x60, LoaderFirmwarePermanent);
|
Status = MapVirtualMemory(PageMap, NULLPTR, (PVOID)0xA0000, 0x60, LoaderFirmwarePermanent);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Mapping failed */
|
/* Mapping failed */
|
||||||
@@ -427,7 +480,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
Memory::MapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID VirtualAddress,
|
IN PVOID VirtualAddress,
|
||||||
IN PVOID PhysicalAddress,
|
IN PVOID PhysicalAddress,
|
||||||
IN ULONGLONG NumberOfPages,
|
IN ULONGLONG NumberOfPages,
|
||||||
@@ -440,7 +493,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Allocate memory for new mapping */
|
/* Allocate memory for new mapping */
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_MEMORY_MAPPING), (PVOID *)&Mapping1);
|
Status = AllocatePool(sizeof(XTBL_MEMORY_MAPPING), (PVOID *)&Mapping1);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -490,7 +543,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(NumberOfMappedPages > 0)
|
if(NumberOfMappedPages > 0)
|
||||||
{
|
{
|
||||||
/* Pages associated to the mapping, allocate memory for it */
|
/* Pages associated to the mapping, allocate memory for it */
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_MEMORY_MAPPING), (PVOID*)&Mapping3);
|
Status = AllocatePool(sizeof(XTBL_MEMORY_MAPPING), (PVOID*)&Mapping3);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -499,10 +552,10 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
/* Set mapping fields and insert it on the top */
|
/* Set mapping fields and insert it on the top */
|
||||||
Mapping3->PhysicalAddress = (PUCHAR)PhysicalAddressEnd + 1;
|
Mapping3->PhysicalAddress = (PUCHAR)PhysicalAddressEnd + 1;
|
||||||
Mapping3->VirtualAddress = NULL;
|
Mapping3->VirtualAddress = NULLPTR;
|
||||||
Mapping3->NumberOfPages = NumberOfMappedPages;
|
Mapping3->NumberOfPages = NumberOfMappedPages;
|
||||||
Mapping3->MemoryType = Mapping2->MemoryType;
|
Mapping3->MemoryType = Mapping2->MemoryType;
|
||||||
RtlInsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);
|
RTL::LinkedList::InsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate number of pages and the end of the physical address */
|
/* Calculate number of pages and the end of the physical address */
|
||||||
@@ -526,7 +579,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(NumberOfMappedPages > 0)
|
if(NumberOfMappedPages > 0)
|
||||||
{
|
{
|
||||||
/* Pages associated to the mapping, allocate memory for it */
|
/* Pages associated to the mapping, allocate memory for it */
|
||||||
Status = BlAllocateMemoryPool(sizeof(XTBL_MEMORY_MAPPING), (PVOID*)&Mapping3);
|
Status = AllocatePool(sizeof(XTBL_MEMORY_MAPPING), (PVOID*)&Mapping3);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
@@ -535,10 +588,10 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
|
|
||||||
/* Set mapping fields and insert it on the top */
|
/* Set mapping fields and insert it on the top */
|
||||||
Mapping3->PhysicalAddress = Mapping1->PhysicalAddress;
|
Mapping3->PhysicalAddress = Mapping1->PhysicalAddress;
|
||||||
Mapping3->VirtualAddress = NULL;
|
Mapping3->VirtualAddress = NULLPTR;
|
||||||
Mapping3->NumberOfPages = NumberOfMappedPages;
|
Mapping3->NumberOfPages = NumberOfMappedPages;
|
||||||
Mapping3->MemoryType = Mapping2->MemoryType;
|
Mapping3->MemoryType = Mapping2->MemoryType;
|
||||||
RtlInsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);
|
RTL::LinkedList::InsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate number of pages and the end of the physical address */
|
/* Calculate number of pages and the end of the physical address */
|
||||||
@@ -562,8 +615,8 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
MappingListEntry = ListEntry->Flink;
|
MappingListEntry = ListEntry->Flink;
|
||||||
|
|
||||||
/* Remove mapping from the list and free up it's memory */
|
/* Remove mapping from the list and free up it's memory */
|
||||||
RtlRemoveEntryList(&Mapping2->ListEntry);
|
RTL::LinkedList::RemoveEntryList(&Mapping2->ListEntry);
|
||||||
Status = BlFreeMemoryPool(Mapping2);
|
Status = FreePool(Mapping2);
|
||||||
ListEntry = MappingListEntry;
|
ListEntry = MappingListEntry;
|
||||||
|
|
||||||
/* Go to the next mapping */
|
/* Go to the next mapping */
|
||||||
@@ -574,7 +627,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(Mapping2->PhysicalAddress > Mapping1->PhysicalAddress)
|
if(Mapping2->PhysicalAddress > Mapping1->PhysicalAddress)
|
||||||
{
|
{
|
||||||
/* Insert new mapping in front */
|
/* Insert new mapping in front */
|
||||||
RtlInsertHeadList(Mapping2->ListEntry.Blink, &Mapping1->ListEntry);
|
RTL::LinkedList::InsertHeadList(Mapping2->ListEntry.Blink, &Mapping1->ListEntry);
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +636,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Insert new mapping to the list and increase page map size */
|
/* Insert new mapping to the list and increase page map size */
|
||||||
RtlInsertTailList(&PageMap->MemoryMap, &Mapping1->ListEntry);
|
RTL::LinkedList::InsertTailList(&PageMap->MemoryMap, &Mapping1->ListEntry);
|
||||||
PageMap->MapSize++;
|
PageMap->MapSize++;
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
@@ -608,7 +661,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
PVOID
|
PVOID
|
||||||
BlPhysicalAddressToVirtual(IN PVOID PhysicalAddress,
|
Memory::PhysicalAddressToVirtual(IN PVOID PhysicalAddress,
|
||||||
IN PVOID PhysicalBase,
|
IN PVOID PhysicalBase,
|
||||||
IN PVOID VirtualBase)
|
IN PVOID VirtualBase)
|
||||||
{
|
{
|
||||||
@@ -637,7 +690,7 @@ BlPhysicalAddressToVirtual(IN PVOID PhysicalAddress,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlPhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
Memory::PhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN OUT PLIST_ENTRY ListHead,
|
IN OUT PLIST_ENTRY ListHead,
|
||||||
IN PVOID PhysicalBase,
|
IN PVOID PhysicalBase,
|
||||||
IN PVOID VirtualBase)
|
IN PVOID VirtualBase)
|
||||||
@@ -662,12 +715,12 @@ BlPhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
if(ListEntry->Blink == ListHead)
|
if(ListEntry->Blink == ListHead)
|
||||||
{
|
{
|
||||||
/* Find virtual address of list head */
|
/* Find virtual address of list head */
|
||||||
ListEntry->Blink = BlGetVirtualAddress(PageMap, ListEntry->Blink);
|
ListEntry->Blink = (PLIST_ENTRY)GetVirtualAddress(PageMap, ListEntry->Blink);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Convert list entry */
|
/* Convert list entry */
|
||||||
ListEntry->Blink = BlPhysicalAddressToVirtual(ListEntry->Blink, (PVOID)PhysicalBase, VirtualBase);
|
ListEntry->Blink = (PLIST_ENTRY)PhysicalAddressToVirtual(ListEntry->Blink, (PVOID)PhysicalBase, VirtualBase);
|
||||||
}
|
}
|
||||||
if(ListEntry->Flink == ListHead)
|
if(ListEntry->Flink == ListHead)
|
||||||
{
|
{
|
||||||
@@ -677,7 +730,7 @@ BlPhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Convert list entry */
|
/* Convert list entry */
|
||||||
ListEntry->Flink = BlPhysicalAddressToVirtual(ListEntry->Flink, (PVOID)PhysicalBase, VirtualBase);
|
ListEntry->Flink = (PLIST_ENTRY)PhysicalAddressToVirtual(ListEntry->Flink, (PVOID)PhysicalBase, VirtualBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get to the next element*/
|
/* Get to the next element*/
|
||||||
@@ -685,57 +738,9 @@ BlPhysicalListToVirtual(IN PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Convert list head */
|
/* Convert list head */
|
||||||
ListHead->Blink = BlPhysicalAddressToVirtual(ListHead->Blink, (PVOID)PhysicalBase, VirtualBase);
|
ListHead->Blink = (PLIST_ENTRY)PhysicalAddressToVirtual(ListHead->Blink, (PVOID)PhysicalBase, VirtualBase);
|
||||||
ListHead->Flink = BlPhysicalAddressToVirtual(ListHead->Flink, (PVOID)PhysicalBase, VirtualBase);
|
ListHead->Flink = (PLIST_ENTRY)PhysicalAddressToVirtual(ListHead->Flink, (PVOID)PhysicalBase, VirtualBase);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts EFI memory type to XTLDR memory type.
|
|
||||||
*
|
|
||||||
* @param EfiMemoryType
|
|
||||||
* Specifies EFI memory type.
|
|
||||||
*
|
|
||||||
* @return This routine returns a mapped XTLDR memory type.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
LONG
|
|
||||||
BlpGetLoaderMemoryType(IN EFI_MEMORY_TYPE EfiMemoryType)
|
|
||||||
{
|
|
||||||
LOADER_MEMORY_TYPE MemoryType;
|
|
||||||
|
|
||||||
/* Check EFI memory type and convert to XTLDR memory type */
|
|
||||||
switch(EfiMemoryType)
|
|
||||||
{
|
|
||||||
case EfiACPIMemoryNVS:
|
|
||||||
case EfiACPIReclaimMemory:
|
|
||||||
case EfiPalCode:
|
|
||||||
case EfiReservedMemoryType:
|
|
||||||
MemoryType = LoaderSpecialMemory;
|
|
||||||
break;
|
|
||||||
case EfiRuntimeServicesCode:
|
|
||||||
case EfiRuntimeServicesData:
|
|
||||||
case EfiMemoryMappedIO:
|
|
||||||
case EfiMemoryMappedIOPortSpace:
|
|
||||||
MemoryType = LoaderFirmwarePermanent;
|
|
||||||
break;
|
|
||||||
case EfiBootServicesData:
|
|
||||||
case EfiLoaderCode:
|
|
||||||
case EfiLoaderData:
|
|
||||||
MemoryType = LoaderFirmwareTemporary;
|
|
||||||
break;
|
|
||||||
case EfiUnusableMemory:
|
|
||||||
MemoryType = LoaderBad;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
MemoryType = LoaderFree;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return XTLDR memory type */
|
|
||||||
return MemoryType;
|
|
||||||
}
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_ACPI_SOURCE
|
list(APPEND XTLDR_ACPI_SOURCE
|
||||||
${XTLDR_ACPI_SOURCE_DIR}/acpi.c
|
${XTLDR_ACPI_SOURCE_DIR}/acpi.cc
|
||||||
${XTLDR_ACPI_SOURCE_DIR}/globals.c)
|
${XTLDR_ACPI_SOURCE_DIR}/data.cc)
|
||||||
|
|
||||||
# Link module executable
|
# Link module executable
|
||||||
add_executable(acpi ${XTLDR_ACPI_SOURCE})
|
add_executable(acpi ${XTLDR_ACPI_SOURCE})
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/acpi/acpi.c
|
* FILE: xtldr/modules/acpi/acpi.cc
|
||||||
* DESCRIPTION: XTLDR ACPI Support Module
|
* DESCRIPTION: XTLDR ACPI Support Module
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <acpi.h>
|
#include <acpi.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Dummy module information */
|
/* ACPI module information */
|
||||||
MODULE_AUTHOR(L"Rafal Kupiec <belliash@codingworkshop.eu.org>");
|
MODULE_AUTHOR(L"Rafal Kupiec <belliash@codingworkshop.eu.org>");
|
||||||
MODULE_DESCRIPTION(L"ACPI support");
|
MODULE_DESCRIPTION(L"ACPI support");
|
||||||
MODULE_LICENSE(L"GPLv3");
|
MODULE_LICENSE(L"GPLv3");
|
||||||
MODULE_VERSION(L"0.1");
|
MODULE_VERSION(L"0.1");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to get XSDP. If it is not found or checksum mismatch, it will try to get RSDP instead.
|
* Attempts to get XSDP. If it is not found or checksum mismatch, it will try to get RSDP instead.
|
||||||
*
|
*
|
||||||
@@ -27,12 +28,12 @@ MODULE_VERSION(L"0.1");
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
Acpi::GetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
||||||
{
|
{
|
||||||
PVOID Rsdp;
|
PVOID Rsdp;
|
||||||
|
|
||||||
/* Try to get XSDP (ACPI 2.0) from system configuration tables */
|
/* Try to get XSDP (ACPI 2.0) from system configuration tables */
|
||||||
if(AcGetXsdpTable(&Rsdp) == STATUS_EFI_SUCCESS)
|
if(GetXsdpTable(&Rsdp) == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* XSDP found, return success */
|
/* XSDP found, return success */
|
||||||
*AcpiTable = Rsdp;
|
*AcpiTable = Rsdp;
|
||||||
@@ -40,7 +41,7 @@ AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try to get RSDP (ACPI 1.0) from system configuration tables */
|
/* Try to get RSDP (ACPI 1.0) from system configuration tables */
|
||||||
if(AcGetRsdpTable(&Rsdp) == STATUS_EFI_SUCCESS)
|
if(GetRsdpTable(&Rsdp) == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* RSDP found, return success */
|
/* RSDP found, return success */
|
||||||
*AcpiTable = Rsdp;
|
*AcpiTable = Rsdp;
|
||||||
@@ -61,7 +62,7 @@ AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
|||||||
* Supplies a pointer to the table to start searching from.
|
* Supplies a pointer to the table to start searching from.
|
||||||
*
|
*
|
||||||
* @param AcpiTable
|
* @param AcpiTable
|
||||||
* Supplies a pointer to memory area where ACPI table address will be stored, or NULL if not found.
|
* Supplies a pointer to memory area where ACPI table address will be stored, or NULLPTR if not found.
|
||||||
*
|
*
|
||||||
* @return This routine returns a status code.
|
* @return This routine returns a status code.
|
||||||
*
|
*
|
||||||
@@ -69,7 +70,7 @@ AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetAcpiTable(IN CONST UINT Signature,
|
Acpi::GetAcpiTable(IN CONST UINT Signature,
|
||||||
IN PVOID PreviousTable,
|
IN PVOID PreviousTable,
|
||||||
OUT PVOID *AcpiTable)
|
OUT PVOID *AcpiTable)
|
||||||
{
|
{
|
||||||
@@ -81,11 +82,11 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
|||||||
PACPI_RSDT Rsdt;
|
PACPI_RSDT Rsdt;
|
||||||
BOOLEAN Xsdp;
|
BOOLEAN Xsdp;
|
||||||
|
|
||||||
/* Return NULL address by default if requested table not found */
|
/* Return NULLPTR by default if requested table not found */
|
||||||
*AcpiTable = NULL;
|
*AcpiTable = NULLPTR;
|
||||||
|
|
||||||
/* Get Root System Description Table Pointer */
|
/* Get Root System Description Table Pointer */
|
||||||
Status = AcGetAcpiDescriptionPointer((PVOID)&Rsdp);
|
Status = GetAcpiDescriptionPointer((PVOID*)&Rsdp);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* ACPI tables not found, return error */
|
/* ACPI tables not found, return error */
|
||||||
@@ -127,13 +128,13 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if previous table provided */
|
/* Check if previous table provided */
|
||||||
if(PreviousTable != NULL)
|
if(PreviousTable != NULLPTR)
|
||||||
{
|
{
|
||||||
/* Check if this is a table previously found */
|
/* Check if this is a table previously found */
|
||||||
if(TableHeader == (PVOID)PreviousTable)
|
if(TableHeader == (PVOID)PreviousTable)
|
||||||
{
|
{
|
||||||
/* Unset previous table */
|
/* Unset previous table */
|
||||||
PreviousTable = NULL;
|
PreviousTable = NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next ACPI table */
|
/* Skip to next ACPI table */
|
||||||
@@ -159,7 +160,7 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
|||||||
if(TableHeader->Signature != ACPI_FADT_SIGNATURE || TableHeader->Revision > 2)
|
if(TableHeader->Signature != ACPI_FADT_SIGNATURE || TableHeader->Revision > 2)
|
||||||
{
|
{
|
||||||
/* Validate table checksum */
|
/* Validate table checksum */
|
||||||
if(!AcpValidateAcpiTable(TableHeader, TableHeader->Length))
|
if(!ValidateAcpiTable(TableHeader, TableHeader->Length))
|
||||||
{
|
{
|
||||||
/* Checksum mismatch, return error */
|
/* Checksum mismatch, return error */
|
||||||
return STATUS_EFI_CRC_ERROR;
|
return STATUS_EFI_CRC_ERROR;
|
||||||
@@ -183,16 +184,16 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetApicBase(OUT PVOID *ApicBase)
|
Acpi::GetApicBase(OUT PVOID *ApicBase)
|
||||||
{
|
{
|
||||||
CPUID_REGISTERS CpuRegisters;
|
CPUID_REGISTERS CpuRegisters;
|
||||||
|
|
||||||
/* Prepare CPUID registers to query for APIC support */
|
/* Prepare CPUID registers to query for APIC support */
|
||||||
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
XtLdrProtocol->Memory.ZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
||||||
|
|
||||||
/* Query CPUID */
|
/* Query CPUID */
|
||||||
ArCpuId(&CpuRegisters);
|
XtLdrProtocol->Cpu.CpuId(&CpuRegisters);
|
||||||
|
|
||||||
/* Check if APIC present */
|
/* Check if APIC present */
|
||||||
if((CpuRegisters.Edx & CPUID_FEATURES_EDX_APIC) == 0)
|
if((CpuRegisters.Edx & CPUID_FEATURES_EDX_APIC) == 0)
|
||||||
@@ -202,7 +203,7 @@ AcGetApicBase(OUT PVOID *ApicBase)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get APIC base address */
|
/* Get APIC base address */
|
||||||
*ApicBase = (PVOID)((UINT_PTR)ArReadModelSpecificRegister(0x1B) & 0xFFFFF000);
|
*ApicBase = (PVOID)((UINT_PTR)XtLdrProtocol->Cpu.ReadModelSpecificRegister(0x1B) & 0xFFFFF000);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
@@ -220,18 +221,18 @@ AcGetApicBase(OUT PVOID *ApicBase)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetRsdpTable(OUT PVOID *AcpiTable)
|
Acpi::GetRsdpTable(OUT PVOID *AcpiTable)
|
||||||
{
|
{
|
||||||
EFI_GUID AcpiGuid = EFI_CONFIG_TABLE_ACPI_TABLE_GUID;
|
EFI_GUID AcpiGuid = EFI_CONFIG_TABLE_ACPI_TABLE_GUID;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PVOID RsdpTable;
|
PVOID RsdpTable;
|
||||||
|
|
||||||
/* Get RSDP (ACPI 1.0) table from system configuration tables */
|
/* Get RSDP (ACPI 1.0) table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &RsdpTable);
|
Status = XtLdrProtocol->Utils.GetConfigurationTable(&AcpiGuid, &RsdpTable);
|
||||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(RsdpTable, 20))
|
if(Status != STATUS_EFI_SUCCESS || !ValidateAcpiTable(RsdpTable, 20))
|
||||||
{
|
{
|
||||||
/* RSDP not found or checksum mismatch */
|
/* RSDP not found or checksum mismatch */
|
||||||
*AcpiTable = NULL;
|
*AcpiTable = NULLPTR;
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,18 +253,18 @@ AcGetRsdpTable(OUT PVOID *AcpiTable)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetSMBiosTable(OUT PVOID *SmBiosTable)
|
Acpi::GetSMBiosTable(OUT PVOID *SmBiosTable)
|
||||||
{
|
{
|
||||||
EFI_GUID SmBiosGuid = EFI_CONFIG_TABLE_SMBIOS_TABLE_GUID;
|
EFI_GUID SmBiosGuid = EFI_CONFIG_TABLE_SMBIOS_TABLE_GUID;
|
||||||
PSMBIOS_TABLE_HEADER SmBios;
|
PSMBIOS_TABLE_HEADER SmBios;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Get SMBIOS table from system configuration tables */
|
/* Get SMBIOS table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBiosGuid, (PVOID)&SmBios);
|
Status = XtLdrProtocol->Utils.GetConfigurationTable(&SmBiosGuid, (PVOID*)&SmBios);
|
||||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
if(Status != STATUS_EFI_SUCCESS || !ValidateAcpiTable(SmBios, SmBios->Length))
|
||||||
{
|
{
|
||||||
/* SMBIOS not found or checksum mismatch */
|
/* SMBIOS not found or checksum mismatch */
|
||||||
*SmBiosTable = NULL;
|
*SmBiosTable = NULLPTR;
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,18 +285,18 @@ AcGetSMBiosTable(OUT PVOID *SmBiosTable)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetSMBios3Table(OUT PVOID *SmBiosTable)
|
Acpi::GetSMBios3Table(OUT PVOID *SmBiosTable)
|
||||||
{
|
{
|
||||||
EFI_GUID SmBios3Guid = EFI_CONFIG_TABLE_SMBIOS3_TABLE_GUID;
|
EFI_GUID SmBios3Guid = EFI_CONFIG_TABLE_SMBIOS3_TABLE_GUID;
|
||||||
PSMBIOS3_TABLE_HEADER SmBios;
|
PSMBIOS3_TABLE_HEADER SmBios;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Get SMBIOS3 table from system configuration tables */
|
/* Get SMBIOS3 table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBios3Guid, (PVOID)&SmBios);
|
Status = XtLdrProtocol->Utils.GetConfigurationTable(&SmBios3Guid, (PVOID*)&SmBios);
|
||||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
if(Status != STATUS_EFI_SUCCESS || !ValidateAcpiTable(SmBios, SmBios->Length))
|
||||||
{
|
{
|
||||||
/* SMBIOS3 not found or checksum mismatch */
|
/* SMBIOS3 not found or checksum mismatch */
|
||||||
*SmBiosTable = NULL;
|
*SmBiosTable = NULLPTR;
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,18 +317,18 @@ AcGetSMBios3Table(OUT PVOID *SmBiosTable)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AcGetXsdpTable(OUT PVOID *AcpiTable)
|
Acpi::GetXsdpTable(OUT PVOID *AcpiTable)
|
||||||
{
|
{
|
||||||
EFI_GUID AcpiGuid = EFI_CONFIG_TABLE_ACPI20_TABLE_GUID;
|
EFI_GUID AcpiGuid = EFI_CONFIG_TABLE_ACPI20_TABLE_GUID;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PVOID XsdpTable;
|
PVOID XsdpTable;
|
||||||
|
|
||||||
/* Get XSDP (ACPI 2.0) from system configuration tables */
|
/* Get XSDP (ACPI 2.0) from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &XsdpTable);
|
Status = XtLdrProtocol->Utils.GetConfigurationTable(&AcpiGuid, &XsdpTable);
|
||||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(XsdpTable, 36))
|
if(Status != STATUS_EFI_SUCCESS || !ValidateAcpiTable(XsdpTable, 36))
|
||||||
{
|
{
|
||||||
/* XSDP not found or checksum mismatch */
|
/* XSDP not found or checksum mismatch */
|
||||||
*AcpiTable = NULL;
|
*AcpiTable = NULLPTR;
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,6 +337,48 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
|||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes ACPI module by opening XTLDR protocol and installing ACPI protocol.
|
||||||
|
*
|
||||||
|
* @param ImageHandle
|
||||||
|
* Firmware-allocated handle that identifies the image.
|
||||||
|
*
|
||||||
|
* @param SystemTable
|
||||||
|
* Provides the EFI system table.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Acpi::InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
|
{
|
||||||
|
EFI_GUID Guid = XT_ACPI_PROTOCOL_GUID;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Open the XTLDR protocol */
|
||||||
|
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open the protocol, return error */
|
||||||
|
return STATUS_EFI_PROTOCOL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set routines available via ACPI protocol */
|
||||||
|
AcpiProtocol.GetAcpiDescriptionPointer = GetAcpiDescriptionPointer;
|
||||||
|
AcpiProtocol.GetAcpiTable = GetAcpiTable;
|
||||||
|
AcpiProtocol.GetApicBase = GetApicBase;
|
||||||
|
AcpiProtocol.GetRsdpTable = GetRsdpTable;
|
||||||
|
AcpiProtocol.GetSMBiosTable = GetSMBiosTable;
|
||||||
|
AcpiProtocol.GetSMBios3Table = GetSMBios3Table;
|
||||||
|
AcpiProtocol.GetXsdpTable = GetXsdpTable;
|
||||||
|
|
||||||
|
/* Install ACPI protocol */
|
||||||
|
return XtLdrProtocol->Protocol.Install(&AcpiProtocol, &Guid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates given ACPI table by calculating its checksum.
|
* Validates given ACPI table by calculating its checksum.
|
||||||
*
|
*
|
||||||
@@ -351,7 +394,7 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
AcpValidateAcpiTable(IN PVOID Buffer,
|
Acpi::ValidateAcpiTable(IN PVOID Buffer,
|
||||||
IN UINT_PTR Size)
|
IN UINT_PTR Size)
|
||||||
{
|
{
|
||||||
PUCHAR Pointer;
|
PUCHAR Pointer;
|
||||||
@@ -359,7 +402,7 @@ AcpValidateAcpiTable(IN PVOID Buffer,
|
|||||||
|
|
||||||
/* Initialize variables */
|
/* Initialize variables */
|
||||||
Sum = 0;
|
Sum = 0;
|
||||||
Pointer = Buffer;
|
Pointer = (PUCHAR)Buffer;
|
||||||
|
|
||||||
/* Calculate checksum of given table */
|
/* Calculate checksum of given table */
|
||||||
while(Size != 0)
|
while(Size != 0)
|
||||||
@@ -391,26 +434,6 @@ EFI_STATUS
|
|||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
{
|
{
|
||||||
EFI_GUID Guid = XT_ACPI_PROTOCOL_GUID;
|
/* Initialize ACPI module */
|
||||||
EFI_STATUS Status;
|
return Acpi::InitializeModule(ImageHandle, SystemTable);
|
||||||
|
|
||||||
/* Open the XTLDR protocol */
|
|
||||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open the protocol, return error */
|
|
||||||
return STATUS_EFI_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set routines available via ACPI protocol */
|
|
||||||
AcpAcpiProtocol.GetAcpiDescriptionPointer = AcGetAcpiDescriptionPointer;
|
|
||||||
AcpAcpiProtocol.GetAcpiTable = AcGetAcpiTable;
|
|
||||||
AcpAcpiProtocol.GetApicBase = AcGetApicBase;
|
|
||||||
AcpAcpiProtocol.GetRsdpTable = AcGetRsdpTable;
|
|
||||||
AcpAcpiProtocol.GetSMBiosTable = AcGetSMBiosTable;
|
|
||||||
AcpAcpiProtocol.GetSMBios3Table = AcGetSMBios3Table;
|
|
||||||
AcpAcpiProtocol.GetXsdpTable = AcGetXsdpTable;
|
|
||||||
|
|
||||||
/* Install ACPI protocol */
|
|
||||||
return XtLdrProtocol->Protocol.Install(&AcpAcpiProtocol, &Guid);
|
|
||||||
}
|
}
|
@@ -1,16 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/acpi/globals.c
|
* FILE: xtldr/modules/acpi/data.cc
|
||||||
* DESCRIPTION: ACPI module global variables
|
* DESCRIPTION: ACPI module global and static data
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtblapi.h>
|
#include <acpi.hh>
|
||||||
|
|
||||||
|
|
||||||
/* ACPI Protocol */
|
/* ACPI Protocol */
|
||||||
XTBL_ACPI_PROTOCOL AcpAcpiProtocol;
|
XTBL_ACPI_PROTOCOL Acpi::AcpiProtocol;
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
/* XTLDR protocol handler */
|
||||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
PXTBL_LOADER_PROTOCOL Acpi::XtLdrProtocol;
|
@@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/acpi/includes/acpi.h
|
|
||||||
* DESCRIPTION: XTLDR ACPI module header file
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_ACPI_ACPI_H
|
|
||||||
#define __XTLDR_ACPI_ACPI_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* ACPI module routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetAcpiTable(IN CONST UINT Signature,
|
|
||||||
IN PVOID PreviousTable,
|
|
||||||
OUT PVOID *AcpiTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetApicBase(OUT PVOID *ApicBase);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetRsdpTable(OUT PVOID *AcpiTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetSMBiosTable(OUT PVOID *SmBiosTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetSMBios3Table(OUT PVOID *SmBiosTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
AcGetXsdpTable(OUT PVOID *AcpiTable);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
BOOLEAN
|
|
||||||
AcpValidateAcpiTable(IN PVOID Buffer,
|
|
||||||
IN UINT_PTR Size);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
#endif/* __XTLDR_ACPI_ACPI_H */
|
|
40
xtldr/modules/acpi/includes/acpi.hh
Normal file
40
xtldr/modules/acpi/includes/acpi.hh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/acpi/includes/acpi.hh
|
||||||
|
* DESCRIPTION: XTLDR ACPI module header file
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_ACPI_ACPI_HH
|
||||||
|
#define __XTLDR_ACPI_ACPI_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* ACPI module for XTLDR */
|
||||||
|
class Acpi
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC XTBL_ACPI_PROTOCOL AcpiProtocol;
|
||||||
|
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS GetAcpiDescriptionPointer(OUT PVOID *AcpiTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetAcpiTable(IN CONST UINT Signature,
|
||||||
|
IN PVOID PreviousTable,
|
||||||
|
OUT PVOID *AcpiTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetApicBase(OUT PVOID *ApicBase);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetRsdpTable(OUT PVOID *AcpiTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetSMBiosTable(OUT PVOID *SmBiosTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetSMBios3Table(OUT PVOID *SmBiosTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetXsdpTable(OUT PVOID *AcpiTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL BOOLEAN ValidateAcpiTable(IN PVOID Buffer,
|
||||||
|
IN UINT_PTR Size);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __XTLDR_ACPI_ACPI_HH */
|
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/acpi/includes/globals.h
|
|
||||||
* DESCRIPTION: ACPI Module global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_ACPI_GLOBALS_H
|
|
||||||
#define __XTLDR_ACPI_GLOBALS_H
|
|
||||||
|
|
||||||
#include <acpi.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* ACPI Protocol */
|
|
||||||
EXTERN XTBL_ACPI_PROTOCOL AcpAcpiProtocol;
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
#endif/* __XTLDR_ACPI_GLOBALS_H */
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_BEEP_SOURCE
|
list(APPEND XTLDR_BEEP_SOURCE
|
||||||
${XTLDR_BEEP_SOURCE_DIR}/beep.c
|
${XTLDR_BEEP_SOURCE_DIR}/beep.cc
|
||||||
${XTLDR_BEEP_SOURCE_DIR}/globals.c)
|
${XTLDR_BEEP_SOURCE_DIR}/data.cc)
|
||||||
|
|
||||||
# Link module executable
|
# Link module executable
|
||||||
add_executable(beep ${XTLDR_BEEP_SOURCE})
|
add_executable(beep ${XTLDR_BEEP_SOURCE})
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/beep/beep.c
|
* FILE: xtldr/modules/beep/beep.cc
|
||||||
* DESCRIPTION: XTLDR Beep Module
|
* DESCRIPTION: XTLDR Beep Module
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <beep.h>
|
#include <beep.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Beep module information */
|
/* Beep module information */
|
||||||
@@ -15,6 +15,7 @@ MODULE_DESCRIPTION(L"Plays a GRUB compatible tune via PC speaker");
|
|||||||
MODULE_LICENSE(L"GPLv3");
|
MODULE_LICENSE(L"GPLv3");
|
||||||
MODULE_VERSION(L"0.1");
|
MODULE_VERSION(L"0.1");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the PC speaker.
|
* Disables the PC speaker.
|
||||||
*
|
*
|
||||||
@@ -24,13 +25,13 @@ MODULE_VERSION(L"0.1");
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BpDisableToneBeep()
|
Beep::DisableToneBeep()
|
||||||
{
|
{
|
||||||
UCHAR Status;
|
UCHAR Status;
|
||||||
|
|
||||||
/* Stop the PC speaker */
|
/* Stop the PC speaker */
|
||||||
Status = HlIoPortInByte(0x61);
|
Status = XtLdrProtocol->IoPort.Read8(0x61);
|
||||||
HlIoPortOutByte(0x61, Status & 0xFC);
|
XtLdrProtocol->IoPort.Write8(0x61, Status & 0xFC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ BpDisableToneBeep()
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BpEnableToneBeep(IN UINT Pitch)
|
Beep::EnableToneBeep(IN UINT Pitch)
|
||||||
{
|
{
|
||||||
UINT Counter;
|
UINT Counter;
|
||||||
UCHAR Status;
|
UCHAR Status;
|
||||||
@@ -62,14 +63,51 @@ BpEnableToneBeep(IN UINT Pitch)
|
|||||||
|
|
||||||
/* Set the desired frequency of the PIT clock */
|
/* Set the desired frequency of the PIT clock */
|
||||||
Counter = 0x1234DD / Pitch;
|
Counter = 0x1234DD / Pitch;
|
||||||
HlIoPortOutByte(0x43, 0xB6);
|
XtLdrProtocol->IoPort.Write8(0x43, 0xB6);
|
||||||
HlIoPortOutByte(0x43, 0xB6);
|
XtLdrProtocol->IoPort.Write8(0x43, 0xB6);
|
||||||
HlIoPortOutByte(0x42, (UCHAR) Counter & 0xFF);
|
XtLdrProtocol->IoPort.Write8(0x42, (UCHAR) Counter & 0xFF);
|
||||||
HlIoPortOutByte(0x42, (UCHAR) (Counter >> 8) & 0xFF);
|
XtLdrProtocol->IoPort.Write8(0x42, (UCHAR) (Counter >> 8) & 0xFF);
|
||||||
|
|
||||||
/* Start the PC speaker */
|
/* Start the PC speaker */
|
||||||
Status = HlIoPortInByte(0x61);
|
Status = XtLdrProtocol->IoPort.Read8(0x61);
|
||||||
HlIoPortOutByte(0x61, Status | 0x03);
|
XtLdrProtocol->IoPort.Write8(0x61, Status | 0x03);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes BEEP module by opening XTLDR protocol and playing the tune.
|
||||||
|
*
|
||||||
|
* @param ImageHandle
|
||||||
|
* Firmware-allocated handle that identifies the image.
|
||||||
|
*
|
||||||
|
* @param SystemTable
|
||||||
|
* Provides the EFI system table.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Beep::InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
PWCHAR Tune;
|
||||||
|
|
||||||
|
/* Open the XTLDR protocol */
|
||||||
|
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open the protocol, return error */
|
||||||
|
return STATUS_EFI_PROTOCOL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Play the tune set in the configuration */
|
||||||
|
XtLdrProtocol->Config.GetValue(L"TUNE", &Tune);
|
||||||
|
PlayTune(Tune);
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +122,7 @@ BpEnableToneBeep(IN UINT Pitch)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BpPlayTune(IN PWCHAR Arguments)
|
Beep::PlayTune(IN PWCHAR Arguments)
|
||||||
{
|
{
|
||||||
LONG Pitch, Duration, Tempo;
|
LONG Pitch, Duration, Tempo;
|
||||||
PWCHAR Argument, LastArgument;
|
PWCHAR Argument, LastArgument;
|
||||||
@@ -95,41 +133,41 @@ BpPlayTune(IN PWCHAR Arguments)
|
|||||||
Tempo = -1;
|
Tempo = -1;
|
||||||
|
|
||||||
/* Tokenize provided list of arguments */
|
/* Tokenize provided list of arguments */
|
||||||
Argument = RtlTokenizeWideString(Arguments, L" ", &LastArgument);
|
Argument = XtLdrProtocol->WideString.Tokenize(Arguments, L" ", &LastArgument);
|
||||||
|
|
||||||
/* Iterate over all arguments */
|
/* Iterate over all arguments */
|
||||||
while(Argument != NULL)
|
while(Argument != NULLPTR)
|
||||||
{
|
{
|
||||||
/* Check if tempo, pitch and duration are set */
|
/* Check if tempo, pitch and duration are set */
|
||||||
if(Tempo < 0)
|
if(Tempo < 0)
|
||||||
{
|
{
|
||||||
/* Set the tempo */
|
/* Set the tempo */
|
||||||
Tempo = BpWideStringToNumber(Argument);
|
Tempo = WideStringToNumber(Argument);
|
||||||
}
|
}
|
||||||
else if(Pitch < 0)
|
else if(Pitch < 0)
|
||||||
{
|
{
|
||||||
/* Set the pitch */
|
/* Set the pitch */
|
||||||
Pitch = BpWideStringToNumber(Argument);
|
Pitch = WideStringToNumber(Argument);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Set the duration */
|
/* Set the duration */
|
||||||
Duration = BpWideStringToNumber(Argument);
|
Duration = WideStringToNumber(Argument);
|
||||||
|
|
||||||
/* Check pitch value */
|
/* Check pitch value */
|
||||||
if(Pitch > 0)
|
if(Pitch > 0)
|
||||||
{
|
{
|
||||||
/* Emit the beep tone */
|
/* Emit the beep tone */
|
||||||
BpEnableToneBeep(Pitch);
|
EnableToneBeep(Pitch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Stop emitting beep tone */
|
/* Stop emitting beep tone */
|
||||||
BpDisableToneBeep();
|
DisableToneBeep();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for duration time */
|
/* Wait for duration time */
|
||||||
XtLdrProtocol->Util.SleepExecution(60000 * Duration / Tempo);
|
XtLdrProtocol->Utils.SleepExecution(60000 * Duration / Tempo);
|
||||||
|
|
||||||
/* Reset pitch and duration */
|
/* Reset pitch and duration */
|
||||||
Pitch = -1;
|
Pitch = -1;
|
||||||
@@ -137,11 +175,11 @@ BpPlayTune(IN PWCHAR Arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get next argument */
|
/* Get next argument */
|
||||||
Argument = RtlTokenizeWideString(NULL, L" ", &LastArgument);
|
Argument = XtLdrProtocol->WideString.Tokenize(NULLPTR, L" ", &LastArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop emitting beep tone */
|
/* Stop emitting beep tone */
|
||||||
BpDisableToneBeep();
|
DisableToneBeep();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,7 +194,7 @@ BpPlayTune(IN PWCHAR Arguments)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UINT
|
UINT
|
||||||
BpWideStringToNumber(IN PWCHAR String)
|
Beep::WideStringToNumber(IN PWCHAR String)
|
||||||
{
|
{
|
||||||
ULONG Number = 0;
|
ULONG Number = 0;
|
||||||
|
|
||||||
@@ -195,19 +233,6 @@ EFI_STATUS
|
|||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
/* Initialize BEEP module */
|
||||||
|
return Beep::InitializeModule(ImageHandle, SystemTable);
|
||||||
/* Open the XTLDR protocol */
|
|
||||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open the protocol, return error */
|
|
||||||
return STATUS_EFI_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Play the tune set in the configuration */
|
|
||||||
BpPlayTune(XtLdrProtocol->Config.GetValue(L"TUNE"));
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return STATUS_EFI_SUCCESS;
|
|
||||||
}
|
}
|
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/beep/globals.c
|
* FILE: xtldr/modules/beep/data.cc
|
||||||
* DESCRIPTION: Beep module global variables
|
* DESCRIPTION: BEEP module global and static data
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtblapi.h>
|
#include <beep.hh>
|
||||||
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
/* XTLDR protocol handler */
|
||||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
PXTBL_LOADER_PROTOCOL Beep::XtLdrProtocol;
|
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/beep/includes/beep.h
|
|
||||||
* DESCRIPTION: XTLDR Beep Module header file
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_BEEP_BEEP_H
|
|
||||||
#define __XTLDR_BEEP_BEEP_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Beep module routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BpDisableToneBeep();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BpEnableToneBeep(IN UINT Pitch);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
BpPlayTune(IN PWCHAR Arguments);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
UINT
|
|
||||||
BpWideStringToNumber(IN PWCHAR String);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
#endif/* __XTLDR_BEEP_BEEP_H */
|
|
32
xtldr/modules/beep/includes/beep.hh
Normal file
32
xtldr/modules/beep/includes/beep.hh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/beep/includes/beep.hh
|
||||||
|
* DESCRIPTION: XTLDR Beep Module header file
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_BEEP_BEEP_HH
|
||||||
|
#define __XTLDR_BEEP_BEEP_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* BEEP module for XTLDR */
|
||||||
|
class Beep
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
STATIC XTCDECL VOID PlayTune(IN PWCHAR Arguments);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTCDECL VOID DisableToneBeep();
|
||||||
|
STATIC XTCDECL VOID EnableToneBeep(IN UINT Pitch);
|
||||||
|
STATIC XTCDECL UINT WideStringToNumber(IN PWCHAR String);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __XTLDR_BEEP_BEEP_HH */
|
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/beep/includes/globals.h
|
|
||||||
* DESCRIPTION: XTLDR Beep Module global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_BEEP_GLOBALS_H
|
|
||||||
#define __XTLDR_BEEP_GLOBALS_H
|
|
||||||
|
|
||||||
#include <beep.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
#endif/* __XTLDR_BEEP_GLOBALS_H */
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_CHAINLDR_SOURCE
|
list(APPEND XTLDR_CHAINLDR_SOURCE
|
||||||
${XTLDR_CHAINLDR_SOURCE_DIR}/chainldr.c
|
${XTLDR_CHAINLDR_SOURCE_DIR}/chainldr.cc
|
||||||
${XTLDR_CHAINLDR_SOURCE_DIR}/globals.c)
|
${XTLDR_CHAINLDR_SOURCE_DIR}/data.cc)
|
||||||
|
|
||||||
# Link module executable
|
# Link module executable
|
||||||
add_executable(chainldr ${XTLDR_CHAINLDR_SOURCE})
|
add_executable(chainldr ${XTLDR_CHAINLDR_SOURCE})
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/chainldr/chainldr.c
|
* FILE: xtldr/modules/chainldr/chainldr.cc
|
||||||
* DESCRIPTION: XTLDR Chain Loader
|
* DESCRIPTION: XTLDR Chain Loader
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <chainldr.h>
|
#include <chainldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/* ChainLoader module information */
|
/* ChainLoader module information */
|
||||||
@@ -15,6 +15,7 @@ MODULE_DESCRIPTION(L"XTLDR Chain Loader");
|
|||||||
MODULE_LICENSE(L"GPLv3");
|
MODULE_LICENSE(L"GPLv3");
|
||||||
MODULE_VERSION(L"0.1");
|
MODULE_VERSION(L"0.1");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chainloads another boot loader.
|
* Chainloads another boot loader.
|
||||||
*
|
*
|
||||||
@@ -27,7 +28,7 @@ MODULE_VERSION(L"0.1");
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
ChainLoader::BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||||
{
|
{
|
||||||
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
|
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
|
||||||
EFI_MEMMAP_DEVICE_PATH MemoryDevicePath[2];
|
EFI_MEMMAP_DEVICE_PATH MemoryDevicePath[2];
|
||||||
@@ -39,7 +40,7 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
|||||||
PVOID LoaderData;
|
PVOID LoaderData;
|
||||||
|
|
||||||
/* Check if image file is provided */
|
/* Check if image file is provided */
|
||||||
if(Parameters->KernelFile == NULL)
|
if(Parameters->KernelFile == NULLPTR)
|
||||||
{
|
{
|
||||||
/* No image filename provided, return error code */
|
/* No image filename provided, return error code */
|
||||||
XtLdrProtocol->Debug.Print(L"ERROR: No EFI image filename provided\n");
|
XtLdrProtocol->Debug.Print(L"ERROR: No EFI image filename provided\n");
|
||||||
@@ -66,14 +67,14 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
|||||||
XtLdrProtocol->Debug.Print(L"ERROR: Unable to open system boot directory (Status Code: 0x%zX)\n", Status);
|
XtLdrProtocol->Debug.Print(L"ERROR: Unable to open system boot directory (Status Code: 0x%zX)\n", Status);
|
||||||
|
|
||||||
/* Close volume and return error code */
|
/* Close volume and return error code */
|
||||||
XtLdrProtocol->Disk.CloseVolume(DiskHandle);
|
XtLdrProtocol->Disk.CloseVolume(&DiskHandle);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read EFI image file from disk and close both directory and EFI volume */
|
/* Read EFI image file from disk and close both directory and EFI volume */
|
||||||
Status = XtLdrProtocol->Disk.ReadFile(BootDir, Parameters->KernelFile, &LoaderData, &LoaderSize);
|
Status = XtLdrProtocol->Disk.ReadFile(BootDir, Parameters->KernelFile, &LoaderData, &LoaderSize);
|
||||||
BootDir->Close(BootDir);
|
BootDir->Close(BootDir);
|
||||||
XtLdrProtocol->Disk.CloseVolume(DiskHandle);
|
XtLdrProtocol->Disk.CloseVolume(&DiskHandle);
|
||||||
|
|
||||||
/* Setup device path for EFI image */
|
/* Setup device path for EFI image */
|
||||||
MemoryDevicePath[0].Header.Length[0] = sizeof(EFI_MEMMAP_DEVICE_PATH);
|
MemoryDevicePath[0].Header.Length[0] = sizeof(EFI_MEMMAP_DEVICE_PATH);
|
||||||
@@ -89,7 +90,7 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
|||||||
MemoryDevicePath[1].Header.SubType = EFI_END_ENTIRE_DP;
|
MemoryDevicePath[1].Header.SubType = EFI_END_ENTIRE_DP;
|
||||||
|
|
||||||
/* Load EFI image */
|
/* Load EFI image */
|
||||||
Status = XtLdrProtocol->Util.LoadEfiImage((PEFI_DEVICE_PATH_PROTOCOL)MemoryDevicePath,
|
Status = XtLdrProtocol->Utils.LoadEfiImage((PEFI_DEVICE_PATH_PROTOCOL)MemoryDevicePath,
|
||||||
LoaderData, LoaderSize, &LoaderHandle);
|
LoaderData, LoaderSize, &LoaderHandle);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -112,7 +113,7 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
|||||||
if(Parameters->Parameters)
|
if(Parameters->Parameters)
|
||||||
{
|
{
|
||||||
/* Pass arguments to chainloaded image */
|
/* Pass arguments to chainloaded image */
|
||||||
LoadedImage->LoadOptionsSize = RtlWideStringLength(Parameters->Parameters, 0) * sizeof(WCHAR);
|
LoadedImage->LoadOptionsSize = XtLdrProtocol->WideString.Length(Parameters->Parameters, 0) * sizeof(WCHAR);
|
||||||
LoadedImage->LoadOptions = Parameters->Parameters;
|
LoadedImage->LoadOptions = Parameters->Parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,46 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
|||||||
LoadedImage->DeviceHandle = DiskHandle;
|
LoadedImage->DeviceHandle = DiskHandle;
|
||||||
|
|
||||||
/* Chainload EFI image */
|
/* Chainload EFI image */
|
||||||
return XtLdrProtocol->Util.StartEfiImage(LoaderHandle);
|
return XtLdrProtocol->Utils.StartEfiImage(LoaderHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes CHAINLDR module by opening XTLDR protocol and installing CHAINLOADER protocol.
|
||||||
|
*
|
||||||
|
* @param ImageHandle
|
||||||
|
* Firmware-allocated handle that identifies the image.
|
||||||
|
*
|
||||||
|
* @param SystemTable
|
||||||
|
* Provides the EFI system table.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
ChainLoader::InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
|
{
|
||||||
|
EFI_GUID Guid = XT_CHAIN_BOOT_PROTOCOL_GUID;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Open the XTLDR protocol */
|
||||||
|
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open the protocol, return error */
|
||||||
|
return STATUS_EFI_PROTOCOL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set routines available via ChainLoader boot protocol */
|
||||||
|
BootProtocol.BootSystem = BootSystem;
|
||||||
|
|
||||||
|
/* Register XTOS boot protocol */
|
||||||
|
XtLdrProtocol->Boot.RegisterProtocol(L"CHAINLOADER", &Guid);
|
||||||
|
|
||||||
|
/* Install XTOS protocol */
|
||||||
|
return XtLdrProtocol->Protocol.Install(&BootProtocol, &Guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,23 +181,6 @@ EFI_STATUS
|
|||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
{
|
{
|
||||||
EFI_GUID Guid = XT_CHAIN_BOOT_PROTOCOL_GUID;
|
/* Initialize CHAINLDR module */
|
||||||
EFI_STATUS Status;
|
return ChainLoader::InitializeModule(ImageHandle, SystemTable);
|
||||||
|
|
||||||
/* Open the XTLDR protocol */
|
|
||||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open the protocol, return error */
|
|
||||||
return STATUS_EFI_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set routines available via ChainLoader boot protocol */
|
|
||||||
ChpBootProtocol.BootSystem = ChBootSystem;
|
|
||||||
|
|
||||||
/* Register XTOS boot protocol */
|
|
||||||
XtLdrProtocol->Boot.RegisterProtocol(L"CHAINLOADER", &Guid);
|
|
||||||
|
|
||||||
/* Install XTOS protocol */
|
|
||||||
return XtLdrProtocol->Protocol.Install(&ChpBootProtocol, &Guid);
|
|
||||||
}
|
}
|
@@ -1,16 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/chainldr/globals.c
|
* FILE: xtldr/modules/chainldr/data.cc
|
||||||
* DESCRIPTION: XTLDR Chain Loader global variables
|
* DESCRIPTION: CHAINLDR module global and static data
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtblapi.h>
|
#include <chainldr.hh>
|
||||||
|
|
||||||
|
|
||||||
/* ChainLoader Boot Protocol */
|
/* ChainLoader Boot Protocol */
|
||||||
XTBL_BOOT_PROTOCOL ChpBootProtocol;
|
XTBL_BOOT_PROTOCOL ChainLoader::BootProtocol;
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
/* XTLDR protocol handler */
|
||||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
PXTBL_LOADER_PROTOCOL ChainLoader::XtLdrProtocol;
|
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/chainldr/includes/chainldr.h
|
|
||||||
* DESCRIPTION: XTLDR Chain Loader header file
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_CHAINLDR_CHAINLDR_H
|
|
||||||
#define __XTLDR_CHAINLDR_CHAINLDR_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* ChainLoader module routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
#endif/* __XTLDR_CHAINLDR_CHAINLDR_H */
|
|
28
xtldr/modules/chainldr/includes/chainldr.hh
Normal file
28
xtldr/modules/chainldr/includes/chainldr.hh
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/chainldr/includes/chainldr.hh
|
||||||
|
* DESCRIPTION: XTLDR Chain Loader header file
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_CHAINLDR_CHAINLDR_HH
|
||||||
|
#define __XTLDR_CHAINLDR_CHAINLDR_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* CHAINLDR module for XTLDR */
|
||||||
|
class ChainLoader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC XTBL_BOOT_PROTOCOL BootProtocol;
|
||||||
|
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __XTLDR_CHAINLDR_CHAINLDR_HH */
|
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/chainldr/includes/globals.h
|
|
||||||
* DESCRIPTION: XTLDR Chain Loader global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_CHAINLDR_GLOBALS_H
|
|
||||||
#define __XTLDR_CHAINLDR_GLOBALS_H
|
|
||||||
|
|
||||||
#include <chainldr.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* ChainLoader Boot Protocol */
|
|
||||||
EXTERN XTBL_BOOT_PROTOCOL ChpBootProtocol;
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
#endif/* __XTLDR_CHAINLDR_GLOBALS_H */
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_DUMMY_SOURCE
|
list(APPEND XTLDR_DUMMY_SOURCE
|
||||||
${XTLDR_DUMMY_SOURCE_DIR}/dummy.c
|
${XTLDR_DUMMY_SOURCE_DIR}/dummy.cc
|
||||||
${XTLDR_DUMMY_SOURCE_DIR}/globals.c)
|
${XTLDR_DUMMY_SOURCE_DIR}/data.cc)
|
||||||
|
|
||||||
# Link module executable
|
# Link module executable
|
||||||
add_executable(dummy ${XTLDR_DUMMY_SOURCE})
|
add_executable(dummy ${XTLDR_DUMMY_SOURCE})
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/dummy/globals.c
|
* FILE: xtldr/modules/dummy/data.cc
|
||||||
* DESCRIPTION: Dummy XTLDR module global variables
|
* DESCRIPTION: Dummy XTLDR module global and static data
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dummy.h>
|
#include <dummy.hh>
|
||||||
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
/* Dummy Boot Protocol handler */
|
/* Dummy Boot Protocol handler */
|
||||||
XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
XTBL_BOOT_PROTOCOL Dummy::DummyProtocol;
|
||||||
|
|
||||||
|
/* XTLDR protocol handler */
|
||||||
|
PXTBL_LOADER_PROTOCOL Dummy::XtLdrProtocol;
|
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtldr/modules/dummy/dummy.c
|
* FILE: xtldr/modules/dummy/dummy.cc
|
||||||
* DESCRIPTION: XTLDR Dummy Module
|
* DESCRIPTION: XTLDR Dummy Module
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dummy.h>
|
#include <dummy.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Dummy module information */
|
/* Dummy module information */
|
||||||
@@ -15,6 +15,7 @@ MODULE_DESCRIPTION(L"XTLDR Dummy Module");
|
|||||||
MODULE_LICENSE(L"GPLv3");
|
MODULE_LICENSE(L"GPLv3");
|
||||||
MODULE_VERSION(L"0.1");
|
MODULE_VERSION(L"0.1");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stub boot routine.
|
* Stub boot routine.
|
||||||
*
|
*
|
||||||
@@ -27,11 +28,50 @@ MODULE_VERSION(L"0.1");
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DmBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
Dummy::BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||||
{
|
{
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes DUMMY module by opening XTLDR protocol and installing DUMMY protocol.
|
||||||
|
*
|
||||||
|
* @param ImageHandle
|
||||||
|
* Firmware-allocated handle that identifies the image.
|
||||||
|
*
|
||||||
|
* @param SystemTable
|
||||||
|
* Provides the EFI system table.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
Dummy::InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
|
{
|
||||||
|
EFI_GUID DummyGuid = XT_DUMMY_BOOT_PROTOCOL_GUID;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
/* Open the XTLDR protocol */
|
||||||
|
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||||
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Failed to open the protocol, return error */
|
||||||
|
return STATUS_EFI_PROTOCOL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set boot protocol routines */
|
||||||
|
DummyProtocol.BootSystem = BootSystem;
|
||||||
|
|
||||||
|
/* Register XTOS boot protocol */
|
||||||
|
XtLdrProtocol->Boot.RegisterProtocol(L"DUMMYOS", &DummyGuid);
|
||||||
|
|
||||||
|
/* Register DUMMY protocol as XTOS boot protocol */
|
||||||
|
return XtLdrProtocol->Protocol.Install(&DummyProtocol, &DummyGuid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine is the entry point of the XT EFI boot loader module.
|
* This routine is the entry point of the XT EFI boot loader module.
|
||||||
*
|
*
|
||||||
@@ -50,23 +90,6 @@ EFI_STATUS
|
|||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||||
{
|
{
|
||||||
EFI_GUID DummyGuid = XT_DUMMY_BOOT_PROTOCOL_GUID;
|
/* Initialize DUMMY module */
|
||||||
EFI_STATUS Status;
|
return Dummy::InitializeModule(ImageHandle, SystemTable);
|
||||||
|
|
||||||
/* Open the XTLDR protocol */
|
|
||||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Failed to open the protocol, return error */
|
|
||||||
return STATUS_EFI_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set boot protocol routines */
|
|
||||||
BlpDummyProtocol.BootSystem = DmBootSystem;
|
|
||||||
|
|
||||||
/* Register XTOS boot protocol */
|
|
||||||
XtLdrProtocol->Boot.RegisterProtocol(L"DUMMYOS", &DummyGuid);
|
|
||||||
|
|
||||||
/* Register DUMMY protocol as XTOS boot protocol */
|
|
||||||
return XtLdrProtocol->Protocol.Install(&BlpDummyProtocol, &DummyGuid);
|
|
||||||
}
|
}
|
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/dummy/includes/dummy.h
|
|
||||||
* DESCRIPTION: XTLDR Dummy Module header file
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_DUMMY_DUMMY_H
|
|
||||||
#define __XTLDR_DUMMY_DUMMY_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Dummy module routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
DmBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
#endif/* __XTLDR_DUMMY_DUMMY_H */
|
|
28
xtldr/modules/dummy/includes/dummy.hh
Normal file
28
xtldr/modules/dummy/includes/dummy.hh
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/dummy/includes/dummy.hh
|
||||||
|
* DESCRIPTION: XTLDR Dummy Module header file
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_DUMMY_DUMMY_HH
|
||||||
|
#define __XTLDR_DUMMY_DUMMY_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* DUMMY module for XTLDR */
|
||||||
|
class Dummy
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC XTBL_BOOT_PROTOCOL DummyProtocol;
|
||||||
|
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC EFI_STATUS BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||||
|
STATIC EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif/* __XTLDR_DUMMY_DUMMY_HH */
|
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/dummy/includes/globals.h
|
|
||||||
* DESCRIPTION: XTLDR Dummy Module global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_DUMMY_GLOBALS_H
|
|
||||||
#define __XTLDR_DUMMY_GLOBALS_H
|
|
||||||
|
|
||||||
#include <dummy.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
/* Dummy Boot Protocol handler */
|
|
||||||
EXTERN XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
|
||||||
|
|
||||||
#endif/* __XTLDR_DUMMY_GLOBALS_H */
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_FRAMEBUF_SOURCE
|
list(APPEND XTLDR_FRAMEBUF_SOURCE
|
||||||
${XTLDR_FRAMEBUF_SOURCE_DIR}/framebuf.c
|
${XTLDR_FRAMEBUF_SOURCE_DIR}/framebuf.cc
|
||||||
${XTLDR_FRAMEBUF_SOURCE_DIR}/globals.c)
|
${XTLDR_FRAMEBUF_SOURCE_DIR}/data.cc)
|
||||||
|
|
||||||
# Link bootloader executable
|
# Link bootloader executable
|
||||||
add_executable(framebuf ${XTLDR_FRAMEBUF_SOURCE})
|
add_executable(framebuf ${XTLDR_FRAMEBUF_SOURCE})
|
||||||
|
19
xtldr/modules/framebuf/data.cc
Normal file
19
xtldr/modules/framebuf/data.cc
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/framebuf/data.cc
|
||||||
|
* DESCRIPTION: EFI framebuffer module global and static data
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <framebuf.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* Framebuffer display information */
|
||||||
|
XTBL_FRAMEBUFFER_INFORMATION FrameBuffer::DisplayInfo;
|
||||||
|
|
||||||
|
/* Framebuffer protocol handler */
|
||||||
|
XTBL_FRAMEBUFFER_PROTOCOL FrameBuffer::FbProtocol;
|
||||||
|
|
||||||
|
/* XTLDR protocol handler */
|
||||||
|
PXTBL_LOADER_PROTOCOL FrameBuffer::XtLdrProtocol;
|
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/framebuf/globals.c
|
|
||||||
* DESCRIPTION: EFI framebuffer module global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <framebuf.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Framebuffer display information */
|
|
||||||
XTBL_FRAMEBUFFER_INFORMATION FbpDisplayInfo;
|
|
||||||
|
|
||||||
/* Framebuffer protocol handler */
|
|
||||||
XTBL_FRAMEBUFFER_PROTOCOL FbpFrameBufferProtocol;
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
@@ -1,64 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/framebuf/includes/framebuf.h
|
|
||||||
* DESCRIPTION: EFI Framebuffer support module header file
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_MODULES_FRAMEBUF_H
|
|
||||||
#define __XTLDR_MODULES_FRAMEBUF_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
#include <globals.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* FrameBuffer support protocol related routines forward references */
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbGetDisplayDriver(OUT PEFI_GRAPHICS_PROTOCOL Protocol);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbGetDisplayInformation(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase,
|
|
||||||
OUT PULONG_PTR FrameBufferSize,
|
|
||||||
OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbGetPreferredScreenResolution(OUT PUINT PreferredWidth,
|
|
||||||
OUT PUINT PreferredHeight);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbInitializeDisplay();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbSetScreenResolution(IN UINT Width,
|
|
||||||
IN UINT Height);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbpFindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
FbpGetColorMask(IN UINT EfiMask,
|
|
||||||
OUT PUSHORT ColorSize,
|
|
||||||
OUT PUSHORT ColorShift);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
FbpGetModeInfo();
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
VOID
|
|
||||||
FbpGetPixelInformation(IN PEFI_PIXEL_BITMASK PixelsBitMask);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
|
||||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
|
||||||
|
|
||||||
#endif /* __XTLDR_MODULES_FRAMEBUF_H */
|
|
44
xtldr/modules/framebuf/includes/framebuf.hh
Normal file
44
xtldr/modules/framebuf/includes/framebuf.hh
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/framebuf/includes/framebuf.hh
|
||||||
|
* DESCRIPTION: EFI Framebuffer support module header file
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTLDR_MODULES_FRAMEBUF_HH
|
||||||
|
#define __XTLDR_MODULES_FRAMEBUF_HH
|
||||||
|
|
||||||
|
#include <xtblapi.h>
|
||||||
|
|
||||||
|
|
||||||
|
class FrameBuffer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
STATIC XTBL_FRAMEBUFFER_INFORMATION DisplayInfo;
|
||||||
|
STATIC XTBL_FRAMEBUFFER_PROTOCOL FbProtocol;
|
||||||
|
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC XTCDECL EFI_STATUS GetDisplayDriver(OUT PEFI_GRAPHICS_PROTOCOL Protocol);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetDisplayInformation(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase,
|
||||||
|
OUT PULONG_PTR FrameBufferSize,
|
||||||
|
OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetPreferredScreenResolution(OUT PUINT PreferredWidth,
|
||||||
|
OUT PUINT PreferredHeight);
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeDisplay();
|
||||||
|
STATIC XTCDECL EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||||
|
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||||
|
STATIC XTCDECL EFI_STATUS SetScreenResolution(IN UINT Width,
|
||||||
|
IN UINT Height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC EFI_STATUS FindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address);
|
||||||
|
STATIC XTCDECL VOID GetColorMask(IN UINT EfiMask,
|
||||||
|
OUT PUSHORT ColorSize,
|
||||||
|
OUT PUSHORT ColorShift);
|
||||||
|
STATIC XTCDECL EFI_STATUS GetModeInformation();
|
||||||
|
STATIC XTCDECL VOID GetPixelInformation(IN PEFI_PIXEL_BITMASK PixelsBitMask);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __XTLDR_MODULES_FRAMEBUF_HH */
|
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* PROJECT: ExectOS
|
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
|
||||||
* FILE: xtldr/modules/framebuf/includes/globals.h
|
|
||||||
* DESCRIPTION: EFI Framebuffer module global variables
|
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XTLDR_MODULES_GLOBALS_H
|
|
||||||
#define __XTLDR_MODULES_GLOBALS_H
|
|
||||||
|
|
||||||
#include <xtblapi.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Framebuffer display information */
|
|
||||||
EXTERN XTBL_FRAMEBUFFER_INFORMATION FbpDisplayInfo;
|
|
||||||
|
|
||||||
/* Framebuffer protocol handler */
|
|
||||||
EXTERN XTBL_FRAMEBUFFER_PROTOCOL FbpFrameBufferProtocol;
|
|
||||||
|
|
||||||
/* XTLDR protocol handler */
|
|
||||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
|
||||||
|
|
||||||
#endif /* __XTLDR_MODULES_GLOBALS_H */
|
|
@@ -8,8 +8,8 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_PECOFF_SOURCE
|
list(APPEND XTLDR_PECOFF_SOURCE
|
||||||
${XTLDR_PECOFF_SOURCE_DIR}/globals.c
|
${XTLDR_PECOFF_SOURCE_DIR}/data.cc
|
||||||
${XTLDR_PECOFF_SOURCE_DIR}/pecoff.c)
|
${XTLDR_PECOFF_SOURCE_DIR}/pecoff.cc)
|
||||||
|
|
||||||
# Link module executable
|
# Link module executable
|
||||||
add_executable(pecoff ${XTLDR_PECOFF_SOURCE})
|
add_executable(pecoff ${XTLDR_PECOFF_SOURCE})
|
||||||
|
16
xtldr/modules/pecoff/data.cc
Normal file
16
xtldr/modules/pecoff/data.cc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtldr/modules/pecoff/globals.cc
|
||||||
|
* DESCRIPTION: Basic PE/COFF executable file format global and static data
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <pecoff.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* XTOS PE/COFF Image Protocol */
|
||||||
|
XTBL_EXECUTABLE_IMAGE_PROTOCOL PeCoff::PeProtocol;
|
||||||
|
|
||||||
|
/* EFI XT Loader Protocol */
|
||||||
|
PXTBL_LOADER_PROTOCOL PeCoff::XtLdrProtocol;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user