diff options
author | johannst <johannst@users.noreply.github.com> | 2024-12-20 22:36:06 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2024-12-20 22:36:06 +0000 |
commit | 7e758f4d684199c90ec1bb9107908e506bf736cf (patch) | |
tree | 8f3eeea9621197f92420ae7d81d98644134a789a /src/juicebox_asm/rt.rs.html | |
parent | b5935c796ab0b2c478b4480a0dfdacb8e0dfe40e (diff) | |
download | juicebox-asm-gh-pages.tar.gz juicebox-asm-gh-pages.zip |
deploy: 6cc2331c8ff8e7372cd6e9a339250a9d8b58a547gh-pages
Diffstat (limited to 'src/juicebox_asm/rt.rs.html')
-rw-r--r-- | src/juicebox_asm/rt.rs.html | 78 |
1 files changed, 2 insertions, 76 deletions
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 @@ <a href="#261" id="261">261</a> <a href="#262" id="262">262</a> <a href="#263" id="263">263</a> -<a href="#264" id="264">264</a> -<a href="#265" id="265">265</a> -<a href="#266" id="266">266</a> -<a href="#267" id="267">267</a> -<a href="#268" id="268">268</a> -<a href="#269" id="269">269</a> -<a href="#270" id="270">270</a> -<a href="#271" id="271">271</a> -<a href="#272" id="272">272</a> -<a href="#273" id="273">273</a> -<a href="#274" id="274">274</a> -<a href="#275" id="275">275</a> -<a href="#276" id="276">276</a> -<a href="#277" id="277">277</a> -<a href="#278" id="278">278</a> -<a href="#279" id="279">279</a> -<a href="#280" id="280">280</a> -<a href="#281" id="281">281</a> -<a href="#282" id="282">282</a> -<a href="#283" id="283">283</a> -<a href="#284" id="284">284</a> -<a href="#285" id="285">285</a> -<a href="#286" id="286">286</a> -<a href="#287" id="287">287</a> -<a href="#288" id="288">288</a> -<a href="#289" id="289">289</a> -<a href="#290" id="290">290</a> -<a href="#291" id="291">291</a> -<a href="#292" id="292">292</a> -<a href="#293" id="293">293</a> -<a href="#294" id="294">294</a> -<a href="#295" id="295">295</a> -<a href="#296" id="296">296</a> -<a href="#297" id="297">297</a> -<a href="#298" id="298">298</a> -<a href="#299" id="299">299</a> -<a href="#300" id="300">300</a> -<a href="#301" id="301">301</a></pre></div><pre class="rust"><code><span class="doccomment">//! Simple `mmap`ed runtime. +<a href="#264" id="264">264</a></pre></div><pre class="rust"><code><span class="doccomment">//! 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. </span><span class="kw">pub fn </span>disasm(<span class="kw-2">&</span><span class="self">self</span>) { <span class="macro">assert!</span>(<span class="self">self</span>.idx <= <span class="self">self</span>.len); - <span class="kw">let </span>code = <span class="kw">unsafe </span>{ core::slice::from_raw_parts(<span class="self">self</span>.buf, <span class="self">self</span>.idx) }; - - <span class="comment">// Create ndisasm process, which expects input on stdin. - </span><span class="kw">let </span><span class="kw-2">mut </span>child = <span class="kw">match </span>std::process::Command::new(<span class="string">"ndisasm"</span>) - .args([<span class="string">"-b64"</span>, <span class="string">"-"</span>]) - .stdin(std::process::Stdio::piped()) - .stdout(std::process::Stdio::piped()) - .spawn() - { - <span class="prelude-val">Ok</span>(child) => child, - <span class="prelude-val">Err</span>(err) <span class="kw">if </span>err.kind() == std::io::ErrorKind::NotFound => { - <span class="macro">println!</span>(<span class="string">"Runtime::disasm: ndisasm not found, skipping!"</span>); - <span class="kw">return</span>; - } - <span class="prelude-val">Err</span>(err) => { - <span class="macro">panic!</span>(<span class="string">"{:?}"</span>, err); - } - }; - - <span class="comment">// Write code to stdin of ndisasm. - </span><span class="kw">use </span>std::io::Write; - child - .stdin - .take() - .expect(<span class="string">"failed to take stdin"</span>) - .write_all(code) - .expect(<span class="string">"failed to write bytes to stdin"</span>); - - <span class="comment">// Wait for output from ndisasm and print to stdout. - </span><span class="macro">println!</span>( - <span class="string">"{}"</span>, - String::from_utf8_lossy( - <span class="kw-2">&</span>child - .wait_with_output() - .expect(<span class="string">"failed to get stdout"</span>) - .stdout - ) - ); + <span class="kw">crate</span>::disasm::disasm(<span class="kw">unsafe </span>{ core::slice::from_raw_parts(<span class="self">self</span>.buf, <span class="self">self</span>.idx) }); } <span class="doccomment">/// Reinterpret the block of code pointed to by `fn_start` as `F`. |