diff --git a/nasm/README.md b/nasm/README.md new file mode 100644 index 00000000..14e2e875 --- /dev/null +++ b/nasm/README.md @@ -0,0 +1,25 @@ +# Netwide Assembler + +This is the netwide assembler and it is meant to be used in the binary compatibility mode of unikraft. + +## Content +- sample_code.s: a sample assembly code file that can be assembled using nasm. +- usr/bin/nasm: the nasm binary +- lib/ & lib64/: the required libraries for nasm + +## Extract dynamic libraries +```../extract.sh usr/bin/nasm``` + +output: +``` +Copying /lib/x86_64-linux-gnu/libc.so.6 ... +Copying /lib64/ld-linux-x86-64.so.2 ... +``` + +## Run on linux +```nasm sample_code.s``` + +## Run on unikraft +```./run.sh -r ../dynamic-apps/nasm/ usr/bin/nasm sample_code.s``` + +This should generate the output file ```sample_code``` which is the assembled machine code generated by nasm. diff --git a/nasm/lib/x86_64-linux-gnu/libc.so.6 b/nasm/lib/x86_64-linux-gnu/libc.so.6 new file mode 100644 index 00000000..db27b090 Binary files /dev/null and b/nasm/lib/x86_64-linux-gnu/libc.so.6 differ diff --git a/nasm/lib64/ld-linux-x86-64.so.2 b/nasm/lib64/ld-linux-x86-64.so.2 new file mode 100755 index 00000000..3f3b4e0d Binary files /dev/null and b/nasm/lib64/ld-linux-x86-64.so.2 differ diff --git a/nasm/sample_code.s b/nasm/sample_code.s new file mode 100644 index 00000000..6141c4b5 --- /dev/null +++ b/nasm/sample_code.s @@ -0,0 +1,31 @@ +BITS 64 + +xor rax, rax +test rdi, rdi +jz end + +loop: +cmp byte [rdi], 0 +jz end + +xor rbx, rbx +mov bl, byte [rdi] +cmp bl, 0x5a +ja loop_end + +push rax +push rdi +mov rdi, rbx +mov rax, 0x403000 +call rax +pop rdi +mov byte [rdi], al +pop rax +inc rax + +loop_end: +inc rdi +jmp loop + +end: +ret diff --git a/nasm/usr/bin/nasm b/nasm/usr/bin/nasm new file mode 100755 index 00000000..1aa30adb Binary files /dev/null and b/nasm/usr/bin/nasm differ diff --git a/p7zip/7z b/p7zip/7z new file mode 100755 index 00000000..923adf57 Binary files /dev/null and b/p7zip/7z differ diff --git a/p7zip/7z.so b/p7zip/7z.so new file mode 100644 index 00000000..563c739e Binary files /dev/null and b/p7zip/7z.so differ diff --git a/p7zip/7zCon.sfx b/p7zip/7zCon.sfx new file mode 100755 index 00000000..c161bfef Binary files /dev/null and b/p7zip/7zCon.sfx differ diff --git a/p7zip/7za b/p7zip/7za new file mode 100755 index 00000000..2d87d054 Binary files /dev/null and b/p7zip/7za differ diff --git a/p7zip/7zr b/p7zip/7zr new file mode 100755 index 00000000..f8366562 Binary files /dev/null and b/p7zip/7zr differ diff --git a/p7zip/README.md b/p7zip/README.md new file mode 100644 index 00000000..b5bdc48e --- /dev/null +++ b/p7zip/README.md @@ -0,0 +1,49 @@ +# p7zip + +This is the p7zip compression utility that can be used with Unikraft bincompat mode. + +## Content + +- `lib/` & `lib64/`: required libs for p7zip +- `/7z`: the 7z main binary +- `7z.so`, `7za`, `7zCon.sfx`, `7zr`: different code modules for p7zip that will be used by 7z binary to perform different operations. + +## Extracting Dynamic Libraries + +```console +../extract.sh ./7z +``` + +## Running on Linux + +This will create a new archive called `archive.zip` and add the file `README.md` to it. + +```console +7z a archive.zip README.md +``` + +This will extract the archive: + +```console +7z x archive.zip +``` + +## Running on Unikraft + +This will create a new archive called `archive.zip` and add the file `README.md` to it. + +```console +./run.sh -r ../dynamic-apps/p7zip /7z a archive.zip README.md +``` + +This will extract an archive file called `archive.zip`. + +```console +./run.sh -r ../dynamic-apps/p7zip /7z x archive.zip +``` + +We can use this command to check that everything worked properly: + +```console +7z l archive.zip +``` diff --git a/p7zip/archive.zip b/p7zip/archive.zip new file mode 100644 index 00000000..bc7b3121 Binary files /dev/null and b/p7zip/archive.zip differ diff --git a/p7zip/lib/x86_64-linux-gnu/libc.so.6 b/p7zip/lib/x86_64-linux-gnu/libc.so.6 new file mode 100644 index 00000000..db27b090 Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libc.so.6 differ diff --git a/p7zip/lib/x86_64-linux-gnu/libdl.so.2 b/p7zip/lib/x86_64-linux-gnu/libdl.so.2 new file mode 100644 index 00000000..9e28eaed Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libdl.so.2 differ diff --git a/p7zip/lib/x86_64-linux-gnu/libgcc_s.so.1 b/p7zip/lib/x86_64-linux-gnu/libgcc_s.so.1 new file mode 100644 index 00000000..ea200bbd Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libgcc_s.so.1 differ diff --git a/p7zip/lib/x86_64-linux-gnu/libm.so.6 b/p7zip/lib/x86_64-linux-gnu/libm.so.6 new file mode 100644 index 00000000..68c32a34 Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libm.so.6 differ diff --git a/p7zip/lib/x86_64-linux-gnu/libpthread.so.0 b/p7zip/lib/x86_64-linux-gnu/libpthread.so.0 new file mode 100644 index 00000000..d545c0f2 Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libpthread.so.0 differ diff --git a/p7zip/lib/x86_64-linux-gnu/libstdc++.so.6 b/p7zip/lib/x86_64-linux-gnu/libstdc++.so.6 new file mode 100644 index 00000000..74866d67 Binary files /dev/null and b/p7zip/lib/x86_64-linux-gnu/libstdc++.so.6 differ diff --git a/p7zip/lib64/ld-linux-x86-64.so.2 b/p7zip/lib64/ld-linux-x86-64.so.2 new file mode 100755 index 00000000..3f3b4e0d Binary files /dev/null and b/p7zip/lib64/ld-linux-x86-64.so.2 differ