problem with 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
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

problem with kernel

Post by aztex »

my kernel is loading but is not printing anything..
i am using grub..
Kieran
Member
Member
Posts: 54
Joined: Mon Apr 11, 2005 11:00 pm

Post by Kieran »

Im sorry, but your description provides no clue as to why you are having this problem.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

i wrote a c function to print strings on the screen...
when i booted this kernel in bochs..

it did not print anything..

if i give one print statement the system halts..
if i give more print statement then it restarts..

i have attached the file
Attachments
kmain.c
(1.09 KiB) Downloaded 58 times
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

What does bochs say before it crashes? Is that all code? how do you compile it? have you read the [wiki]Category:FAQ[/wiki] page about strings? 5)...? 6)...? 7)...? X) ...? Z)....? why is cline not set in clear_screen()?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

ya. only one file..
gcc -c -m32 -B /home/vivek/os/kernel -Wall -nostdlib -nostartfiles -nostdinc -std=gnu99 *.c
as --32 startk.s -o startk.so
'ld -m elf_i386 -T linker.ld startk.so *.o -o kernel'

i use these for compilations..

bochs does not crash.. it keeps on restarting...
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

whats in your 'startk.s' file? Try adding a for loop after the kprint call and see what happens.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

this is the main function

void main()
{
while(1);
}

but still it rebooots.
i have attached the floopy image..
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

sorry i could not upload the floopy image..
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

this is the assembly file..
Attachments

[The extension s has been deactivated and can no longer be displayed.]

User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Post by thepowersgang »

including the link.ld file would be useful and in an archive would be better.

I can't see much but putting a

Code: Select all

jmp $
after the "hlt" instruction might help and insert

Code: Select all

for(;;);
at the bottom of kmain.

Try running it with these and see what it does. If that fails use the bochs debugger to find the error.
User avatar
aztex
Member
Member
Posts: 30
Joined: Sun Mar 02, 2008 8:15 am

Post by aztex »

i get undefined reference to _alloca
undefined reference to _main

when i link the files y is it????
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Read the FAQ.

You need a crosscompiler.
Post Reply