Loading 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
prajwal
Member
Member
Posts: 154
Joined: Sat Oct 23, 2004 11:00 pm
Contact:

Loading Kernel

Post by prajwal »

Hello everyone,

I load the kernel from floppy at boot time at some address
(say 0x8000). Everything goes fine for this implementation.

But I decided to Move the Loaded kernel to 1M.

So after boot, I entered Protected Mode with a Dummy GDT and Moved the loaded kernel code from floppy at 0x8000 to 0x100000 using REP MOVSB. and before switching, I loaded Final GDT with proper Base and Limit.

It went fine...... BUT :( some part of code doesn't
work properly,... like.... if control enters those parts of code, then the system Hangs/ Prints some Junk on Screen and Hangs/ Are crahses.....

The Behaviour varies with the size of kernel when i compile it.....

BUT BUT.... I tried Loading (Moving) at address 0x100300 or Above (say
0x108000)..... Everything Went Fine......

Can some one give suggesstions regarding this problem please....

NOTE:- 1) Don't Move Kernel after Load..... FINE
2) Load at ADDRESS 0x100000..... PROBLEM
3) Load at ADDRESS 0x100300 and ABOVE(tried upto 0x200000).... FINE.


I'm working on SUSE Linux OS.
GCC compiler. Plan Binary Format Kernel....
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: Loading Kernel

Post by blackcatcoder »

do you set up the a20 line correct ?
User avatar
prajwal
Member
Member
Posts: 154
Joined: Sat Oct 23, 2004 11:00 pm
Contact:

Re: Loading Kernel

Post by prajwal »

Yes.... There was a problem in the A20 Enable Code.....

Instead of sending 0xD1 to port 0x64, it was 0xDD.....

Thanks a lot to u......


At run time address 0x100 to 0x300 were used by DMA..... So
When kernel was loaded at 1MB it was actually wrapping up the address
and some Code at 0x100 - 0x300 was getting corrupted due to DMA
operation and hence the problem....
Know its solved.....
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: Loading Kernel

Post by blackcatcoder »

no prob, i had the same prob 3 years ago when i started, have a lot of fun ;-)
Post Reply