Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Q: The perils of 32-bit mode?
@ 1996-11-14  5:00 mischa_sandberg
  1996-11-18  5:00 ` Craig Neth USG
  0 siblings, 1 reply; 2+ messages in thread
From: mischa_sandberg @ 1996-11-14  5:00 UTC (permalink / raw)



I'm in the process of porting a system from 32-bit Unixes to an Alpha
running OSF/1. The code makes many assumptions about LONG and POINTER
types being 32 bits. The first attempt at simply letting the chips
fall where they might in 64-bit mode were pretty dismal.

I've recompiled the system using "cc -c -xtaso_short" and "cc -taso"
to (per the documentation) create a program that uses 32-bit pointers
and is loaded into the 32bit address space. This doesn't solve my
problem with longs, but, one step at a time, right?

The resulting executable displays "anomalous" behaviour off the bat.
The main routine is your standard "int main(int argc, char **argv)",
and when I invoke the program with a  single argument, "argc" is as
expected (2), and argv[0] is the name of the program --- but argv[1]
is always NULL.

This posting amounts to three questions:

(1) What the heck might I doing wrong? A simple "hello, world"
program, predictably, does NOT betray this same weirdness related to
argv[1].

(2) Are there are any hidden gotchas in using -taso/-xtaso_short? What
happens if I need to use a library that was compiled for 64 bits ---
are pointers properly coerced, or am I out of luck?

(3) Should I expect a significant performance hit? This is a
network-traffic-intensive application, not a compute-intensive one.

Many thanks in advance. It sure is fun to play with this sucker; the
Alpha is *fast*.
Engineers believe that the equations approximate reality.
Physicists believe that reality approximates the equations.
Mathematicians never make the connection.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q: The perils of 32-bit mode?
  1996-11-14  5:00 Q: The perils of 32-bit mode? mischa_sandberg
@ 1996-11-18  5:00 ` Craig Neth USG
  0 siblings, 0 replies; 2+ messages in thread
From: Craig Neth USG @ 1996-11-18  5:00 UTC (permalink / raw)
  Cc: mario


mischa_sandberg@mindlink.bc.ca wrote:
> 
> I'm in the process of porting a system from 32-bit Unixes to an Alpha
> running OSF/1. The code makes many assumptions about LONG and POINTER
> types being 32 bits. The first attempt at simply letting the chips
> fall where they might in 64-bit mode were pretty dismal.
> 
> I've recompiled the system using "cc -c -xtaso_short" and "cc -taso"
> to (per the documentation) create a program that uses 32-bit pointers
> and is loaded into the 32bit address space. This doesn't solve my
> problem with longs, but, one step at a time, right?
[... stuff deleted ...]

> This posting amounts to three questions:
> 
> (1) What the heck might I doing wrong? A simple "hello, world"
> program, predictably, does NOT betray this same weirdness related to
> argv[1].

You didn't read all the documentation :-).  The system interfaces
are all 64 bits.   But the system header files are NOT by default set
up to describe this - you need to do something to either fix the
system header files or the application including them.  The -xtaso_short
switch tells the compiler to treat *all* pointers as 32 bits, but that
doesn't work so well for the pointers described in the system header
files...

This is all described in the "Programmer's Guide", but the basic
technique
is to use the #pragma pointer_size pragma to control the sizes of
pointers.

When including system headers, you want something like this:

	#pragma pointer_size save
	#pragma pointer_size long
	#include <stdio.h> /* or whatever */
	#pragma pointer_size restore

The programmers guide has a script that will put that stuff into the
system header files for you if you would rather do it that way.    We're 
planning on making this simpler in a future release but for now that's
all we 
have to offer.

> (2) Are there are any hidden gotchas in using -taso/-xtaso_short? What
> happens if I need to use a library that was compiled for 64 bits ---
> are pointers properly coerced, or am I out of luck?
> 

See above for how to get the interfaces correct.   The -taso linker
switch
causes your program to be linked so that it runs in the 31 bit
addressable
address space so no pointer value will ever be greater than 2^31 - and
the
sign extension rules in the calling standard guarantee that interfaces
that
expect 64 bit pointers will get a valid value.

> (3) Should I expect a significant performance hit? This is a
> network-traffic-intensive application, not a compute-intensive one.

No.  There aren't any conversions going on or 'jackets' or anything like
that.  

Hope this helps.

-- 
--------------------------------------------------------------------------------
Craig Neth                         ! neth@zk3.dec.com
Digital Equipment Corporation      ! 
110 Spit Brook Road ZKO3-3/Y25     !
Nashua, NH 03062                   ! Opinions expressed herein are my
own.
================================================================================



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-11-18  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-11-14  5:00 Q: The perils of 32-bit mode? mischa_sandberg
1996-11-18  5:00 ` Craig Neth USG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox