Skip to content

Commit b266a6a

Browse files
committed
aml: commit some comments/other bits in prep of merging crates
1 parent 9cf6293 commit b266a6a

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

aml/src/lib.rs

+18-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ impl<H> Interpreter<H>
5858
where
5959
H: Handler,
6060
{
61+
// TODO: new_from_tables helper that does `new` and then loads the DSDT + any SSDTs
62+
6163
pub fn new(handler: H, dsdt_revision: u8) -> Interpreter<H> {
6264
info!("Initializing AML interpreter v{}", env!("CARGO_PKG_VERSION"));
6365
Interpreter {
@@ -272,6 +274,11 @@ where
272274
| Opcode::LLess => {
273275
self.do_logical_op(&mut context, op)?;
274276
}
277+
Opcode::ToBuffer
278+
| Opcode::ToDecimalString
279+
| Opcode::ToHexString
280+
| Opcode::ToInteger
281+
| Opcode::ToString => todo!(),
275282
Opcode::Mid => self.do_mid(&mut context, op)?,
276283
Opcode::Concat => self.do_concat(&mut context, op)?,
277284
Opcode::ConcatRes => {
@@ -412,7 +419,6 @@ where
412419
else {
413420
panic!()
414421
};
415-
416422
let predicate = predicate.as_integer()?;
417423
let remaining_then_length = then_length - (context.current_block.pc - start_pc);
418424

@@ -697,6 +703,9 @@ where
697703
*/
698704
assert!(context.block_stack.len() > 0);
699705

706+
// TODO: I think we can handle VarPackage here as well because by the
707+
// time the block finishes, the first arg should be resolvable (the var
708+
// length) and so can be updated here...
700709
if let Some(package_op) = context.in_flight.last_mut()
701710
&& package_op.op == Opcode::Package
702711
{
@@ -872,6 +881,7 @@ where
872881
Opcode::Signal => todo!(),
873882
Opcode::Wait => todo!(),
874883
Opcode::Reset => todo!(),
884+
Opcode::Notify => todo!(),
875885
Opcode::FromBCD | Opcode::ToBCD => context.start_in_flight_op(OpInFlight::new(opcode, 2)),
876886
Opcode::Revision => {
877887
context.contribute_arg(Argument::Object(Arc::new(Object::Integer(INTERPRETER_REVISION))));
@@ -1108,10 +1118,16 @@ where
11081118
context.start_in_flight_op(OpInFlight::new(opcode, 2))
11091119
}
11101120
Opcode::DerefOf => context.start_in_flight_op(OpInFlight::new(opcode, 1)),
1111-
Opcode::Notify => todo!(),
11121121
Opcode::ConcatRes => context.start_in_flight_op(OpInFlight::new(opcode, 3)),
11131122
Opcode::SizeOf => context.start_in_flight_op(OpInFlight::new(opcode, 1)),
11141123
Opcode::Index => context.start_in_flight_op(OpInFlight::new(opcode, 3)),
1124+
/*
1125+
* TODO
1126+
* Match is a difficult opcode to parse, as it interleaves dynamic arguments and
1127+
* random bytes that need to be extracted as you go. I think we'll need to use 1+
1128+
* internal in-flight ops to parse the static bytedatas as we go, and then retire
1129+
* the real op at the end.
1130+
*/
11151131
Opcode::Match => todo!(),
11161132

11171133
Opcode::CreateBitField

aml/src/namespace.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ impl Namespace {
2525
namespace.add_level(AmlName::from_str("\\_PR").unwrap(), NamespaceLevelKind::Scope).unwrap();
2626
namespace.add_level(AmlName::from_str("\\_TZ").unwrap(), NamespaceLevelKind::Scope).unwrap();
2727

28+
// TODO: add pre-defined objects as well - \GL, \OSI, etc.
29+
2830
namespace
2931
}
3032

aml/src/op_region.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ pub struct OpRegion {
99
}
1010

1111
pub trait RegionHandler {
12-
fn read(&self, region: &OpRegion) -> Result<(), AmlError>;
13-
fn write(&self, region: &OpRegion) -> Result<(), AmlError>;
12+
fn read_u8(&self, region: &OpRegion) -> Result<u8, AmlError>;
13+
fn read_u16(&self, region: &OpRegion) -> Result<u16, AmlError>;
14+
fn read_u32(&self, region: &OpRegion) -> Result<u32, AmlError>;
15+
fn read_u64(&self, region: &OpRegion) -> Result<u64, AmlError>;
16+
17+
fn write_u8(&self, region: &OpRegion, value: u8) -> Result<(), AmlError>;
18+
fn write_u16(&self, region: &OpRegion, value: u16) -> Result<(), AmlError>;
19+
fn write_u32(&self, region: &OpRegion, value: u32) -> Result<(), AmlError>;
20+
fn write_u64(&self, region: &OpRegion, value: u64) -> Result<(), AmlError>;
1421
}
1522

1623
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]

0 commit comments

Comments
 (0)