From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: far pointers again Date: Tue, 05 Oct 1999 19:21:39 -0700 Organization: Harvey Mudd College Lines: 52 Message-ID: <37FAB233.7C879A3D@hmc.edu> References: NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: nntp1.interworld.net 939176543 17270 134.173.45.219 (6 Oct 1999 02:22:23 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 6 Oct 1999 02:22:23 GMT X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > As I understand, > > gcc is ported from unix and it will work under various unix variants like > > linux. I was told that under linux, one can create other descriptors in the > > ldt and reference to them by using far pointers (of course). This is true, but it's very very rarely used. Under DJGPP the main use is talking to DOS or hardware, and on Unix the kernel uses a flat address space and provides an abstraction layer to hardware. (Or in some cases a raw version using mmap, but that avoids far pointers also.) About the only programs that use the LDT stuff are emulators like dosemu and wine. The kernel in past versions used multiple segments and could have used farptr support, but that's now changed. Farptr support is of very little value in Unix, so I don't see this as a strong argument for it to be added to GCC. > > If this is all > > true, I would say that gcc should support far pointers to easily reference > > to these segments. > > I'd guess that you'd need to do the same on Linux. In other words, you > cannot have a true 48-bit far pointer in Linux, unless you do it in > assembly. > > Can someone who has easy access to Linux check that? Yes, it's true. AFAIK GCC has no support whatever for far pointers. The kernel used to use intersegment accesses (they used wrapper functions just like DJGPP's), but that has also changed, so the kernel sees a flat address space as well. > > Right now, I have to use temporary variables to store the > > information when I decide to, say, use printf to display a number which is > > stored in another segment. When I want to print a string part stored in > > another segment I should design a printf which handles far pointers or copy > > the string to the ds segment? I don't know exactly what to do > > Use movedata to fetch the string into a normal buffer, then print it as > usual. I wrote a library with farptr versions of most of the mem*/str* functions. I haven't looked at it for a while but it should work. You can get it from: http://www.cartsys.com/eldredge/n/djgpp/farstr.zip -- Nate Eldredge neldredge AT hmc DOT edu