Screen flashes after interrupts are activated
Posted: Wed Nov 27, 2019 5:50 pm
The Place to Start for Operating System Developers
http://f.osdev.org/
Code: Select all
bits 32
%define MULTIBOOT_MAGIC 0x1BADB002
%define MULTIBOOT_FLAGS (1<<0 | 1<<1 | 1<<2)
section .text
align 4
multiboot_header:
dd MULTIBOOT_MAGIC
dd MULTIBOOT_FLAGS
dd -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS)
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 800 ; width
dd 600 ; height
dd 32 ; bbp
global start
extern kmain
start:
cli
mov esp, stack_space
push ebx
push eax
jmp load_gdt
;global descriptor table
gdt:
gdt_null:
dq 0
gdt_code:
dw 0FFFFh
dw 0
db 0
db 10011010b
db 11001111b
db 0
gdt_data:
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_end:
gdt_desc:
dw gdt_end - gdt - 1
dd gdt
;load gdt
load_gdt:
lgdt [gdt_desc] ;load GDT
call kmain
hlt
section .bss
resb 8192
stack_space:
Thanks for your help. I just did not know how to use the code from the tutorial.Klakap wrote:You can implement GDT table code from Interrupt tutorial to your code with:
Hello again.Klakap wrote:You can implement GDT table code from Interrupt tutorial to your code with...
Code: Select all
load_gdt:
lgdt [gdt_desc] ;load GDT
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:.setcs
.setcs:
Code: Select all
lgdt [gdt_desc]
jmp 0x0008:fix_cs
fix_cs:
mov ax, 0x0010
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esp, stack_space ;set stack pointer to your point
call kmain