Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: ddhill@zk3.dec.com (Dave Hill)
Subject: Re: Alignment on alpha?
Date: 15 Sep 1993 13:29:28 GMT	[thread overview]
Message-ID: <2775bo$52b@utne.zk3.dec.com> (raw)
In-Reply-To: 275gq7INNg9j@zephyr.grace.cri.nz

In article <275gq7INNg9j@zephyr.grace.cri.nz>, chrisp@marc.cri.nz writes:
|> Hi,
|> 	Can someone explain to me how to do long un-aligned accesses without
|> 	generating run-time errors.  
|> 
|> 	And what alignment is necessary on alpha,  byte word long or quad
|> 
|> 				Chris,  Email: chrisp@marc.cri.nz
|> 
|> 				HortResearch Ltd., New Zealand.
|> 
|> "He's dead, Jim. I'll get his tricorder. You take his wallet."


	Structures, pointers, longs (sizeof(x) == 8)
		on a mod 8 boundry
	int (sizeof(int) == 4)
		on a mod 4 boundry
	short (sizeof(short) == 2)
		on a mod 2 boundry
	char (sizeof(cahr) == 1)
		on any boundry

There is a pattern there somewhere :-)

Malloc always returns % 8

Almost all unaligned access errors I have dealt with on the Alpha
platform have been because the wrong thing was passed, for example:

func (long * l)
{
	*l = some_value;
}


main()
{
	int i;
	func(&i);
}

This code can generate an unaligned access, and can produce bad side
affects. For example, the compliler will write 64 bits into the address
that is passed to the function, but you only passed 32 bits worth of 
space, so something is getting squashed.

/Dave


  reply	other threads:[~1993-09-15 13:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-14 21:38 Alignment on alpha? chrisp
1993-09-15 13:29 ` Dave Hill [this message]
1993-09-16 16:07   ` Burkhard Neidecker-Lutz
1993-09-17 12:06   ` Art Stine
read-only archive

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