forked from AbleOS/ableos
adding instruction log
Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
parent
5b123be9ea
commit
47d727855d
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -213,12 +213,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbbytecode"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9c4b84ce33ea6ac7fe0f1b00ee5c67718643a34a"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#3491814b4f1723e6b1f3ae485ed5d3b5cad16df0"
|
||||
|
||||
[[package]]
|
||||
name = "hblang"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9c4b84ce33ea6ac7fe0f1b00ee5c67718643a34a"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#3491814b4f1723e6b1f3ae485ed5d3b5cad16df0"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"hbbytecode",
|
||||
|
@ -229,7 +229,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbvm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9c4b84ce33ea6ac7fe0f1b00ee5c67718643a34a"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#3491814b4f1723e6b1f3ae485ed5d3b5cad16df0"
|
||||
dependencies = [
|
||||
"hbbytecode",
|
||||
]
|
||||
|
|
|
@ -9,7 +9,7 @@ ktest = []
|
|||
[dependencies]
|
||||
# embedded-graphics = "0.8"
|
||||
hbvm = { git = "https://git.ablecorp.us/AbleOS/holey-bytes.git", features = [
|
||||
"nightly",
|
||||
"nightly", "alloc", "disasm"
|
||||
] }
|
||||
ktest_macro = { path = "ktest_macro" }
|
||||
log = "0.4"
|
||||
|
|
|
@ -15,8 +15,10 @@ fn calc_start_of_page(ptr: u64) -> u64 {
|
|||
panic!("unaligned");
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Memory {
|
||||
// TODO: map page aligned segments of memory into a table or some sort here
|
||||
logger: hbvm::mem::InstrLogger,
|
||||
}
|
||||
|
||||
impl Memory {
|
||||
|
@ -56,4 +58,11 @@ impl hbvm::mem::Memory for Memory {
|
|||
unsafe fn prog_read<T: Copy>(&mut self, addr: Address) -> T {
|
||||
(addr.get() as *const T).read()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn log_instr(&mut self, at: Address, regs: &[hbvm::value::Value]) {
|
||||
//log::debug!("exec: [{:02x}] {}", at.get(), unsafe {
|
||||
// self.logger.display_instr(at, regs)
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ impl ExecThread {
|
|||
|
||||
pub unsafe fn new(program: &[u8], entrypoint: Address) -> Self {
|
||||
let mut vm = Vm::new(
|
||||
mem::Memory {},
|
||||
mem::Memory::default(),
|
||||
Address::new(program.as_ptr() as u64 + entrypoint.get()),
|
||||
);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
test := fn(): uint {
|
||||
target := "abcdefghijklmnop"
|
||||
strings := .["abcdefshijklmnop", "abcdefghijklnnop", "abcdefshijklmnop", "abcdefghijklmnop", "abcdefghijflmnop", "dbcdefghijklmnop", "abcdefghijklmnop"]
|
||||
len := @sizeof(@TypeOf(strings)) / @sizeof(^u8)
|
||||
len := @sizeof(@TypeOf(strings)) / @sizeof([]u8)
|
||||
|
||||
// hasher := hashers.foldhash.FoldHasher.new(1)
|
||||
hasher := hashers.foldhash.FoldHasher.default()
|
||||
|
|
Loading…
Reference in a new issue