this the asm code that i've tried to switch to a vesa mode:
Code: Select all
mov ax, 0x4F02 - mov bx, 0x11B - int 10h
That's all the question. Thanks!
Code: Select all
mov ax, 0x4F02 - mov bx, 0x11B - int 10h
Code: Select all
BITS 32
section .text
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
global start
extern main ; kernel function
start:
cli
call main
hlt
To execute BIOS functions (including VBE) while your kernel is normally running in protected mode (or long mode) there's 4 options:alberinfo wrote:thanks, but i don't understand how to set it in grub. anyway my question was how to call a bios interrupt, not how to set vesa mode... if the problem is that i'm in 32-bit protected mode, then i have to switch to real mode with my kernel...that's out my brain jaja
alberinfo wrote:thanks, but i don't understand how to set it in grub.
You currently have 3 fields in your multiboot header:SpyderTL wrote:Just add some additional fields to your "Multiboot Header" that contain the desired video resolution, and GRUB will handle it for you.
Code: Select all
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
My solution would be to set the IDT limit to zero immediately after your protected mode code is started (by GRUB); so that it's easier to catch bugs when someone tries to use software interrupts designed for real mode while they're in protected mode (where those "designed for real mode" interrupts can't work properly at all).alberinfo wrote:i included it, in the instant that grub charges the bootloader, it comes back to grub.it think it's cause the iret function wich don't allows to call the kernel main function.
Any solution?
Code: Select all
BITS 32
section .text
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
global start
extern main
start:
cli
lidt [idt_info]
smsw ax
and eax, 1
je callmain
mov ebp, esp
push dword [ebp+4]
push dword [ebp+8]
pushfs
or dword [esp], (1 << 17)
push dword [ebp+12]
push dword [ebp+16]
iret
callmain:
call main
hlt
section .text
idt_info:
idt_start dw 0
idt_end dw idt_start - 1
Code: Select all
idt_start dd 0
idt_end dd idt_start - 1
Code: Select all
dw idt_end - idt_start - 1
dd idt_start