can anyone this grub problem
Posted: Fri Feb 20, 2004 4:46 am
hello,
i am beginner and i am trying to write kernel and i wrote a kernel which print hell but when i add gdt for it restart my comp i used grub loader, but i cant solve this problem from couple of week please help me, i so frustate from this problem i link 3 files asm,c and ld and make elf file i send my code with this, if any info want i ready to send thnx,
nil
[[email protected]] : :-[
i am beginner and i am trying to write kernel and i wrote a kernel which print hell but when i add gdt for it restart my comp i used grub loader, but i cant solve this problem from couple of week please help me, i so frustate from this problem i link 3 files asm,c and ld and make elf file i send my code with this, if any info want i ready to send thnx,
nil
[[email protected]] : :-[
Code: Select all
bits 32
extern main
global start
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
align 4
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd CHECKSUM
start :
lgdt [gdt_desc]
jmp gdt_code:hi_jump
hi_jump :
mov eax, gdt_data
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
mov ss, eax
call main
jmp $
gdt_desc :
GDTSIZE dw gdt_end - gdt - 1
GDTBASE dd gdt
gdt :
gdt_null EQU $ - gdt
dd 0
dd 0
gdt_code EQU $ - gdt
dw 0FFFFh
dw 0
db 0
db 10011010b
db 11001111b
db 0
gdt_data EQU $ - gdt
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_end: