Control: tags -1 patch Hi,
On 23/11/17 18:01, James Cowgill wrote:
> 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 :(
The attached patch works on mips. I didn't test the other failing
architectures.
Thanks,
James
--- a/source/compiler/aslparseop.c
+++ b/source/compiler/aslparseop.c
@@ -283,7 +283,16 @@ TrCreateValuedLeafOp (
Op = TrAllocateOp (ParseOpcode);
- Op->Asl.Value.Integer = Value;
+ if (ParseOpcode == PARSEOP_NAMESTRING ||
+ ParseOpcode == PARSEOP_NAMESEG ||
+ ParseOpcode == PARSEOP_STRING_LITERAL)
+ {
+ Op->Asl.Value.String = (char *) Value;
+ }
+ else
+ {
+ Op->Asl.Value.Integer = Value;
+ }
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateValuedLeafOp Ln/Col %u/%u NewOp %p "
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -225,10 +225,8 @@
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#if defined(__PPC64__) || defined(__s390x__)
#define ACPI_BIG_ENDIAN
#endif
-#endif
#endif /* __KERNEL__ */
signature.asc
Description: OpenPGP digital signature

