Basic header file for kernel-mode programming
This header file will be included automatically by default.h
if you define the global preprocessor symbol USE_KERNEL
.
First, this header file defines a global symbol named DOORS
which is used
in other header files to indicate kernel mode.
Next, it includes default.h to make
sure that the basic macros which TIGCC needs are defined. It also includes
a header file called romsymb.h
, which overrides some definitions
from default.h by referring to external
_ROM_CALL_xxx
symbols which are converted by the linker.
It contains code for tigcc.a
, to support RETURN_VALUE
.
Finally, it contains some rather complicated macros and asm
statements
to put data needed for RETURN_VALUE
directly into the assembly file.
See also: How to make a kernel-based program, default.h, nostub.h
#define _ram_call_addr(ind) (&_RAM_CALL_##ind) |
Performs a kernel-mode RAM call.
_ram_call_addr returns a void pointer to the location in memory defined by the kernel as RAM call ind.
#define _ram_call(ind,type) ((type)(&_RAM_CALL_##ind)) |
Performs a kernel-mode RAM call with a cast.
_ram_call uses _ram_call_addr to get a void pointer to the location in memory defined by the kernel as RAM call ind, and then casts it to the type type. To avoid prescan of ind, _ram_call_addr is written out.