Hi Yamahata-san,
Thanks for informing me.
My gcc might be Redhat patched one. (I'm using RHEL5)
It generates the code I expect.
So I rewrote the patch more generally.
Tristan, please discard the previous patch and apply
the attached patch.
Thanks,
Kouya
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Isaku Yamahata writes:
> Hi.
>
> gcc doesn't support aligned attribute for values on stack.
> See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16660
>
> To be honest, I'm not sure about latest one.
> At least my ia64-unknown-linux-gcc 4.1.2 which I compiled from
> the source code doesn't.
>
> Is your gcc the RedHat patched one?
> Did you check the resulted assembler code?
>
> On Mon, Oct 15, 2007 at 05:59:59PM +0900, Kouya Shimura wrote:
> Content-Description: message body text
> > Hi Tristan,
> >
> > The attached patch fix unalignment reference with gcc 4.x.
> > I tested the binary built with gcc 4.1.1 works fine.
> >
> > Thanks,
> > Kouya
> >
> > Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
> >
>
> > diff -r 8ecccd88813c edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c
> > --- a/edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c Thu Oct 11
> > 02:09:46 2007 +0200
> > +++ b/edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c Mon Oct 15
> > 15:50:46 2007 +0900
> > @@ -421,15 +421,15 @@ VOID
> > VOID
> > check_regs (VOID)
> > {
> > - long save[SAVESZ / 8];
> > - long rand[RANDSZ / 8];
> > + long save[SAVESZ / 8] __attribute__ ((aligned (16)));
> > + long rand[RANDSZ / 8] __attribute__ ((aligned (16)));
> > long *r;
> > int i;
> >
> > for (i = 0; i < RANDSZ; i++)
> > ((unsigned char*)rand)[i] = i ^ 0x59;
> >
> > - if (r = regcheck(save, rand)) {
> > + if ((r = regcheck(save, rand))) {
> > int reg = r - rand;
> > asm volatile ("rsm psr.ic;; mov r2=%0; break 4" : : "r"(reg));
> > #if 0
>
> > _______________________________________________
> > Xen-ia64-devel mailing list
> > Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-ia64-devel
>
> --
> yamahata
diff -r 8ecccd88813c edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c
--- a/edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c Thu Oct 11
02:09:46 2007 +0200
+++ b/edk2-sparse/EdkXenPkg/Cpu/Itanium/Timer/Dxe/Timer.c Mon Oct 15
18:40:16 2007 +0900
@@ -421,15 +421,23 @@ VOID
VOID
check_regs (VOID)
{
- long save[SAVESZ / 8];
- long rand[RANDSZ / 8];
+ long save_stk[SAVESZ / 8 + 1];
+ long rand_stk[RANDSZ / 8 + 1];
+ long *save = save_stk;
+ long *rand = rand_stk;
long *r;
int i;
+ /* 16 bytes alignment */
+ if (((long)save & 8) != 0)
+ ++save;
+ if (((long)rand & 8) != 0)
+ ++rand;
+
for (i = 0; i < RANDSZ; i++)
((unsigned char*)rand)[i] = i ^ 0x59;
- if (r = regcheck(save, rand)) {
+ if ((r = regcheck(save, rand))) {
int reg = r - rand;
asm volatile ("rsm psr.ic;; mov r2=%0; break 4" : : "r"(reg));
#if 0
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|