From 7e758f4d684199c90ec1bb9107908e506bf736cf Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 20 Dec 2024 22:36:06 +0000 Subject: deploy: 6cc2331c8ff8e7372cd6e9a339250a9d8b58a547 --- src/juicebox_asm/rt.rs.html | 78 ++------------------------------------------- 1 file changed, 2 insertions(+), 76 deletions(-) (limited to 'src/juicebox_asm/rt.rs.html') diff --git a/src/juicebox_asm/rt.rs.html b/src/juicebox_asm/rt.rs.html index d138a8e..0bef785 100644 --- a/src/juicebox_asm/rt.rs.html +++ b/src/juicebox_asm/rt.rs.html @@ -262,44 +262,7 @@ 261 262 263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301
//! Simple `mmap`ed runtime.
+264
//! Simple `mmap`ed runtime.
 //!
 //! This runtime supports adding code to executable pages and turn the added code into user
 //! specified function pointer.
@@ -468,44 +431,7 @@
     /// the `ndisasm` child process.
     pub fn disasm(&self) {
         assert!(self.idx <= self.len);
-        let code = unsafe { core::slice::from_raw_parts(self.buf, self.idx) };
-
-        // Create ndisasm process, which expects input on stdin.
-        let mut child = match std::process::Command::new("ndisasm")
-            .args(["-b64", "-"])
-            .stdin(std::process::Stdio::piped())
-            .stdout(std::process::Stdio::piped())
-            .spawn()
-        {
-            Ok(child) => child,
-            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
-                println!("Runtime::disasm: ndisasm not found, skipping!");
-                return;
-            }
-            Err(err) => {
-                panic!("{:?}", err);
-            }
-        };
-
-        // Write code to stdin of ndisasm.
-        use std::io::Write;
-        child
-            .stdin
-            .take()
-            .expect("failed to take stdin")
-            .write_all(code)
-            .expect("failed to write bytes to stdin");
-
-        // Wait for output from ndisasm and print to stdout.
-        println!(
-            "{}",
-            String::from_utf8_lossy(
-                &child
-                    .wait_with_output()
-                    .expect("failed to get stdout")
-                    .stdout
-            )
-        );
+        crate::disasm::disasm(unsafe { core::slice::from_raw_parts(self.buf, self.idx) });
     }
 
     /// Reinterpret the block of code pointed to by `fn_start` as `F`.
-- 
cgit v1.2.3