I want to go back to RM, then change graphics mode, and then go to PM and execute kernel.
Setting PM bit to zero and STI doesn't do.
Thanks.
Code: Select all
MBOOT_PAGE_ALIGN equ 1<<0
MBOOT_MEM_INFO equ 1<<1
MBOOT_VIDINFO equ 1 << 2 ;;; DOESN'T WORK IN QEMU
MBOOT_HEADER_MAGIC equ 0x1BADB002 ; Multiboot Magic value
MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO
MBOOT_CHECKSUM equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
[BITS 32]
[GLOBAL mboot]
[EXTERN code] ; Start of the '.text' section.
[EXTERN bss] ; Start of the .bss section.
[EXTERN end] ; End of the last loadable section.
mboot:
dd MBOOT_HEADER_MAGIC
dd MBOOT_HEADER_FLAGS
dd MBOOT_CHECKSUM
dd mboot ; Location of this descriptor
dd code ; Start of kernel '.text' (code) section.
dd bss ; End of kernel '.data' section.
dd end ; End of kernel.
dd start ; Kernel entry point (initial EIP).
; dd 0 ; # 0 = set graphics mode
; dd 1024
; dd 768
; dd 32
; ^ ^ ^ Don't work in Qemu
[GLOBAL start] ; Kernel entry point.
[EXTERN main] ; This is the entry point of our C code
start:
mov eax, cr0
and eax,-0x2
mov cr0,eax ; disable PM
[bits 16]
;; Interrupts already enabled by grub?
mov ah,0
mov al,4 ; 320x200x(4 color)
int 0x10 ; gets crashed
[bits 32]
; push esp - stack ptr
; push ebx - mboot ptr
; Execute the kernel:
; cli
; call main ; not yet, still in 16 bit real mode
jmp $