mirror of
https://github.com/icicle-emu/icicle-python
synced 2026-06-21 13:53:41 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2d2f46a54 | |||
| e9c03d562f | |||
| 8acc071b8a |
Generated
+1
-1
@@ -424,7 +424,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icicle-python"
|
||||
version = "0.0.5"
|
||||
version = "0.0.10"
|
||||
dependencies = [
|
||||
"icicle-cpu",
|
||||
"icicle-vm",
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ exclude = ["icicle-emu"]
|
||||
|
||||
[package]
|
||||
name = "icicle-python"
|
||||
version = "0.0.5"
|
||||
version = "0.0.10"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -104,6 +104,12 @@ class Icicle:
|
||||
|
||||
sp: int
|
||||
|
||||
"""
|
||||
Physical memory capacity in pages (adjust when seeing OutOfMemory)
|
||||
The default limit is set so that the maximum corresponds to ~400 MB of host memory.
|
||||
"""
|
||||
mem_capacity: int
|
||||
|
||||
# TODO: API to get memory information?
|
||||
|
||||
def mem_map(self, address: int, size: int, protection: MemoryProtection): ...
|
||||
@@ -146,7 +152,7 @@ class MemoryException(Exception):
|
||||
self.code = code
|
||||
|
||||
def __str__(self):
|
||||
return f"{super().__str__()}: {self.code}"
|
||||
return f"{super().__str__()} ({self.code})"
|
||||
|
||||
def __ghidra_init():
|
||||
import os
|
||||
|
||||
+18
@@ -312,6 +312,24 @@ impl Icicle {
|
||||
self.vm.cpu.write_reg(self.vm.cpu.arch.reg_sp, address)
|
||||
}
|
||||
|
||||
#[getter]
|
||||
pub fn get_mem_capacity(&self) -> usize {
|
||||
self.vm.cpu.mem.capacity()
|
||||
}
|
||||
|
||||
#[setter]
|
||||
pub fn set_mem_capacity(&mut self, capacity: usize) -> PyResult<()> {
|
||||
if self.vm.cpu.mem.set_capacity(capacity) {
|
||||
return Ok(());
|
||||
}
|
||||
Err(
|
||||
raise_MemoryException(
|
||||
format!("Reducing memory capacity is not supported"),
|
||||
MemError::Unknown,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
#[new]
|
||||
#[pyo3(signature = (
|
||||
architecture,
|
||||
|
||||
Reference in New Issue
Block a user