From owner-freebsd-hackers Fri Feb 26 10: 2:13 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dingo.cdrom.com (castles169.castles.com [208.214.165.169]) by hub.freebsd.org (Postfix) with ESMTP id 86D6614FA4 for ; Fri, 26 Feb 1999 10:01:13 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id JAA08392; Fri, 26 Feb 1999 09:46:16 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Message-Id: <199902261746.JAA08392@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: "Donn Miller" Cc: hackers@freebsd.org Subject: Re: Accessing the BIOS... In-reply-to: Your message of "Fri, 26 Feb 1999 03:33:18 EST." <000701be6162$b52458e0$02000003@dmm125> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 26 Feb 1999 09:46:16 -0800 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Please format your messages so that they can be replied to. > I need to find out some information about how to write apps that > access the BIOS in FreeBSD. Obviously, since we are dealing with > proteced mode, we can't use INT 10h. My understanding is this (help me > out here if I'm wrong): You don't access the BIOS from applications under FreeBSD. > (*) FreeBSD makes a copy of the Bios image, which is what, 32kB in > length? We need to find a pointer to the start of the Bios image, also > known as the protected mode entry point. It doesn't, it isn't, no you don't, and it's not. > (*) FreeBSD also makes a copy of the first 0x600 bytes of > conventional memory, which may or may not be stored within the already > existing BIOS image. It doesn't. > Obviously, a far pointer is required to access > this if it is outside the range of the 32kB BIOS image. FWIU, DOS uses > address locations 0x000-0x600 for some BIOS services, such as writing to > the VGA display. It does this by passing arguments in the various > registers (such as AX or EAX) and calling INT 10. In 16-bit or 32-bit > protected mode, I don't know which, you can't pass arguments in AX and > call int10. You don't use the BIOS for text output under FreeBSD. > You have to get a pointer to the protected mode entry > point. Again, no you don't. > (*) Does FBSD use 16 or 32 bit protected-mode BIOS calls? If they > are 16-bit, I think you use a selector:offest in the format 16:16. > 32-bit protected-mode calls have a selector:offset format of 16:32. I > know this must involve using some arithmetic with DS or ES registers, > but I'm not sure. The kernel can (and does) make real-mode, 16- and 32-bit protected mode BIOS calls. Applications make none of the above. > (*) When FreeBSD makes a copy of the 32kB of BIOS, does it put it in > the same location every time? Also, I imagine Linux is very similar in > its handling of protected-mode BIOS calls, but it probably puts the > image in a different place, etc. AFAIK, Linux only uses the 32-bit PCI BIOS entrypoints. Neither FreeBSD nor Linux make copies of the BIOS. > It seems like BIOS calls are pretty complicated in protected mode. Why > aren't we allowed to use INT 0x10, and use the registers (AX, etc.) in > protected mode, but real mode allows this? Because interrupts are handled by the OS supervisor, and this is typically not the BIOS. > I know other platforms, such as Macs, Sun SPARCS, and Alpha Stations > don't have an explicit BIOS, but they do have some equivalent, like some > kind of firmware. Is programming the "BIOS" in non-intel platforms as > difficult as programming the BIOS on PC's? It's rarely as badly broken, but typically restricted to bootstrapping only. > I think a good source of info would be Ralph's interrupt list. ;-) I would suggest you forget everything you think you know about programming under DOS, and learn to program under FreeBSD from scratch. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message