X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: djgpp for kernel dev. Date: Fri, 3 Mar 2006 17:54:57 -0500 Organization: Info Avenue Internet Services, LLC Lines: 43 Message-ID: References: <4404EB6F DOT D050DB39 AT compuserve DOT de> <200603011425 DOT k21EPHCE005449 AT envy DOT delorie DOT com> <4408940f$0$488$cc7c7865 AT news DOT luth DOT se> NNTP-Posting-Host: c-68-60-59-250.hsd1.mi.comcast.net X-Trace: news3.infoave.net 1141426506 104747 68.60.59.250 (3 Mar 2006 22:55:06 GMT) X-Complaints-To: abuse AT infoave DOT net NNTP-Posting-Date: Fri, 3 Mar 2006 22:55:06 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Martin Str|mberg" wrote in message news:4408940f$0$488$cc7c7865 AT news DOT luth DOT se... > Rod Pemberton 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