Moved Alias to the namespace
This commit is contained in:
@@ -23,7 +23,7 @@ mod type1opcode;
|
||||
mod type2opcode;
|
||||
|
||||
use self::termlist::{parse_term_list, TermObj};
|
||||
pub use self::namespace::{AmlNamespace, AmlValue};
|
||||
pub use self::namespace::{get_namespace_string, AmlNamespace, AmlValue};
|
||||
use self::namespace::AmlNamespaceContents;
|
||||
|
||||
// TODO: This should be able to take parameters, and may also return multiple values
|
||||
@@ -42,20 +42,6 @@ pub enum AmlError {
|
||||
AmlParseError(&'static str)
|
||||
}
|
||||
|
||||
pub fn get_namespace_string(current: String, modifier: String) -> String {
|
||||
if modifier.starts_with("\\") {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
if modifier.starts_with("^") {
|
||||
// TODO
|
||||
}
|
||||
|
||||
let mut namespace = current.clone();
|
||||
namespace.push('.');
|
||||
namespace + &modifier
|
||||
}
|
||||
|
||||
pub fn parse_aml_table(sdt: &'static Sdt) -> Result<AmlNamespace, AmlError> {
|
||||
let data = sdt.data();
|
||||
|
||||
@@ -73,6 +59,8 @@ pub fn parse_aml_table(sdt: &'static Sdt) -> Result<AmlNamespace, AmlError> {
|
||||
let mut global_namespace = AmlNamespace::new_namespace(&global_namespace_specifier);
|
||||
term_list.execute(&mut global_namespace, global_namespace_specifier.clone());
|
||||
|
||||
println!("{:#?}", global_namespace);
|
||||
|
||||
Ok(global_namespace)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ pub enum AmlNamespaceContents {
|
||||
Value(AmlValue),
|
||||
SubNamespace(Box<AmlNamespace>),
|
||||
Namespace(Vec<AmlNamespaceContents>),
|
||||
Alias(String),
|
||||
OpRegion {
|
||||
region: RegionSpace,
|
||||
offset: AmlValue,
|
||||
@@ -223,3 +224,17 @@ impl AmlNamespace {
|
||||
self.push_to(scope_string, AmlNamespaceContents::Namespace(vec!()));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_namespace_string(current: String, modifier: String) -> String {
|
||||
if modifier.starts_with("\\") {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
if modifier.starts_with("^") {
|
||||
// TODO
|
||||
}
|
||||
|
||||
let mut namespace = current.clone();
|
||||
namespace.push('.');
|
||||
namespace + &modifier
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ impl AmlExecutable for NamespaceModifier {
|
||||
|
||||
namespace.push_to(local_scope_string, AmlNamespaceContents::Value(dro));
|
||||
},
|
||||
NamespaceModifier::Alias { ref source_name, ref alias_name } => {
|
||||
let local_scope_string = get_namespace_string(scope.clone(), source_name.clone());
|
||||
let local_alias_string = get_namespace_string(scope.clone(), alias_name.clone());
|
||||
|
||||
namespace.push_to(local_scope_string, AmlNamespaceContents::Alias(local_alias_string));
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ use memory;
|
||||
use paging::{self, entry, Page, VirtualAddress};
|
||||
use paging::mapper::MapperFlushAll;
|
||||
|
||||
use stop;
|
||||
|
||||
/// Test of zero values in BSS.
|
||||
static BSS_TEST_ZERO: usize = 0;
|
||||
/// Test of non-zero values in data.
|
||||
|
||||
Reference in New Issue
Block a user