diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-28 14:33:48 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-28 14:33:48 +0200 |
| commit | 46badbe70a36bb3cb5d86bd9f33aa5481c9709b9 (patch) | |
| tree | 33f3759845a25c51cea5d92177a3f7ebd269f984 /sample | |
| parent | 0965112fb81ef3e04010197f68f743c98a7611ba (diff) | |
feat!: update the kernel codegen to output bit width and origin.
refactor!: refactor codebase, breaking changes.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'sample')
| -rw-r--r-- | sample/.keep | 0 | ||||
| -rw-r--r-- | sample/asm/exit_nekernel_abi.asm | 10 | ||||
| -rw-r--r-- | sample/asm/return_5_rax.asm | 4 | ||||
| -rw-r--r-- | sample/cxx/example.cc | 16 |
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(); +} |
