summaryrefslogtreecommitdiff
path: root/sys/src/libaml
AgeCommit message (Collapse)Author
2023-05-18libaml: tow eisaid inside the environmentmia soweli
2021-10-17libaml: resolve refs in ObjectType instructioncinap_lenrek
The standard states in section 19.5.93: .... Notice that if this operation is performed on an obeject reference such as one produced by the Alias, Index, or RefOf statements, the obect type of the base object is returned.
2021-10-17libaml: implement ObjectType instruction (thanks sigrid)cinap_lenrek
2021-10-17libaml: implement ToString instructioncinap_lenrek
2021-07-14libaml: fix gc bug, need to amltake()/amldrop() temporary buffercinap_lenrek
we have to protect the temporary buffer allocated by rwfield() as rwreg() calls amlmapio() which might cause further aml code execution causing gc() which frees it under us (as it is not referenced from the interpreter state). this fixes a panic on boot of a Lenovo Thinkpad P17 Gen1 Professional Mobile Workstation
2021-02-22libaml: fix IndexField and BankField implementations (thanks Michael Forney)cinap_lenrek
IndexField is supposed to increment the index value when an access is done with a bigger size than the data field. The index value is always a byte offset. Now that we always calculate the offset for each field unit access for IndexField, rename the indexv to bank (the bank value), as it is only used for that. Also, do not compare it with nil, as it is a integer constant which can be encoded as nil to mean zero. For BankField, the banking field was written using store(), which does nothing when the destination is a Field*. Use rwfield() to fix it in the new rwfieldunit(). Resolve all the Name*'s when IndexField, BankField and Field are created. Now, Field.reg points to eigther Buffer object, Region or Field (data Field of an IndexField). PS: initial bug report by Michael Forney follows below: In /dev/kmesg on my T14, I saw a message amlmapio: [0xffffff18-0x100000018] overlaps usable memory amlmapio: mapping \_SB.FRTP failed Here is the relevant snippet from my DSDT: Scope (_SB) { ... OperationRegion (ECMC, SystemIO, 0x72, 0x02) Field (ECMC, AnyAcc, NoLock, Preserve) { ECMI, 8, ECMD, 8 } IndexField (ECMI, ECMD, ByteAcc, NoLock, Preserve) { Offset (0x08), FRTB, 32 } OperationRegion (FRTP, SystemMemory, FRTB, 0x0100) Field (FRTP, AnyAcc, NoLock, Preserve) { ... } } With some debugging output: amlmapio(\_SB.ECMC): Io 72 - 74 rwreg(\_SB.ECMC): Io [72+0]/1 <- 8 rwreg(\_SB.ECMC): Io [72+1]/1 -> 18 amlmapio(\_SB.FRTP): Mem ffffff18 - 100000018 amlmapio: [0xffffff18-0x100000018) overlaps usable memory amlmapio: mapping \_SB.FRTP failed It seems that libaml does not handle IndexField correctly and just did a single read from ECMD after setting ECMI to 8, causing the FRTP region to be evaluated as 0xffffff18-0x100000018. Instead, it should be reading 4 bytes [18 c0 22 cc], evaluating it as 0xcc22c018-0xcc22118: amlmapio(\_SB.ECMC): Io 72 - 74 rwreg(\_SB.ECMC): Io [72+0]/1 <- 8 rwreg(\_SB.ECMC): Io [72+1]/1 -> 18 rwreg(\_SB.ECMC): Io [72+0]/1 <- 9 rwreg(\_SB.ECMC): Io [72+1]/1 -> c0 rwreg(\_SB.ECMC): Io [72+0]/1 <- a rwreg(\_SB.ECMC): Io [72+1]/1 -> 22 rwreg(\_SB.ECMC): Io [72+0]/1 <- b rwreg(\_SB.ECMC): Io [72+1]/1 -> cc amlmapio(\_SB.FRTP): Mem cc22c018 - cc22c118 I wrote a patch (attached) to fix this, and it seems to work. Though, it's not clear to me when things should be dereferenced. Previously, the data field was dereferenced at evalfield, but the region and index field were not until rwfield. After the patch, the index field is also dereferenced in evalfield. For BankField, the index *is* dereferenced in evalfield. I'm pretty sure that this means that BankField does not work currently, since store() just returns nil for 'f' objects. The bank selector will never get set. Anyway, I don't know if this solves any real problems; it's just something I noticed and thought I'd try to fix.
2020-10-21libaml: add (nop) "signal" opSigrid
2020-08-20libaml: fix fault when the second operand of comparison cannot be convertedSigrid
2020-05-23libaml: implement ToDecimalString and ToHexString operationscinap_lenrek
2018-11-04libaml: allow amlmapio() to re-enter the interpreter (can happen by pciadd() ↵cinap_lenrek
-> amleval()) - make frame base pointer variable - in rwreg(), save/restore the interpreter state and allocate a Frame* on the stack - add overflow checks for frame base pointer to xec() and amleval() - gc() scans the whole stack from FP to the *real* bottom F0
2017-02-24libaml: make heap size field int, implement BankField definitionscinap_lenrek
2016-06-05aml: define amlintmask and set it according to DSDT revision (64bit / 32bit)cinap_lenrek
2016-06-04aml: implement ToInteger() and Match() instructionscinap_lenrek
2016-01-07format pointer subtraction results with %zd instead of %ld (for long -> ↵cinap_lenrek
intptr on amd64)
2013-09-07libaml: fix formatingcinap_lenrek
2013-09-07libaml: fix uninitialized variable in getle(), make amleval() work with ↵cinap_lenrek
buildin methods
2013-09-07libaml: use FP->env to access method arguments instead of FP->arg in evalosi()cinap_lenrek
2013-09-07libaml: amldelay(), _OSI(), fix bug in Load() (from plhk's acpi patch)cinap_lenrek
export amldelay() for microsecond sleeps. implement _OSI() method. fix rwreg argument in evalload()
2013-09-06libaml: new io interface, add amlnew()/amltake()/amldrop(), late binding ↵cinap_lenrek
names, FindSetLeftBit/FindSetRightBit new io interface was added. user defines amlmapio() and amlunmapio() functions that will fill out Amlio structure with function pointers to read/write routines for a particular region. amlnew() function added allowing the creation of aml objects like buffers or packages. these can be passed to amleval() with b, p or * format. amltake()/amldrop() exclude an aml object from garbage collection. on load, names are not always resolvable until the whole table is loaded. for this, we create n objects that are just name strings. after load, we recursively traverse the namespace and resolve them (see fixnames()). the FindSetLeftBit and FindSetRightBit opcodes got implemened.
2013-07-12aml: preserve reference type when indexing into package to prevent implicit ↵cinap_lenrek
type conversion when storing to arg or local if LocalX or ArgX is a package, the store into a element should *not* type convert. so when taking the index reference, we have to carry over the type.
2013-06-29libaml: add Concatenate instruction, fix type conversionscinap_lenrek
2013-06-29libaml: add Load and Unload instructionscinap_lenrek
not very usefull at the moment as theres no code to map/unmap memory regions right now.
2013-06-18libaml: pikeshedd style, handle division by zero (thanks erik)cinap_lenrek
2013-06-07libaml: create \_GL name objectcinap_lenrek
2013-06-04libaml: various fixes found by plhkcinap_lenrek
- fix bogus execution of Else{} blocks - always allocate Env in amleval() - add Sleep() and Stall() instructions - keep package size for packages with empty body
2012-09-09libaml: store *value* instead of name reference in dest for alias opcinap_lenrek
2012-09-08libaml: implement Alias and Debug instructionscinap_lenrek
2012-06-17experimental acpi support for apic irq routingcinap_lenrek