unaligned access bug in winspool on sparc

Juan Lang juan_lang at yahoo.com
Mon Oct 25 12:17:24 CDT 2004

--- Eric Frias <efrias at syncad.com> wrote:
> I did some more reading, and found there's a way to
> get the kernel to
> install a handler for unaligned accesses which will
> synthesize the unaligned
> access with two aligned accesses, and then jump back
> to the original point
> in the code.


> It's slow, but you only pay the price if you do an
> unaligned access, where we would currently crash.

This may be the right thing to do, but let me suggest
some alternatives:

There's the TYPE_ALIGNMENT macro in winnt.h.  We could
try and change Wine to properly align strings and
structs and whatnot using this.  I can try to provide
a list of APIs I know about that may have similar
issues as what you reported, though it wouldn't be

As Eric Pouech mentioned before, MSVC supports the
__unaligned attribute, and winnt.h defines UNALIGNED
to __unaligned when using MSVC.  So, on platforms that
require aligned memory access, maybe using the
UNALIGNED macro is the right thing, if in doing so you
could insert the proper asm to emulate unaligned
memory access.

> Do you feel it's reasonable just to turn on
> ST_FIX_ALIGN, which *could* mask
> errors both in wine and in the user's code?

It may indeed.  The masking problems in user code
bothers me, though, since you're using winelib and you
may not have a program which "should work."  If you
have the time and energy to try other approaches, we
might get this right for other platforms too.


Do you Yahoo!?
Declare Yourself - Register online to vote today!

More information about the wine-devel mailing list