Moved ConnectFieldBufferData to the namespace

This commit is contained in:
Connor Wood
2017-06-22 15:22:19 +01:00
parent c8eca653b8
commit fb0e5137e8
3 changed files with 41 additions and 1 deletions

View File

@@ -135,6 +135,12 @@ impl AmlExecutable for NamedObj {
FieldElement::ReservedField { length } => offset += length,
FieldElement::ConnectFieldNameString(ref name) => connection =
AmlValue::ObjectReference(SuperName::NameString(name.clone())),
FieldElement::ConnectFieldBufferData(ref buf) => {
connection = match buf.execute(namespace, scope.clone()) {
Some(c) => c,
None => return None
};
},
FieldElement::NamedField { name: ref field_name, length } => {
let local_scope_string = get_namespace_string(scope.clone(),
field_name.clone());
@@ -164,6 +170,12 @@ impl AmlExecutable for NamedObj {
FieldElement::ReservedField { length } => offset += length,
FieldElement::ConnectFieldNameString(ref name) => connection =
AmlValue::ObjectReference(SuperName::NameString(name.clone())),
FieldElement::ConnectFieldBufferData(ref buf) => {
connection = match buf.execute(namespace, scope.clone()) {
Some(c) => c,
None => return None
};
},
FieldElement::NamedField { name: ref field_name, length } => {
let local_scope_string = get_namespace_string(scope.clone(),
field_name.clone());
@@ -333,6 +345,12 @@ impl AmlExecutable for NamedObj {
FieldElement::ReservedField { length } => offset += length,
FieldElement::ConnectFieldNameString(ref name) => connection =
AmlValue::ObjectReference(SuperName::NameString(name.clone())),
FieldElement::ConnectFieldBufferData(ref buf) => {
connection = match buf.execute(namespace, scope.clone()) {
Some(c) => c,
None => return None
};
},
FieldElement::NamedField { name: ref field_name, length } => {
let local_scope_string = get_namespace_string(scope.clone(),
field_name.clone());

View File

@@ -25,7 +25,10 @@ pub enum FieldSelector {
#[derive(Debug, Clone)]
pub enum AmlValue {
Uninitialized,
Buffer,
Buffer {
length: Box<AmlValue>,
byte_list: Vec<u8>
},
BufferField {
source_buf: Box<AmlValue>,
index: Box<AmlValue>,

View File

@@ -207,6 +207,25 @@ impl AmlExecutable for Type2OpCode {
}
}
impl AmlExecutable for DefBuffer {
fn execute(&self, namespace: &mut BTreeMap<String, AmlValue>, scope: String) -> Option<AmlValue> {
match *self {
DefBuffer::Buffer { ref buffer_size, ref byte_list } => {
let length = match buffer_size.execute(namespace, scope.clone()) {
Some(l) => Box::new(l),
_ => return None
};
Some(AmlValue::Buffer {
length: length,
byte_list: byte_list.clone()
})
},
_ => None
}
}
}
#[derive(Debug, Clone)]
pub enum DefObjectType {
SuperName(SuperName),