Unreal Mode: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
m Bot: Replace deprecated source tag with syntaxhighlight |
|||
(14 intermediate revisions by 10 users not shown) | |||
Line 1:
'''Unreal mode'''
==Usage==
Unreal mode is usually recommended in the two following cases
*
*
You still will not have full access to all physical RAM if you do not
==Implementation==
To do this, you need to set the descriptor cache's limits for your segment register(s) to any value higher than 64KiB (usually a full 4GiB (<tt>0xffffffff</tt>)).
In protected mode,
When
===Big Unreal Mode===
Therefore IP is unaffected by all this,
<
; Assembly example
;
; partcopy boot.bin 0 200 -f0
start:
mov ds, ax ; DS=0
mov ss, ax ; stack starts at seg 0
Line 41 ⟶ 42:
or al,1 ; set pmode bit
mov cr0, eax
jmp 0x8:pmode
pmode:
mov
▲ mov ds, bx ; 8h = 1000b
and al,0xFE ; back to realmode
mov cr0, eax ; by toggling bit again
jmp 0x0:unreal
unreal:
pop ds ; get back old segment
sti
Line 63 ⟶ 66:
dd gdt ;start of table
gdt
flatdesc: db 0xff, 0xff, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:
times 510-($-$$) db 0 ; fill sector w/ 0's
</syntaxhighlight>
===Huge Unreal Mode===
Huge Unreal Mode enables code over
<
; Assembly example
;
; partcopy boot.bin 0 200 -f0
start: xor ax, ax ; make it zero
Line 110 ⟶ 113:
times 510-($-$$) db 0 ; fill sector w/ 0's
</syntaxhighlight>
WARNING: this may not work on some emulators or some hardware
==Compiler Support==
Line 125 ⟶ 127:
You can try out unreal mode in DOS (e.g. in DOSBox, VirtualBox + FreeDOS) as the compiler fully supports the DOS + unreal mode combo in its C library. ''tests/vesalfb.c'' is a simple example of setting up a [[VESA]] graphics mode with the linear frame buffer enabled and drawing something on the screen in unreal mode.
For an example of an Unreal Mode [[bootloader]] implementation with Smaller C, look at [https://github.com/fysnet/FYSOS/tree/master/loader FYSOS].
[[Category:X86 CPU]]
[[Category:Operating Modes]]
[[Category:FAQ]]
|