Skip to content

Commit 37afb69

Browse files
committed
aml: don't fail on DefDataRegion ops
1 parent e2158d6 commit 37afb69

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

aml/src/lib.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,32 @@ where
246246
length: region_length.as_integer()?,
247247
parent_device_path: context.current_scope.clone(),
248248
});
249+
self.namespace.lock().insert(name.resolve(&context.current_scope)?, Arc::new(region))?;
250+
}
251+
Opcode::DataRegion => {
252+
let [
253+
Argument::Namestring(name),
254+
Argument::Object(signature),
255+
Argument::Object(oem_id),
256+
Argument::Object(oem_table_id),
257+
] = &op.arguments[..]
258+
else {
259+
panic!()
260+
};
261+
let _signature = signature.as_string()?;
262+
let _oem_id = oem_id.as_string()?;
263+
let _oem_table_id = oem_table_id.as_string()?;
264+
265+
// TODO: once this is integrated into the rest of the crate, load the table
266+
log::warn!(
267+
"DefDataRegion encountered in AML! We don't actually support these - produced region will be incorrect"
268+
);
269+
270+
let region = Object::OpRegion(OpRegion {
271+
space: RegionSpace::SystemMemory,
272+
base: 0,
273+
length: 0,
274+
parent_device_path: context.current_scope.clone(),
249275
});
250276
self.namespace.lock().insert(name.resolve(&context.current_scope)?, Arc::new(region))?;
251277
}
@@ -792,6 +818,14 @@ where
792818
2,
793819
));
794820
}
821+
Opcode::DataRegion => {
822+
let name = context.namestring()?;
823+
context.start_in_flight_op(OpInFlight::new_with(
824+
Opcode::DataRegion,
825+
vec![Argument::Namestring(name)],
826+
3,
827+
));
828+
}
795829
Opcode::Field => {
796830
let start_pc = context.current_block.pc;
797831
let pkg_length = context.pkglength()?;
@@ -892,7 +926,6 @@ where
892926
let old_scope = mem::replace(&mut context.current_scope, new_scope);
893927
context.start_new_block(BlockKind::Scope { old_scope }, remaining_length);
894928
}
895-
Opcode::DataRegion => todo!(),
896929
Opcode::Local(local) => {
897930
let local = context.locals[local as usize].clone();
898931
context.last_op()?.arguments.push(Argument::Object(Arc::new(Object::Reference {

0 commit comments

Comments
 (0)