summaryrefslogtreecommitdiffhomepage
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/.keep0
-rw-r--r--sample/asm/exit_nekernel_abi.asm10
-rw-r--r--sample/asm/return_5_rax.asm4
-rw-r--r--sample/cxx/example.cc16
4 files changed, 30 insertions, 0 deletions
diff --git a/sample/.keep b/sample/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/sample/.keep
diff --git a/sample/asm/exit_nekernel_abi.asm b/sample/asm/exit_nekernel_abi.asm
new file mode 100644
index 0000000..a97252f
--- /dev/null
+++ b/sample/asm/exit_nekernel_abi.asm
@@ -0,0 +1,10 @@
+#bits 64
+#org 0x40000000
+
+public_segment .code64 __ImageStart
+ xor rax, rax
+ mov rcx, 1 ;; syscall id
+ mov rdx, 0 ;; arg1
+ syscall ;; exit
+ mov rax, rbx
+ ret \ No newline at end of file
diff --git a/sample/asm/return_5_rax.asm b/sample/asm/return_5_rax.asm
new file mode 100644
index 0000000..82c0320
--- /dev/null
+++ b/sample/asm/return_5_rax.asm
@@ -0,0 +1,4 @@
+public_segment .code64 __ImageStart
+ ;; rax is the return value register.
+ mov rax, 5
+ ret \ No newline at end of file
diff --git a/sample/cxx/example.cc b/sample/cxx/example.cc
new file mode 100644
index 0000000..9ee2a30
--- /dev/null
+++ b/sample/cxx/example.cc
@@ -0,0 +1,16 @@
+#define main __ImageStart
+#warning test macro warning #1
+
+int bar() {
+ int yyy = 100;
+ return yyy;
+}
+
+int foo() {
+ int arg1 = 0;
+ return bar();
+}
+
+int main() {
+ return foo();
+}