OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 10:45 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: AML, forward references?
PostPosted: Sun Nov 08, 2020 9:42 am 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
The Bochs emulator provides a DSDT where a name (LNKD) is referenced by a package before it is defined. There is no way to know in advance what the name will refer to, so what am I to make of this? Is this even legal AML?

To illustrate the problem, suppose you have the following definition block. If it is legal, what does it do and what will be stored in \AAAA\DDDD? If not, where is the error?
Code:
Device (AAAA) {
    Name (BBBB, Package(1) {CCCC})
    If (LEqual(ObjectType(Index(BBBB, 0)), 1)) {
        Device(CCCC) {
        }
        Name(DDDD, 0)
    } Else {
        Name(DDDD, 1)
    }
}
Name (CCCC, 1234)


Top
 Profile  
 
 Post subject: Re: AML, forward references?
PostPosted: Sun Nov 08, 2020 12:26 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Gigasoft wrote:
Is this even legal AML?
Looks like it. I've found this patch from 2016, which says:
Quote:
With old support, it appears to be the forward referencing in the arguments of the above opcodes is supported by the ACPICA interpreter, while the investigation result shows that Windows doesn't support the forward referencing even in the arguments.
(Again, this is from 2016)

I guess you'll have to parse the AML code more than once, using a multiple-pass parser. First collect the references (or prototypes), then in the second pass the definitions. That's how all compilers work that support forward-referencing languages.

Cheers,
bzt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 110 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group