Every context has an ID

This commit is contained in:
Connor Wood
2017-07-22 09:10:37 +01:00
parent 1938ca0435
commit 8412339ae9
2 changed files with 13 additions and 4 deletions

View File

@@ -27,11 +27,17 @@ pub struct AmlExecutionContext {
pub local_vars: [AmlValue; 8],
pub arg_vars: [AmlValue; 8],
pub state: ExecutionState,
pub namespace_delta: Vec<String>
pub namespace_delta: Vec<String>,
pub ctx_id: u64
}
impl AmlExecutionContext {
pub fn new(scope: String) -> AmlExecutionContext {
let mut idptr = ACPI_TABLE.next_ctx.write();
let id: u64 = *idptr;
*idptr += 1;
AmlExecutionContext {
scope: scope,
local_vars: [AmlValue::Uninitialized,
@@ -51,7 +57,8 @@ impl AmlExecutionContext {
AmlValue::Uninitialized,
AmlValue::Uninitialized],
state: ExecutionState::EXECUTING,
namespace_delta: vec!()
namespace_delta: vec!(),
ctx_id: id
}
}

View File

@@ -315,13 +315,15 @@ pub fn set_global_s_state(state: u8) {
pub struct Acpi {
pub fadt: RwLock<Option<Fadt>>,
pub namespace: RwLock<Option<BTreeMap<String, AmlValue>>>,
pub hpet: RwLock<Option<Hpet>>
pub hpet: RwLock<Option<Hpet>>,
pub next_ctx: RwLock<u64>,
}
pub static ACPI_TABLE: Acpi = Acpi {
fadt: RwLock::new(None),
namespace: RwLock::new(None),
hpet: RwLock::new(None)
hpet: RwLock::new(None),
next_ctx: RwLock::new(0),
};
/// RSDP