Help to get my bootloader to load 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
TheVillageIdiot

Help to get my bootloader to load my kernel??

Post by TheVillageIdiot »

[attachment deleted by admin]
TheVillageIdiot

Re:Help to get my bootloader to load my kernel??

Post by TheVillageIdiot »

Hail again,

OK i know its only been 2 hours, but it feels like bloody ages. hehehe.

I've made some changes:

In the file MakeKernel.bat the line that reads:
ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel.o kernel_c.o

Has been changed to:
ld -Ttext 0x00001000 --oformat binary -o kernel.bin kernel.o kernel_c.o

That's to tell my compiler where to expect the kernel to be. Since i was asking my bootloader to load it at 0x1000 then i must tell my kernel compiler the same. :P:P

Anyways, i'm gonna keep at it. Talk to yous later i suppose. :):)

Regards,

----------------------
TheVillageIdiot
Tom

Re:Help to get my bootloader to load my kernel??

Post by Tom »

Well, try testing the code without Bochs.
TheVillageIdiot

Re:Help to get my bootloader to load my kernel??

Post by TheVillageIdiot »

Hey,

Thanks for your post Tom. :)
I tried it, and it still ain't working. There's got to be some little thing wrong that i just can't see. :(

Oh well.....Into the breach dear friends.....

----------------------
TheVillageIdiot
TheVillageIdiot

Re:Help to get my bootloader to load my kernel??

Post by TheVillageIdiot »

Hey again,

Hmmm......still no luck. :)

Anyways its 2am so i'm going to bed. I'll sleep on it and see how i go tommorrow.

Regards,

----------------------
TheVillageIdiot
.bdjames

Re:Help to get my bootloader to load my kernel??

Post by .bdjames »

1) You are not compiling your kernel
2) You are not linking to your kernel

NASM -o stub.o -f coff kernel.asm
GCC -O2 -fomit-frame-pointer -c -o kernel.o kernel_c.c
ld --oformat=binary --entry=start --Ttext=0x1000 --output kernel.bin stub.o kernel.o

I suggest using gas and makefiles for your kernel:

.code32
.global start

start: jmp _c_main
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:Help to get my bootloader to load my kernel??

Post by Pype.Clicker »

using gas ?? gasp!
Whatever5k

Re:Help to get my bootloader to load my kernel??

Post by Whatever5k »

I wouldn't use GAS either...the syntax is so complicated...
Rather use Nasm
grey wolf

Re:Help to get my bootloader to load my kernel??

Post by grey wolf »

i can use the more familiar syntax if you add this line to the top of your .S files:

.intel_suntax no_prefix

then no more % before the register name, and no more source before destination. nice, clean Intel Syntax.

(BTW, GAS's syntax is called AT&T syntax)
.bdjames

Re:Help to get my bootloader to load my kernel??

Post by .bdjames »

I did not like gcc/gas until I read about extended inline
assembly. It is so much better than any other combination.

Yes AT&T is ugly and gas is buggy, but I like keeping it
simple:one assembler, one compiler, one linker.
dronkit

Re:Help to get my bootloader to load my kernel??

Post by dronkit »

it makes more sense to me to write:

Code: Select all

movl $0xF, %eax 
to load 0xFh in eax than

Code: Select all

mov eax, 0Fh
and why is gas buggy?

I think this is all a matter of personal taste. Like using masm or tasm or a86 or whatever.

(but if you use gas you can use gdb easier) ;)
.bdjames

Re:Help to get my bootloader to load my kernel??

Post by .bdjames »

Try using unreal mode in gas
dronkit

Re:Help to get my bootloader to load my kernel??

Post by dronkit »

that's because gas was not intended to be used to write 16 bits applications...
svempa

Re:Help to get my bootloader to load my kernel??

Post by svempa »

When you are setting up your stack.

....................................
cli
mov ax,0x9000
mov ss,ax
mov sp,0xFFFF
;<--- sti is missing right? So that you can print the message through int 10h
mov si, BootMsg
call PrintStr
....................................
Tom

Re:Help to get my bootloader to load my kernel??

Post by Tom »

why did you bring up such a old message?
Post Reply