Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Device Driver over 32K Message-ID: <32784@ucbvax.BERKELEY.EDU> Date: 23 Nov 89 22:29:08 GMT References: <363@ntmtv.UUCP> <4496@netcom.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 27 Here are the problems with a device driver over 32k: 1.) a bug in the original Mac ROMS (circa '84) prevented resources from being larger than 32k. This is fixed in every machine since the the Mac512KE. Does your driver work on ALL macs? 2.) Many compilers use 16 bit signed offsets from the program counter for branches and procedure. This means, if you attempt to call or go to a spot more than 32767 bytes away from the present one, it will crash (if you are lucky. If you are unlucky, it will jump into your hard disk reformat routine.) (You can extend things a little by jumping to carefully placed "islands" of jump instructions, than in turn jump to the destination.) 3.) The format of a device driver includes a preamble with offsets to the entry points for the open, close, control, status & prime (read/write) routines. These offsets are signed 16 bit numbers. and interpreted relative to the beginning of the driver. See note 2 above. 4.) Some linker authors, knowing about the above problems, designed linkers that produce buggy code above 32k, on the silly grounds that nobody would do such a thing anyway. I don't know if MPW is one of these. THINK C just gives you an error message and refuses to link. --- According to the Constitution, the Constitution is unconstitutional: --- David Phillip Oster --U.S.Constitution I.10.1: "No State shall Arpa: oster@dewey.soe.berkeley.edu --enter into any treaty, alliance, or Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu -- confederation..."