[kernel] Use full protected mode entry when enabling unreal mode #2308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When XMS is enabled, this PR adds by default a full protected mode entry/exit in order to set the segment cache registers, necessary on some 386 systems for XMS memory access for system buffers and the XMS ramdisk in the kernel.
Should a system not boot with XMS enabled, this can be turned off by setting USE_PROTMODE=0 in elks/arch/x86/lib/unreal.S, or by setting xms=off or leaving out any xms= line at all.
The method being used is based on @Mellvik's code, from his research and debugging on real hardware and extensively discussed in Mellvik/TLVC#161 and before that in Mellvik/TLVC#160 (comment).
The documentation of the definition of the Global Descriptor Table has been updated as well, since it was found incorrectly describing the requirement for code versus data segments in the GDT Access Descriptor Byte.