Skip to content

Passing Local to Method allows it to be overwritten #313

Description

@martin-hughes

The following script demonstrates this:

DefinitionBlock ("", "DSDT", 1, "RSACPI", "TESTTABL", 0xF0F0F0F0)
{
    Name(FCNT, 0)

    Method (CHEK, 2) {
        If (Arg0 != Arg1) {
            FCNT++
        }
    }

    Method (INR5, 1) {
        Arg0 = 5
    }

    Method (T5) {
        Local1 = 1
        INR5(Local1)
        CHEK (Local1, 1)
    }

    Method (MAIN, 0, NotSerialized) {
        T5()

        Return (FCNT)
    }
}

Local1 of T5 should remain as 1, instead it is overwritten in INR5.

I think this can be fixed by special-casing do_store to avoid writing back to the inner ref if target is an Arg that's anything over than a "true" reference, but I feel like I've missed something obvious?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions