Skip to content
Snippets Groups Projects
Unverified Commit d5d156a3 authored by Connor Wood's avatar Connor Wood
Browse files

Implemented buffer field index modify

parent aa35967f
No related branches found
No related tags found
1 merge request!48Fully implemented AML parser, some amendments to ACPI infrastructure
use collections::string::String;
use collections::btree_map::BTreeMap;
use collections::vec::Vec;
use alloc::boxed::Box;
use spin::RwLockWriteGuard;
......@@ -314,7 +315,7 @@ impl AmlExecutionContext {
}
}
fn modify_index_core(&self, obj: AmlValue, value: AmlValue, indices: Vec<u64>) -> Result<AmlValue, AmlError> {
fn modify_index_core(&mut self, obj: AmlValue, value: AmlValue, indices: Vec<u64>) -> Result<AmlValue, AmlError> {
match obj {
AmlValue::String(ref string) => {
if indices.len() != 1 {
......@@ -338,6 +339,18 @@ impl AmlExecutionContext {
Ok(AmlValue::Buffer(b))
},
AmlValue::BufferField(ref b) => {
if indices.len() != 1 {
return Err(AmlError::AmlValueError);
}
let mut idx = indices[0];
idx += b.index.get_as_integer()?;
self.modify(AmlValue::ObjectReference(ObjectReference::Index(b.source_buf.clone(), Box::new(AmlValue::Integer(idx.clone())))), value);
Ok(AmlValue::BufferField(b.clone()))
},
AmlValue::Package(ref p) => {
if indices.len() < 0 {
return Err(AmlError::AmlValueError);
......@@ -367,7 +380,13 @@ impl AmlExecutionContext {
self.modify_index(*c, value, indices)
},
_ => Err(AmlError::AmlValueError)
ObjectReference::ArgObj(_) => Err(AmlError::AmlValueError),
ObjectReference::LocalObj(i) => {
let v = self.local_vars[i as usize].clone();
self.local_vars[i as usize] = self.modify_index_core(v, value, indices)?;
Ok(())
}
},
_ => Err(AmlError::AmlValueError)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment