<< Back to Codezero API Reference
/* Structure to define kernel versioning and API information */
struct kernel_desc {
u16 rsrv;
u8 subid;
u8 id;
u16 gendate;
u16 date_rsrv;
u16 subsubver;
u8 subver;
u8 ver;
u32 supplier;
} __attribute__((__packed__));
/* Experimental KIP with non-standard offsets */
struct kip {
/* System descriptions */
u32 magic;
u16 version_rsrv;
u8 api_subversion;
u8 api_version;
u32 api_flags;
/* System call address fields */
u32 kmem_control;
u32 time;
u32 space_control;
u32 thread_control;
u32 ipc_control;
u32 map;
u32 ipc;
u32 kread;
u32 unmap;
u32 exchange_registers;
u32 thread_switch;
u32 schedule;
u32 getid;
u32 mutex_control;
u32 arch_syscall0;
u32 arch_syscall1;
u32 arch_syscall2;
/* UTCB address field */
u32 utcb;
struct kernel_desc kdesc;
} __attribute__((__packed__));
KIP is used for obtaining the address of thread-local UTCB address, the address of all Codezero system calls and general information about the microkernel such as kernel versioning and
API information.
Kernel interface page is a read-only page accessible from a fixed pre-defined virtual address.
It is implementation defined how this address is discovered at run-time.
KIP is accessed by libL4 during task initialization for obtaining the system call addresses
KIP has a UTCB field which contains the address of the UTCB for the currently running thread. This field is updated dynamically as each thread becomes runnable, and each thread accesses this field for obtaining a handle for its UTCB. As a result, each thread accesses its UTCB using an extra pointer dereference.
KIP may be referenced at any time for obtaining microkernel and
API versioning information.
Any other information from the kernel such as virtual and physical memory information may be obtained by an L4_KREAD system call, which will be replaced by the L4_CONTAINER_CONTROL system call with a similar purpose.
/*
* Returns address of kernel interface page, and sets api version and kernel id
* on the arguments obtained from the KIP
*/
static inline void *
l4_kernel_interface(unsigned int *api_version, unsigned int *api_flags,
unsigned int *kernel_id);