projects
/
efitest3
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2117a11
)
switched to 16bit mode, but int 10h hangs
author
John Tsiombikas
<nuclear@member.fsf.org>
Mon, 4 Jul 2022 18:33:58 +0000
(21:33 +0300)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Mon, 4 Jul 2022 18:33:58 +0000
(21:33 +0300)
efitest.asm
patch
|
blob
|
history
diff --git
a/efitest.asm
b/efitest.asm
index
bae6aa2
..
ae804dd
100644
(file)
--- a/
efitest.asm
+++ b/
efitest.asm
@@
-116,7
+116,7
@@
mmapbuf: times 4096 db 0
str_hello db 'hello!',13,10,0
align 4
str_hello db 'hello!',13,10,0
align 4
-gdtlim dw 23
+gdtlim dw 31
gdtbase dq gdt
align 8
gdtbase dq gdt
align 8
@@
-128,7
+128,9
@@
gdt: ; 0: null segment
; 2: data - base:0, lim:4g, G:4k, 32bit, avl, pres|app, dpl:0, type:data/rw
dd 0x0000ffff
dd 0x00cf9200
; 2: data - base:0, lim:4g, G:4k, 32bit, avl, pres|app, dpl:0, type:data/rw
dd 0x0000ffff
dd 0x00cf9200
-
+ ; 3: code16
+ dd 0x0000ffff
+ dd 0x00009a00
bits 32
start32:
bits 32
start32:
@@
-151,13
+153,8
@@
start32:
and eax, 0fffffeffh
wrmsr
and eax, 0fffffeffh
wrmsr
- mov edi, 0a0000h
- mov ecx, 16000
- mov eax, 00ff0000h
- rep stosd
-
- mov esi, str_hello
- call ser_putstr
+ ; load 16bit code segment and jump to 16bit code
+ jmp 0x18:start16
.hang: hlt
jmp .hang
.hang: hlt
jmp .hang
@@
-186,4
+183,44
@@
ser_putstr:
align 4
align 4
+ ; real mode IDTR pseudo-descriptor pointing to the IVT at addr 0
+ dw 0
+rmidt: dw 3ffh
+ dd 0
+
+ bits 16
+start16:
+ ; disable protection
+ mov eax, cr0
+ and eax, 0fffffffeh
+ mov cr0, eax
+ ; load cs <- 0
+ jmp 0:.loadcs0
+.loadcs0:
+ ; zero data segments
+ xor ax, ax
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ ; move stack to the top of 640k
+ mov ax, 9000h
+ mov ss, ax
+ xor sp, sp
+
+ ; run 16bit video bios test
+ mov ax, 13h
+ ;int 10h
+
+ mov ax, 0a000h
+ mov es, ax
+ xor di, di
+ mov cx, 32000
+ mov ax, 6767h
+ rep stosw
+
+.hang: hlt
+ jmp .hang
+
+ align 4
end:
end: