Kernel library
The kernel libraries are placed under lib/kernel/formosa
. The libraries implements the functions related to our custom CSRs and custom instructions. Note that the libraries will be compiled to *.bc
instead of commonly seen *.so
or *.a
.
We includes the linker script link.ld
and kernel entry start.S
in this directory as well. The linker scripts defines how the program layout on the memory and the start.S
inializes the GPU and jump to the kernel program. Specifically, the start.S
does the following steps: (link)
- Reset all the registers (
x0
~x31
) - Calculate the workitem local ID and store to
xcll*
CSRs - Read the trampoiline PC
- Read the address for kernel arguments and set to the first argument
- Jump to the trampoline
ecall
when the kernel returns from the trampoline