interrupts toggling from 32-bit protected mode
Posted: Thu Mar 20, 2003 12:00 am
I'm having a little trouble using the 'sti' mnemonic to flip on interrupts. It causes the machine to reboot as soon as it hits that instruction. I'm pretty sure the problem is that I'm calling it from within a 32-bit protected mode app (in NASM).
The bottom line is that I want to simply place a pixel on the screen in the vga-mode of my choosing. So far, the only examples I've found show how to get the video mode setup in 16-bit bootloader code and then once the 32-bit protected mode code is called, IT writes to the video memory. I use GRUB to boot the machine and it immediately launches my little minikernel (successfully), but by that time, I'm already in 32-bit protected mode.
See the problem?
What's the solution?
here's the code:
----------------------------
%define MBOOT_MAGIC 0x1badb002
%define MBOOT_FLAGS 0x00010002
bits 32
org 0x100000
__entry_point:
sti ; THIS IS THE LINE THAT CAUSES THE MACHINE TO REBOOT
mov ah, 0
mov al, 13h
int 10h
mov [0xA0000], byte 5 ; HERE'S WHERE I WOULD DRAW A PIXEL
;
jmp short $
align 4, db 0
header:
dd MBOOT_MAGIC
dd MBOOT_FLAGS
dd 0 - MBOOT_MAGIC - MBOOT_FLAGS
dd header
dd __entry_point
dd end_of_file
dd end_of_file
dd __entry_point
align 4, db 0
end_of_file:
----------------------------
Thanks.
- Philip
The bottom line is that I want to simply place a pixel on the screen in the vga-mode of my choosing. So far, the only examples I've found show how to get the video mode setup in 16-bit bootloader code and then once the 32-bit protected mode code is called, IT writes to the video memory. I use GRUB to boot the machine and it immediately launches my little minikernel (successfully), but by that time, I'm already in 32-bit protected mode.
See the problem?
What's the solution?
here's the code:
----------------------------
%define MBOOT_MAGIC 0x1badb002
%define MBOOT_FLAGS 0x00010002
bits 32
org 0x100000
__entry_point:
sti ; THIS IS THE LINE THAT CAUSES THE MACHINE TO REBOOT
mov ah, 0
mov al, 13h
int 10h
mov [0xA0000], byte 5 ; HERE'S WHERE I WOULD DRAW A PIXEL
;
jmp short $
align 4, db 0
header:
dd MBOOT_MAGIC
dd MBOOT_FLAGS
dd 0 - MBOOT_MAGIC - MBOOT_FLAGS
dd header
dd __entry_point
dd end_of_file
dd end_of_file
dd __entry_point
align 4, db 0
end_of_file:
----------------------------
Thanks.
- Philip