* [parisc-linux] 64 byte alignment
@ 2002-08-30 23:43 Will Newton
2002-08-30 23:57 ` Randolph Chung
0 siblings, 1 reply; 4+ messages in thread
From: Will Newton @ 2002-08-30 23:43 UTC (permalink / raw)
To: parisc-linux
I'm trying to 64 byte align a stack pointer, unfortunately it's not working.
Here is my code:
ldi 0x03f,%r21 ; Load mask (b0111111)
and,<> %r3,%r21,%r21 ; Check alignment
addi 64,%r3,%r3 ; If not aligned round up
depwi 0x0,31,6,%r3 ; Clear low order bits
Basically the idea is:
and the low 6 bits with a mask to see if any are set.
if any are set, add 64 and clear the low order bits
I may be doing something horribly ignorant here, but PA-RISC assembly is not
the most widely documented of things. :)
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [parisc-linux] 64 byte alignment 2002-08-30 23:43 [parisc-linux] 64 byte alignment Will Newton @ 2002-08-30 23:57 ` Randolph Chung 2002-08-31 0:10 ` Will Newton 2002-08-31 1:12 ` John David Anglin 0 siblings, 2 replies; 4+ messages in thread From: Randolph Chung @ 2002-08-30 23:57 UTC (permalink / raw) To: Will Newton; +Cc: parisc-linux > I'm trying to 64 byte align a stack pointer, unfortunately it's not working. > Here is my code: > > ldi 0x03f,%r21 ; Load mask (b0111111) > and,<> %r3,%r21,%r21 ; Check alignment > addi 64,%r3,%r3 ; If not aligned round up > depwi 0x0,31,6,%r3 ; Clear low order bits > > Basically the idea is: > and the low 6 bits with a mask to see if any are set. > if any are set, add 64 and clear the low order bits > > I may be doing something horribly ignorant here, but PA-RISC assembly is not > the most widely documented of things. :) nullification only applies to one instruction. you probably need a branch there. as for documentation, the entire intruction set is documented for pa1.1 and 2.0 on the hp web site: http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,958!1!253,00.html http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,959,00.html horrid link names :-( another good way to do this is to write what you want in C, and tell gcc to tell you what you want :-) input: r26, r20 is scratch extru %r26,31,6,%r20 comib,=,n 0,%r20,.L2 ldo 64(%r26),%r26 depi 0,31,6,%r26 .L2: /* ... */ randolph -- Randolph Chung Debian GNU/Linux Developer, hppa/ia64 ports http://www.tausq.org/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [parisc-linux] 64 byte alignment 2002-08-30 23:57 ` Randolph Chung @ 2002-08-31 0:10 ` Will Newton 2002-08-31 1:12 ` John David Anglin 1 sibling, 0 replies; 4+ messages in thread From: Will Newton @ 2002-08-31 0:10 UTC (permalink / raw) To: parisc-linux On Saturday 31 Aug 2002 12:57 am, Randolph Chung wrote: > nullification only applies to one instruction. you probably need a > branch there. I know, but I figured clearing the low 6 bits on an already aligned pointer would do no damage. > another good way to do this is to write what you want in C, and tell gcc > to tell you what you want :-) Thanks! I trust gcc somewhat more than I do myself at this stage. :) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [parisc-linux] 64 byte alignment 2002-08-30 23:57 ` Randolph Chung 2002-08-31 0:10 ` Will Newton @ 2002-08-31 1:12 ` John David Anglin 1 sibling, 0 replies; 4+ messages in thread From: John David Anglin @ 2002-08-31 1:12 UTC (permalink / raw) To: randolph; +Cc: will, parisc-linux > another good way to do this is to write what you want in C, and tell gcc > to tell you what you want :-) GCC aligns its stacks to 64 and 128 byte boundaries for the 32 and 64 bit ports, respectively. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-31 1:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-08-30 23:43 [parisc-linux] 64 byte alignment Will Newton 2002-08-30 23:57 ` Randolph Chung 2002-08-31 0:10 ` Will Newton 2002-08-31 1:12 ` John David Anglin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.