Hi,

On 21/11/17 07:28, Adrian Bunk wrote:
> Begin compiling test package: [operand]
> Begin compiling test package: [tests]
> Begin compiling test package: [oarg]
> Test path: 
> /<<PKGBUILDDIR>>/tests/aslts/src/runtime/collections/complex/operand/tests/oarg
>     Type: nopt/32 Compile => Removing filesrm: cannot remove 'MAIN.asm': No 
> such file or directory
> rm: cannot remove 'MAIN.c': No such file or directory
> rm: cannot remove 'MAIN.h': No such file or directory
> rm: cannot remove 'MAIN.i': No such file or directory
> rm: cannot remove 'MAIN.hex': No such file or directory
> rm: cannot remove 'MAIN.lst': No such file or directory
> rm: cannot remove 'MAIN.map': No such file or directory
> rm: cannot remove 'MAIN.nsp': No such file or directory
> rm: cannot remove 'MAIN.offset.h': No such file or directory
> rm: cannot remove 'MAIN.src': No such file or directory
>  => Done 
> ls: cannot access 'oarg.aml': No such file or directory
> mv: cannot stat 'oarg.aml': No such file or directory
> Compiled test package: [oarg]
> ...
> WARNING: some test cases dont have AML code! (168)
> ...
> iASL: Segmentation Fault

I think this is caused by this in aslrules.y:
> String
>     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafOp 
> (PARSEOP_STRING_LITERAL,
>                                         (ACPI_NATIVE_INT) AslCompilerlval.s);}
>     ;

Here we cast a (char*) to uint64.

In aslparseop.c we assign this uint64 into a union:
> ACPI_PARSE_OBJECT *
> TrCreateValuedLeafOp (
>     UINT32                  ParseOpcode,
>     UINT64                  Value)
> {
>     ACPI_PARSE_OBJECT       *Op;
> 
> 
>     Op = TrAllocateOp (ParseOpcode);
>     Op->Asl.Value.Integer = Value;

This union us defined like this (aclocal.h):
> typedef union acpi_parse_value
> {
>     UINT64                          Integer;        /* Integer constant (Up 
> to 64 bits) */
>     UINT32                          Size;           /* bytelist or field size 
> */
>     char                            *String;        /* NULL terminated string 
> */
>     UINT8                           *Buffer;        /* buffer or string */
>     char                            *Name;          /* NULL terminated string 
> */
>     union acpi_parse_object         *Arg;           /* arguments and 
> contained ops */
>     ACPI_TAG_INFO                   Tag;            /* Resource descriptor 
> tag info  */
> 
> } ACPI_PARSE_VALUE;

On 32-bit big endian we end up putting the pointer into the _lower_ half
of "Integer" which does not work when later reading from "String" (which
will read from the _upper_ half).

I might have a go at getting a patch working for this. These bad casts
make me despair :(

James

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to