So, i have implemented a really simple syscall mechanism, which uses interrupts and has support for arguments and returns.
Trying to execute the syscalls inside the main.c file, from the kernel, results in expected things happening. Stuff prints, pixels are drawn, etc. So:
Code: Select all
sys_print_func("hello from a syscall"); // <--- this works
sys_draw_pixel_func(0, 0, red); // <--- this also works
Doing an objdump on the binary, i see something peculiar, mainly:
Disassembly of section .data:
Code: Select all
0000000000000000 <.data>:
0: 31 c0 xor %eax,%eax
2: 48 89 fa mov %rdi,%rdx
5: cd 10 int $0x10
7: c3 ret
I, however, am unsure on how to fix it.
The code can be found here:
program being ran and functions definitions for it:
https://github.com/theoriginalgrasshopp ... ernal/apps
the makefile and linker script for generating the binary can be found in this directory:
https://github.com/theoriginalgrasshopp ... R/external
the syscall code can be found in this file:
https://github.com/theoriginalgrasshopp ... c/syscalls
the way of executing, said binary (while temporary), can be found in this file
https://github.com/theoriginalgrasshopp ... e/binary.c
Regards,
qwr