Hi, i relocate my kernel to 16mb mark by copying it directly, byte by byte, then jump to the relocation. I know this works, but, i think my variables are getting left behind. Meaning, when a lea or store anything in them, the data is referencing back at a 1mb odd location. I know this because i relocate and lea my gdt variable, 64kb of storage for the GDT, and i get a 1mb odd value. Is it possible for this to happen?, the variables get left behind. And if so, how can i fix it?
Thanks, Brill.
Kernel Relocation
RE:Kernel Relocation
When compiling your kernel, you should "tell" the compiler that the image
should start at 16mb boundary.
Anton.
should start at 16mb boundary.
Anton.
RE:Kernel Relocation
That will only work if you don't use any variables before the copy, though, and perform no jumps or function calls before-hand, as well.
If you're using grub, and I know you are, why not just tell GRUB to load at the 16MB mark right off the bat? Just change your multiboot header, and ld script (or compiler command line).
If you _must_ copy the code, withen the code, then it's best to write the copy routines and the kernel itself as separate programs, and concatenate them together. In other words, use a stub... but this will cause problems with GRUB... it'll only load the stub, unless you use the a.out kludge. You'd be best to just alter your mb header.
Jeff
If you're using grub, and I know you are, why not just tell GRUB to load at the 16MB mark right off the bat? Just change your multiboot header, and ld script (or compiler command line).
If you _must_ copy the code, withen the code, then it's best to write the copy routines and the kernel itself as separate programs, and concatenate them together. In other words, use a stub... but this will cause problems with GRUB... it'll only load the stub, unless you use the a.out kludge. You'd be best to just alter your mb header.
Jeff