about summary refs log tree commit diff stats
path: root/subx/010---vm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/010---vm.cc')
-rw-r--r--subx/010---vm.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/subx/010---vm.cc b/subx/010---vm.cc
index 3cad468f..b543216f 100644
--- a/subx/010---vm.cc
+++ b/subx/010---vm.cc
@@ -218,9 +218,16 @@ inline int32_t* mem_addr_i32(uint32_t addr) {
   return reinterpret_cast<int32_t*>(mem_addr_u32(addr));
 }
 // helper for some syscalls. But read-only.
-inline const char* mem_addr_string(uint32_t addr) {
+inline const char* mem_addr_kernel_string(uint32_t addr) {
   return reinterpret_cast<const char*>(mem_addr_u8(addr));
 }
+inline string mem_addr_string(uint32_t addr, uint32_t size) {
+  ostringstream out;
+  for (int i = 0;  i < size;  ++i)
+    out << read_mem_u8(addr+i);
+  return out.str();
+}
+
 
 inline void write_mem_u8(uint32_t addr, uint8_t val) {
   uint8_t* handle = mem_addr_u8(addr);