Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!darkstar!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Newsgroups: comp.arch Subject: Re: Segmented Architectures ( formerly Re: 48-bit computers) Message-ID: <1991Apr04.230953.15294@kithrup.COM> Date: 4 Apr 91 23:09:53 GMT References: <3310@crdos1.crd.ge.COM> <1991Apr04.023845.3501@kithrup.COM> Organization: Kithrup Enterprises, Ltd. Lines: 53 In article peter@ficc.ferranti.com (Peter da Silva) writes: >If wrapping around the end of the segment isn't a problem, I can't. If it >is, I'll just operate on a >4 GB object. No, you missed the point. I set things up such that no single object can be larger than 4Gbytes. And a correct program can't tell that it has anything larger than a 4Gbyte address space, unless it starts mallocing up all the memory it can and keeps track. On an 8086, the natural limit for the size of any given object is 64K. On the hardware I described, it would be 4G. Now, please show me a correct program that will fail. Answer: you can't, because The Standard (ANSI, in this case, since I'm more concerned about C) has enough limits in it that you can't get around it without being non-conformant. Please read ANSI, and if you can find a statement in there that says that the system must provide for an object >4GB, then I will send you a case of beer. >Of course, if wrapping around the end of the segment isn't a problem (as >it wouldn't be on the 80x86 is intel hadn't screwed up) then I would say you >don't have a segmented machine: you just have a 64-bit machine with a >possibly limited address space... It *is* a segmented machine; you cannot wrap around segments, because the largest size of any single object is 4Gbytes. Now, if you wanted to provide for a pseudo-64-bit address space, you have the system a) allocate segments sequentially, and b) when a segment-overrun trap occurs, increment the segment tag index appropriately, and continue. But it's still a segmented machine. And, again, note that *you* never see the segments. It's possible to set up the machine such that it looks like a normal 32-bit-address machine; however, for correctly programs (correct by ansi, not correct as in specially written), you can use as much memory as the system will allow. >> segment be tag #0, incidently, although there is no real need.) Note that >> you would also probably need a 'long long' type, since I seem to recall ANSI >> C requiring *some* integral type that can hold a pointer. >Nah, just make int=32 bits, long=64 bits. That would be inefficient; too many people use 'long' when they don't need to, because they assume they can use that type to hold an address (which, I guess, would be true, but then they pass int and long around freely). ANSI does require an integral type to hold a pointer, but it does not specify which type. So, either 'long long', or, if you want a fully-ansi-compliant mode, '_longlong'. -- Sean Eric Fagan | "I made the universe, but please don't blame me for it; sef@kithrup.COM | I had a bellyache at the time." -----------------+ -- The Turtle (Stephen King, _It_) Any opinions expressed are my own, and generally unpopular with others.