Page 1 of 1

Binary methods

Posted: Wed Oct 23, 2002 11:00 pm
by TheMan
how would i do this?


im using GRUB...

i want to use two files.. an elf that sets protected mode + GDI then load another program (C++) that is the kernel, how would i load that other program from nasm?

RE:Binary methods

Posted: Thu Oct 24, 2002 11:00 pm
by carbonBased
There're way too many variables here; it'll be (or at least _probably_ will be) different for each OS.

GRUB itself, cannot do this, which means your initial "kernel," which GRUB loads, that sets pmode (... erm... GRUB sets pmode itself, you don't have to!) and GDI (? Sounds like an M$ copyright infringement ;) ) will have to load the "secondary" kernel.

No doubt you'll want to load it from a particular file system, and so you're either going to have to write your own FS, or use an existing one, and store that secondary kernel withen the file system.

You initial/first kernel, will not need support for that file system, as well as disk i/o (be it floppy, ide, or scsi, or any combination there of (or something totally different :) ).

Essentially, all you want to do is load in the appropriate sectors, line them up in memory consecutively, and jump to the entry point.

This can be complicated by run-time linking and such included in the ELF format.  You'll probably want to use a basic ELF file... with no dynamic links.  It'll make it much simpler.

Jeff