* unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why?
@ 2000-01-05 5:00 Aurel Balmosan
2000-01-05 5:00 ` Joe Mario
2000-01-06 5:00 ` Jeff Sullivan
0 siblings, 2 replies; 3+ messages in thread
From: Aurel Balmosan @ 2000-01-05 5:00 UTC (permalink / raw)
Hi,
We noticed those warning messages the first time in 4.0d. There it was
obvious. Now in 4.0e it is not obvious anymore. What we do frequently is
following:
We have a large buffer.
We define a structure. The structure is filled with some data and an
extended byte string.
We put the next structure exactly behind the last byte of the byte
string. So this structure might
or might not be aligned anymore. No problem. For that we use memcpy() to
fill in the data.
Now on 4.0e the memcpy(&structure->lrc, &lrc, 1) generates an unaligned
access. Sure that the pointer to structure->lrc is unaligned but for
that we use memcpy()! We solved the unaligned access warning from the
kernel by writing our own Smemcpy() which the copy the source byte by
byte in a loop.
For me it looks like if the compiler though away the memcpy and make it
diffrently. All the castings we tried didn't work out.
Is there an official way how to handle this or a statement why this was
changed in kernel?
Regards,
Aurel Balmosan
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? 2000-01-05 5:00 unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? Aurel Balmosan @ 2000-01-05 5:00 ` Joe Mario 2000-01-06 5:00 ` Jeff Sullivan 1 sibling, 0 replies; 3+ messages in thread From: Joe Mario @ 2000-01-05 5:00 UTC (permalink / raw) Aurel Balmosan wrote: > Now on 4.0e the memcpy(&structure->lrc, &lrc, 1) generates an unaligned > access. Sure that the pointer to structure->lrc is unaligned but for > that we use memcpy()! We solved the unaligned access warning from the > kernel by writing our own Smemcpy() which the copy the source byte by > byte in a loop. > The V4.0e compiler is generating an inline code sequence to do the memcpy(). You can get rid of the unaligned access errors in several ways. 1) Add "#pragama function (memcpy)" to your source code prior to the memcpy() call. This will cause the compiler to generate a call to the memcpy() function. 2) Add a cast with __unaligned to your memcpy call. For example, if structure is of type foo: memcpy( (__unaligned struct foo *)&structure->lrc, &lrc, 1) ; 3) Add "-nointrinsics" to your cc command line. This will work but will degrade performance for all calls that could be compiler intrinsics. I'd recommend using the __unaligned cast. Joe Mario Compaq Tru64 Development Environment ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? 2000-01-05 5:00 unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? Aurel Balmosan 2000-01-05 5:00 ` Joe Mario @ 2000-01-06 5:00 ` Jeff Sullivan 1 sibling, 0 replies; 3+ messages in thread From: Jeff Sullivan @ 2000-01-06 5:00 UTC (permalink / raw) There is a web page that might help with this question. See http://www.partner.digital.com/www-swdev/pages/Home/TECH/faqs/dunix/unalign.html Hope it helps. -Jeff -- Jeff Sullivan | Compaq Computer Corp. | mailto:jps@zk3.dec.com Compaq C/C++ | Nashua, NH 03062-2698 | Jeff.Sullivan@compaq.com ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-01-06 5:00 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2000-01-05 5:00 unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? Aurel Balmosan 2000-01-05 5:00 ` Joe Mario 2000-01-06 5:00 ` Jeff Sullivan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox