* Re: [Linux-ia64] unaligned access?
2001-11-28 17:37 [Linux-ia64] unaligned access? Pereira, D LailaX E
@ 2001-11-28 17:47 ` Dan Pop
2001-11-28 17:56 ` Pereira, D LailaX E
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dan Pop @ 2001-11-28 17:47 UTC (permalink / raw)
To: linux-ia64
On Wed, 28 Nov 2001, Pereira, D LailaX E wrote:
> HI
> While running the following code,
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
> ....
> if (WRITE_CAUSED_SIGBUS_or_SEGV){
> ........
> }
> else {
> .........
> }
>
> I get the following error on the "if " statement:
> stress.udp(31438): unaligned access to
> 0x4000000000003541,ip=0x4000000000015fc1
> Please let me know what is wrong with the macro:
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
scp->sc_ip is not properly aligned for an unsigned long access, i.e.
it is not a multiple of 8.
Dan
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [Linux-ia64] unaligned access?
2001-11-28 17:37 [Linux-ia64] unaligned access? Pereira, D LailaX E
2001-11-28 17:47 ` Dan Pop
@ 2001-11-28 17:56 ` Pereira, D LailaX E
2001-11-28 17:57 ` n0ano
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Pereira, D LailaX E @ 2001-11-28 17:56 UTC (permalink / raw)
To: linux-ia64
scp->sc_ip is not properly aligned for an unsigned long access, i.e.
it is not a multiple of 8.
Dan
But ,
sc_ip field is defined as "unsigned long" in
struct sigcontext {
...
unsigned long sc_ip;
...
}
??
d'laila
On Wed, 28 Nov 2001, Pereira, D LailaX E wrote:
> HI
> While running the following code,
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
> ....
> if (WRITE_CAUSED_SIGBUS_or_SEGV){
> ........
> }
> else {
> .........
> }
>
> I get the following error on the "if " statement:
> stress.udp(31438): unaligned access to
> 0x4000000000003541,ip=0x4000000000015fc1
> Please let me know what is wrong with the macro:
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Linux-ia64] unaligned access?
2001-11-28 17:37 [Linux-ia64] unaligned access? Pereira, D LailaX E
2001-11-28 17:47 ` Dan Pop
2001-11-28 17:56 ` Pereira, D LailaX E
@ 2001-11-28 17:57 ` n0ano
2001-11-28 18:25 ` David Mosberger
2001-11-28 19:18 ` Dan Pop
4 siblings, 0 replies; 6+ messages in thread
From: n0ano @ 2001-11-28 17:57 UTC (permalink / raw)
To: linux-ia64
D'Laila-
Some basic IA64'isms:
The instruction pointer points to a bundle that
includes 3 instructions. All instruction bundles
are alligned on a 16-byte boundary.
The instruction pointer as reported by a signal trap frame
encodes both the bundle address and the specific instruction
inside the bundle that caused the fault. The specific
instruction is encoded in the lowest 4 bits of the bundle
address. In your situatation, the bundle address was at
0x4000000000003540 and the second instruction (encoded as 1)
in the bundle was the one that caused the fault.
Just anding off the lower 4 bits from `scp->sc_ip' will solve
your problem.
On Wed, Nov 28, 2001 at 09:37:51AM -0800, Pereira, D LailaX E wrote:
> HI
> While running the following code,
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
> ....
> if (WRITE_CAUSED_SIGBUS_or_SEGV){
> ........
> }
> else {
> .........
> }
>
> I get the following error on the "if " statement:
> stress.udp(31438): unaligned access to
> 0x4000000000003541,ip=0x4000000000015fc1
> Please let me know what is wrong with the macro:
> define WRITE_CAUSED_SIGBUS_or_SEGV \
> (((*(unsigned long*)scp->sc_ip)>>21)&1)
>
>
> thanks
> d'laila
>
>
>
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@indstorage.com
Ph: 303/652-0870x117
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Linux-ia64] unaligned access?
2001-11-28 17:37 [Linux-ia64] unaligned access? Pereira, D LailaX E
` (2 preceding siblings ...)
2001-11-28 17:57 ` n0ano
@ 2001-11-28 18:25 ` David Mosberger
2001-11-28 19:18 ` Dan Pop
4 siblings, 0 replies; 6+ messages in thread
From: David Mosberger @ 2001-11-28 18:25 UTC (permalink / raw)
To: linux-ia64
>>>>> On Wed, 28 Nov 2001 09:37:51 -0800, "Pereira, D LailaX E" <d.lailax.e.pereira@intel.com> said:
>> HI While running the following code, define
>> WRITE_CAUSED_SIGBUS_or_SEGV \ (((*(unsigned
>> long*)scp->sc_ip)>>21)&1) .... if (WRITE_CAUSED_SIGBUS_or_SEGV){
>> ........ } else { ......... }
>> I get the following error on the "if " statement:
>> stress.udp(31438): unaligned access to
>> 0x4000000000003541,ip=0x4000000000015fc1 Please let me know what
>> is wrong with the macro: define WRITE_CAUSED_SIGBUS_or_SEGV \
>> (((*(unsigned long*)scp->sc_ip)>>21)&1)
The least significant two bits of sc_ip encode the slot number. You
need to take those bits into account when reading an instruction from
a bundle.
--david
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [Linux-ia64] unaligned access?
2001-11-28 17:37 [Linux-ia64] unaligned access? Pereira, D LailaX E
` (3 preceding siblings ...)
2001-11-28 18:25 ` David Mosberger
@ 2001-11-28 19:18 ` Dan Pop
4 siblings, 0 replies; 6+ messages in thread
From: Dan Pop @ 2001-11-28 19:18 UTC (permalink / raw)
To: linux-ia64
On Wed, 28 Nov 2001, Pereira, D LailaX E wrote:
>
> scp->sc_ip is not properly aligned for an unsigned long access, i.e.
> it is not a multiple of 8.
>
> Dan
> But ,
> sc_ip field is defined as "unsigned long" in
> struct sigcontext {
> ...
> unsigned long sc_ip;
> ...
> }
>
> ??
The problem is not how it is defined, but what value it contains. In
your case, its value was not a multiple of 8, hence your problem.
Other people have already explained how to properly use its value to
get the relevant bundle address (clear the least significant 4 bits).
Do the proper masking in your macro and you should get the expected
results.
Dan
^ permalink raw reply [flat|nested] 6+ messages in thread