Mail Archives: djgpp/2006/03/03/18:00:53
"Martin Str|mberg" <ams AT speedy DOT ludd DOT ltu DOT se> wrote in message
news:4408940f$0$488$cc7c7865 AT news DOT luth DOT se...
> Rod Pemberton <do_not_have AT sorry DOT bitbucket DOT cmm> wrote:
> > No. But, there is a way around it. I'm not going to post the code for
my
> > OS, but I'll explain to you the method for DJGPP to bypass this.
>
> > When you call exit() in your program, int 0x21, ah=4c "DPMI Unload" is
> > called in PM. Then the DPMI host cleans up memory and returns to RM.
When
> > in RM, int 0x21, ah=4c "DOS Exit" is called by DOS to clean up after
your
> > program exits.
>
> Why, oh why, should he even enter DJGPP PM?
> Yes, so why bother to let DJGPP startup and shutdown stuff run?
For DJGPP _only_, the methods you and Chris suggested are simpler in
appearance (I'll get to this).
However, to write an OS in C which compiles with multiple compilers,
one would need to write multiple RM to PM startup routines, multiple linker
scripts, etc., etc. Although I only listed the exact way to do things for
DJGPP, the basic method will work for any DOS C compiler that uses a DPMI
host and/or DOS extender. My in-progess OS (working on the HD routines)
compiles with both DJGPP and OW, I should be able to compile it with other
PM DOS compilers such as DiceRT etc. This compiler independent technique is
an advantage: only a few lines of assembly and C can support multiple
compilers.
Also with this technique, development of the OS can start without
programming PITs, PICs, etc because RM DOS set them up "in an acceptable
way" for you. I don't believe that is the case with a standard bootloader
like GRUB. As soon as your OS starts, you'll have to do those things and
much more correctly and immediately. There is no room to play and develop
as you go.
Rod Pemberton
- Raw text -