Page 1 of 1
jumping to a C kernel in Real mode
Posted: Wed Jul 14, 2004 11:00 pm
by Rui
OK,
I have been able to make a boot sector jump to a C kernel im PMode but...
How do I make the jump to a C kernel im Real Mode? How do I init segments
in C?...
Very confusing to me..
( the point is I would like to rely on BIOS for now, instead of having to develop a lot of drivers! )
Thanks!
RE:jumping to a C kernel in Real mode
Posted: Wed Jul 14, 2004 11:00 pm
by Lont
Jumping to a kernel in real mode is much simpeler. Just copy your code to a location (think about the 1MB limit). And jump to it. For example copy to ds:di if ds=0x1000. Jmp 0x1000:LABEL. Think about your c compiler!!!! For as far as I know you have to use 16 bit code in real mode (unless you da an 32-bit prefix... but your compiler has to know this)
RE:jumping to a C kernel in Real mode
Posted: Thu Jul 15, 2004 11:00 pm
by GT
"How do I init segments in C?"
In general, you don't, although it might be possible in some C compilers using non-standard extensions. Standard C has no mechanism for doing this, you generally do stuff like that using either inline assembly or external, linked assembly programs.
RE:jumping to a C kernel in Real mode
Posted: Thu Jul 15, 2004 11:00 pm
by Rui
OK, the problem is:
HOW do I tell the compiler ( GCC or BSD's CC ) to output 16 bit code instead of
32 bit?
Thanks!
RE:jumping to a C kernel in Real mode
Posted: Thu Jul 15, 2004 11:00 pm
by GT
There's an instruction to tell GAS (the GNU Assembler backend) that you're in 16-bit mode, but it won't really output 16-bit code in that case, just 32-bit code with the appropriate prefixes so it can run in 16-bit mode on a 32-bit processor, and I'm not even sure how well it does at that...
You might want to look into BCC instead (B as is Bruce Evans, not Borland, although that might work as well, but it won't be free).
RE:jumping to a C kernel in Real mode
Posted: Sat Jul 31, 2004 11:00 pm
by Another Stupid Coder
I think the Borland C Compiler makes by default 16bit RealMode Code because he ran in Dos. You can download this old versions of Borland-C in a part of
www.borland.com called museum or something like this.
RE:jumping to a C kernel in Real mode
Posted: Mon Aug 02, 2004 11:00 pm
by Rui
Thanks all.