All of lore.kernel.org
 help / color / mirror / Atom feed
From: malattia at linux.it
To: devel@acpica.org
Subject: Re: [Devel] [patch 4/5] Fix aligment issues
Date: Tue, 06 Jul 2010 21:24:10 +0900	[thread overview]
Message-ID: <20100706122410.GA5020@kamineko.org> (raw)
In-Reply-To: 1278379187.9540.39.camel@minggr.sh.intel.com

[-- Attachment #1: Type: text/plain, Size: 2290 bytes --]

On Tue, Jul 06, 2010 at 09:19:47AM +0800, Lin Ming wrote:
> On Mon, 2010-07-05 at 20:03 +0800, malattia(a)linux.it wrote:
> > Add more platforms to the list of the ones requiring aligned memory access. Also
> > fix callsites where wrong assumptions where made in terms of aligment.
...
> > Index: b/executer/exoparg2.c
> > ===================================================================
> > --- a/executer/exoparg2.c	2010-07-02 21:42:26.477349196 +0900
> > +++ b/executer/exoparg2.c	2010-07-04 11:18:22.506529460 +0900
> > @@ -248,6 +248,8 @@
> >      ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
> >      ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
> >      ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
> > +    UINT64                  ReturnValue1 = 0;
> > +    UINT64                  ReturnValue2 = 0;
> >      ACPI_STATUS             Status;
> >  
> > 
> > @@ -281,8 +283,10 @@
> >  
> >          Status = AcpiUtDivide (Operand[0]->Integer.Value,
> >                                 Operand[1]->Integer.Value,
> > -                               &ReturnDesc1->Integer.Value,
> > -                               &ReturnDesc2->Integer.Value);
> > +                               &ReturnValue1, &ReturnValue2);
> 
> Why need to replace &ReturnDesc1->Integer.Value with &ReturnValue1?

I get this on sparc systems without these 2 hunks:

malattia(a)smetana:~/acpica-unix> ./compiler/iasl -tc -ps.hex tests/misc/grammar.asl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20100528 [Jul  6 2010]
Copyright (c) 2000 - 2010 Intel Corporation
Supports ACPI Specification Revision 4.0a

[1]    28389 bus error  ./compiler/iasl -tc -ps.hex tests/misc/grammar.asl

it is caused by the pointer to the 64bit integer being aligned to 4
bytes instead of 8 bytes as required by the 64bit assigment inside
AcpiUtDivide when computing the result of the division:

        *OutQuotient = InDividend / InDivisor;

or at least that is my understanding of the problem.

Anyway, just using a temporary variable correctly aligned on the stack
and then assigning the result to Integer.Value afterwards works around
the problem.

Hope the explanation is understandable... otherwise I'll try harder :)
-- 
mattia
:wq!

             reply	other threads:[~2010-07-06 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06 12:24 malattia [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-07-07  0:46 [Devel] [patch 4/5] Fix aligment issues Lin Ming
2010-07-06  1:19 Lin Ming
2010-07-05 12:03 malattia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100706122410.GA5020@kamineko.org \
    --to=devel@acpica.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.