This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-10-08 00:00:00 +00:00
parent 58fc9624c6
commit a6c31c4e73

View File

@@ -1275,7 +1275,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#memory-leaks">21.5.2. Memory leaks</a></li>
</ul>
</li>
<li><a href="#userland-content-bibliography">21.6. Userland content bibliography</a></li>
<li><a href="#interpreted-languages">21.6. Interpreted languages</a></li>
<li><a href="#node-js">21.7. Node.js</a></li>
<li><a href="#userland-content-bibliography">21.8. Userland content bibliography</a></li>
</ul>
</li>
<li><a href="#userland-assembly">22. Userland assembly</a>
@@ -3404,7 +3406,7 @@ cd userland
--arch aarch64 \
--qemu-which host \
--userland-build-id host \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -3452,7 +3454,7 @@ cd userland
--gcc-which host \
--qemu-which host \
--userland-build-id host \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -5635,7 +5637,7 @@ el0_svc+0x8/0xc</pre>
</div>
<div class="literalblock">
<div class="content">
<pre>./run-gdb --gdbserver --userland userland/c/print_argv.c main</pre>
<pre>./run-gdb --gdbserver --userland userland/c/command_line_arguments.c main</pre>
</div>
</div>
<div class="paragraph">
@@ -7031,13 +7033,13 @@ sudo ./setup -y</pre>
<div class="sect2">
<h3 id="qemu-user-mode-getting-started"><a class="anchor" href="#qemu-user-mode-getting-started"></a><a class="link" href="#qemu-user-mode-getting-started">10.1. QEMU user mode getting started</a></h3>
<div class="paragraph">
<p>Let&#8217;s run <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/userland/c/print_argv.c">userland/c/print_argv.c</a> built with the Buildroot toolchain on QEMU user mode:</p>
<p>Let&#8217;s run <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/userland/c/command_line_arguments.c">userland/c/command_line_arguments.c</a> built with the Buildroot toolchain on QEMU user mode:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>./build user-mode-qemu
./run \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args='asdf "qw er"' \
;</pre>
</div>
@@ -7076,7 +7078,7 @@ qw er</pre>
<pre>./run \
--arch aarch64 \
--gdb-wait \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -7088,7 +7090,7 @@ qw er</pre>
<div class="content">
<pre>./run-gdb \
--arch aarch64 \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
main \
;</pre>
</div>
@@ -7101,7 +7103,7 @@ qw er</pre>
<pre>./run \
--arch aarch64 \
--gdb \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -7322,7 +7324,7 @@ qemu: uncaught target signal 6 (Aborted) - core dumped</pre>
./run \
--arch aarch64 \
--static \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -7454,7 +7456,7 @@ qemu-x86_64: /path/to/linux-kernel-module-cheat/submodules/qemu/accel/tcg/cpu-ex
./run \
--arch aarch64 \
--emulator gem5 \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;</pre>
</div>
@@ -7472,14 +7474,14 @@ qemu-x86_64: /path/to/linux-kernel-module-cheat/submodules/qemu/accel/tcg/cpu-ex
--emulator gem5 \
--gdb-wait \
--static \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
--userland-args 'asdf "qw er"' \
;
./run-gdb \
--arch aarch64 \
--emulator gem5 \
--static \
--userland userland/c/print_argv.c \
--userland userland/c/command_line_arguments.c \
main \
;</pre>
</div>
@@ -21020,7 +21022,10 @@ git -C "$(./getvar qemu_source_dir)" checkout -
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/userland/c/exit2.c">userland/c/exit2.c</a></p>
</li>
<li>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/userland/c/print_argv.c">userland/c/print_argv.c</a></p>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/userland/c/command_line_arguments.c">userland/c/command_line_arguments.c</a>: print one command line argument per line using <code>argc</code> and <code>argv</code>.</p>
<div class="paragraph">
<p>Good sanity check for user mode: <a href="#qemu-user-mode-getting-started">QEMU user mode getting started</a></p>
</div>
</li>
</ul>
</div>
@@ -21630,7 +21635,72 @@ echo 1 &gt; /proc/sys/vm/overcommit_memory
</div>
</div>
<div class="sect2">
<h3 id="userland-content-bibliography"><a class="anchor" href="#userland-content-bibliography"></a><a class="link" href="#userland-content-bibliography">21.6. Userland content bibliography</a></h3>
<h3 id="interpreted-languages"><a class="anchor" href="#interpreted-languages"></a><a class="link" href="#interpreted-languages">21.6. Interpreted languages</a></h3>
<div class="paragraph">
<p>Maybe some day someone will use this setup to study the performance of interpreters:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="#node-js">Node.js</a></p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="node-js"><a class="anchor" href="#node-js"></a><a class="link" href="#node-js">21.7. Node.js</a></h3>
<div class="paragraph">
<p>Parent section: <a href="#interpreted-languages">Interpreted languages</a>.</p>
</div>
<div class="paragraph">
<p>Install the interpreter with:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>./build-buildroot --config 'BR2_PACKAGE_NODEJS=y'</pre>
</div>
</div>
<div class="paragraph">
<p>TODO: broken as of 3c3deb14dc8d6511680595dc42cb627d5781746d + 1:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>ERROR: package host-nodejs installs executables without proper RPATH</pre>
</div>
</div>
<div class="paragraph">
<p>Examples:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>process</code></p>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/rootfs_overlay/lkmc/nodejs/command_line_arguments.js">rootfs_overlay/lkmc/nodejs/command_line_arguments.js</a></p>
</li>
</ul>
</div>
</li>
<li>
<p><code>fs</code></p>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/rootfs_overlay/lkmc/nodejs/file_write_read.js">rootfs_overlay/lkmc/nodejs/file_write_read.js</a></p>
</li>
<li>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js">rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js</a> Question: <a href="https://stackoverflow.com/questions/30441025/read-all-text-from-stdin-to-a-string" class="bare">https://stackoverflow.com/questions/30441025/read-all-text-from-stdin-to-a-string</a></p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="userland-content-bibliography"><a class="anchor" href="#userland-content-bibliography"></a><a class="link" href="#userland-content-bibliography">21.8. Userland content bibliography</a></h3>
<div class="ulist">
<ul>
<li>