Skip to content

Commit

Permalink
Fix aml_store() to work properly when the lvalue is a reference of
Browse files Browse the repository at this point in the history
LocalX.  In that case, resolving the reference must be done before
resetting the LocalX variable.  test daniel

ok kettenis
  • Loading branch information
yasuoka committed Mar 7, 2021
1 parent 4a621ff commit c1053d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sys/dev/acpi/dsdt.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: dsdt.c,v 1.257 2020/12/17 17:57:19 kettenis Exp $ */
/* $OpenBSD: dsdt.c,v 1.258 2021/03/07 22:53:46 yasuoka Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <[email protected]>
*
Expand Down Expand Up @@ -2961,11 +2961,12 @@ aml_store(struct aml_scope *scope, struct aml_value *lhs , int64_t ival,
aml_rwfield(rhs, 0, rhs->v_field.bitlen, &tmp, ACPI_IOREAD);
rhs = &tmp;
}

lhs = aml_gettgt(lhs, AMLOP_STORE);

/* Store to LocalX: free value */
if (lhs->stack >= AMLOP_LOCAL0 && lhs->stack <= AMLOP_LOCAL7)
aml_freevalue(lhs);

lhs = aml_gettgt(lhs, AMLOP_STORE);
switch (lhs->type) {
case AML_OBJTYPE_UNINITIALIZED:
aml_copyvalue(lhs, rhs);
Expand Down

0 comments on commit c1053d6

Please sign in to comment.