Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: amd on Linux/Alpha Redhat 4.1
@ 1997-02-27  5:02 Stephen Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Williams @ 1997-02-27  5:02 UTC (permalink / raw)


ewt@redhat.com said:
> How can I reproduce the problem this causes? 

I'm not entirely sure I know what you are asking. The sign extension
I mention causes amd to get stuck in an infinite loop. I tracked the
problem down by recompiling amd with -g, then running ``amd -v'' under
gdb. I stopped the process (which was clearly in an infinite loop) and
looked at the stack, and tracked it back from there.

The problem actually occurs in the while() loop a few lines below, where
the subnet variable is used as a mask to check for equal subnets.

The code involved here is not invoked unless there is a network interface
other then the loopback interface. amd would not hang if my ethX interfaces
were ifconfig off.

htonl is doing the sign extension. This is a problem with the glibc included
with redhat 4.1, not the glibc with 4.0. Thus, amd breaks under 4.1 and not
4.0.

I cannot really say for sure whether the problem is glibc for sign extending
or amd for not masking the result to 32 bits. It is not clear what the
proper behavior for htonl is, here. My fix simply accounts for the observed
behavior of glibc.

On Wed, 19 Feb 1997, Stephen Williams wrote:

> 
> OK, this definitely fixes AMD on the alpha, at least for now. The required
> change is so tiny that I'll just tell you what it is. ...
> 
> change line 418 of amd/wire.c from
> 
> 		subnet = htonl(subnet); 
> 
> to read like this:
> 
> 		subnet = ntohl(subnet) & 0xffffffffUL; 
> 
> Done. (Oh yes, change axp to alpha in the spec file, too.)
> 
> Somebody is sign-extending the swapped word to fill 64bits. This
> breaks a while loop a few statements lower. Ugh. I don't know if
> there is a clear word at to whether ntohl and friends are supposed to
> treat the values as signed or unsigned, but the above mask will work
> no matter what the final ruling is, and gets AMD working for those
> who would rather get on with it.

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: amd on Linux/Alpha Redhat 4.1
@ 1997-02-19 23:05 Stephen Williams
  1997-02-26 22:26 ` Erik Troan
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Williams @ 1997-02-19 23:05 UTC (permalink / raw)


OK, this definitely fixes AMD on the alpha, at least for now. The required
change is so tiny that I'll just tell you what it is. ...

change line 418 of amd/wire.c from

		subnet = htonl(subnet); 

to read like this:

		subnet = ntohl(subnet) & 0xffffffffUL; 

Done. (Oh yes, change axp to alpha in the spec file, too.)

Somebody is sign-extending the swapped word to fill 64bits. This
breaks a while loop a few statements lower. Ugh. I don't know if
there is a clear word at to whether ntohl and friends are supposed to
treat the values as signed or unsigned, but the above mask will work
no matter what the final ruling is, and gets AMD working for those
who would rather get on with it.

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

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

end of thread, other threads:[~1997-02-27  5:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-27  5:02 amd on Linux/Alpha Redhat 4.1 Stephen Williams
  -- strict thread matches above, loose matches on Subject: below --
1997-02-19 23:05 Stephen Williams
1997-02-26 22:26 ` Erik Troan

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