Skip to content

Commit 74b37ed

Browse files
committed
Unwrap reference in do_size_of
1 parent 0a91e3f commit 74b37ed

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎src/aml/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,7 @@ where
22932293

22942294
fn do_size_of(&self, context: &mut MethodContext, op: OpInFlight) -> Result<(), AmlError> {
22952295
extract_args!(op => [Argument::Object(object)]);
2296-
let object = object.clone().unwrap_transparent_reference();
2296+
let object = object.clone().unwrap_reference();
22972297

22982298
let result = match *object {
22992299
Object::Buffer(ref buffer) => buffer.len(),

‎tests/package_sizeof.asl‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
DefinitionBlock("", "DSDT", 1, "RSACPI", "PACKGE", 1) {
2+
// Checks fix for issue 282 - SizeOf on a reference to a package doesn't work.
3+
Name(FOO, Package (3) {
4+
Package (0x01) {
5+
0x1,
6+
},
7+
8+
Package (0x01) {
9+
0x02,
10+
},
11+
12+
Package (0x01) {
13+
0x03,
14+
}
15+
})
16+
17+
Method (MAIN, 0, NotSerialized) {
18+
Local0 = Sizeof (FOO) // Should be 3
19+
Local1 = Sizeof (FOO[0]) // Should be 1. This was the failing line.
20+
Return ((Local0 + Local1) - 4)
21+
}
22+
}

0 commit comments

Comments
 (0)