aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-10 10:13:09 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-10 10:13:09 -0700
commitc8e241211445db065745c0e171c3b00e1aff5431 (patch)
treeb4270c4aab3366006a18b63da4eac22501ae5b87
parent16a799ca0ad99f4cc12975d02c965445fbf16673 (diff)
Add some syscall logging
-rw-r--r--Cargo.lock19
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs4
-rw-r--r--src/system.rs4
4 files changed, 29 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index da90dcd..4a4255b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,6 +3,8 @@ name = "cacheracer"
version = "0.1.0"
dependencies = [
"docopt 0.6.78 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustv 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -32,6 +34,15 @@ version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "env_logger"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.46 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "kernel32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -46,6 +57,14 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "log"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "memchr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 6ee23c7..5c58f6a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,6 +4,8 @@ version = "0.1.0"
authors = ["David Li <li.davidm96@gmail.com>"]
[dependencies]
+log = "0.3"
+env_logger = "0.3"
rustv = "0.4.0"
docopt = "0.6"
rustc-serialize = "0.3"
diff --git a/src/main.rs b/src/main.rs
index ff5ed3a..c7ee66f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,6 @@
extern crate docopt;
+#[macro_use] extern crate log;
+extern crate env_logger;
extern crate rustc_serialize;
extern crate rustv;
extern crate time;
@@ -62,6 +64,8 @@ fn load_program<T: memory::Mmu>(memory: &mut memory::Memory,
}
fn main() {
+ env_logger::init().unwrap();
+
let args: Args = Docopt::new(USAGE)
.and_then(|d| d.decode())
.unwrap_or_else(|e| e.exit());
diff --git a/src/system.rs b/src/system.rs
index b8b928e..8875f28 100644
--- a/src/system.rs
+++ b/src/system.rs
@@ -57,12 +57,16 @@ impl<'a> SyscallHandler<'a> {
fn enable_secondary(&mut self, core_id: usize,
registers: &mut RegisterFile) -> Option<Trap> {
+ debug!("[syscall] [memory] Secondary cache enabled for core {}",
+ core_id);
self.caches[core_id].borrow_mut().enable_secondary();
None
}
fn disable_secondary(&mut self, core_id: usize,
registers: &mut RegisterFile) -> Option<Trap> {
+ debug!("[syscall] [memory] Secondary cache disabled for core {}",
+ core_id);
self.caches[core_id].borrow_mut().disable_secondary();
None
}