stay like hang my kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nil

stay like hang my kernel

Post by nil »

hello everybody,
i had big problem which solve by pype.clicker , but
still new two problem arises
1) when i declare variable which write to video memory
it work within function but when i declare global it
dont display me which i print..
2) when i add function in kernel.c which it take 2 functions
properly but when i add third any function it give linking time
error... text header section not fit

in link script my virtual mem is 3GB and physical mem is 1mb
i am trying to wrap aroung the kernel so it start from 1mb




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 - 0xC0000000 + 0x100000]
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 - 0xC0000000 + 0x100000
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:

:-\
please help me
waiting for reply

from
nil
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:stay like hang my kernel

Post by Pype.Clicker »

that sounds like a missing .data or .rodata* section in a linker script...
Did you also check GRUB had the proper information about your entry point ? adding functions may interfere with what is executed first if proper care isn't taken
mystran

Re:stay like hang my kernel

Post by mystran »

This is OT but: are these polls supposed to be some kind of "guess what's wrong"-competition or what? Please, let's only have polls for questions where there's room for opinions.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:stay like hang my kernel

Post by Pype.Clicker »

mystran wrote: This is OT but: are these polls supposed to be some kind of "guess what's wrong"-competition or what? Please, let's only have polls for questions where there's room for opinions.
I second that and i'll lock the poll since its options are fuzzy anyway ...

Btw, nil, you just provide us your bootstrap and talk us about your video memory and stuff ... how are we supposed to find any problem with so little information ...

Some questions you should ask yourself :
- does my kernel starts executing where it should ? As you cannot write to video memory, i suggest you make some beep occur or change the palette mapping (as those are done with only in/out instructions, you can easily use them whatever your memory state is)

- is my kernel able to access memory as it should ? if you have a "magic" variable whose value is defaulted to 0xcafebabe, what does

Code: Select all

    cmp dword [magic],0xcafebabe
result ? beep&hang if not equal.

- is my kernel image complete ? use a tool like objdump or an hex viewer and check everything is on the file you boot (messages, functions, headers ...)

- have i read "barebones" on the FAQ (hint: click the MegaTokyo banner up here)

- is the video access problem a C thing or a general thing. I.e, can i see something when

Code: Select all

    mov [0xb8000],' ) :'
is written in my ASM bootstrap ?
Post Reply