KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
exports.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 kos/exports.h
4 Copyright (C) 2003 Megan Potter
5 Copyright (C) 2024 Ruslan Rostovtsev
6
7*/
8
9/** \file kos/exports.h
10 \brief Kernel exported symbols support.
11 \ingroup system_libraries
12
13 This file contains support related to dynamic linking of the kernel of KOS.
14 The kernel (at compile time) produces a list of exported symbols, which can
15 be looked through using the functionality in this file.
16
17 \author Megan Potter
18 \author Ruslan Rostovtsev
19*/
20
21#ifndef __KOS_EXPORTS_H
22#define __KOS_EXPORTS_H
23
24#include <sys/cdefs.h>
25__BEGIN_DECLS
26
27#include <arch/types.h>
28#include <stdint.h>
29
30/** \addtogroup system_libraries
31 @{
32*/
33
34/** \brief A single export symbol.
35
36 This structure holds a single symbol that has been exported from the kernel.
37 These will be patched into loaded ELF binaries at load time.
38
39 \headerfile kos/exports.h
40*/
41typedef struct export_sym {
42 const char *name; /**< \brief The name of the symbol. */
43 uintptr_t ptr; /**< \brief A pointer to the symbol. */
45
46/** \cond */
47/* These are the platform-independent exports */
48extern export_sym_t kernel_symtab[];
49
50/* And these are the arch-specific exports */
51extern export_sym_t arch_symtab[];
52/** \endcond */
53
54#ifndef __EXPORTS_FILE
55#include <kos/nmmgr.h>
56
57/** \brief A symbol table "handler" for nmmgr.
58 \headerfile kos/exports.h
59*/
60typedef struct symtab_handler {
61 struct nmmgr_handler nmmgr; /**< \brief Name manager handler header */
62 export_sym_t *table; /**< \brief Location of the first entry */
64#endif
65
66/** \brief Setup initial kernel exports. */
67void export_init(void);
68
69/** \brief Look up a symbol by name.
70 \param name The symbol to look up
71 \return The export structure, or NULL on failure
72*/
73export_sym_t *export_lookup(const char *name);
74
75/** \brief Look up a symbol by name and Name Manager path.
76 \param name The symbol to look up
77 \param path The Name Manager path to look up
78 \return The export structure, or NULL on failure
79*/
80export_sym_t *export_lookup_path(const char *name, const char *path);
81
82/** \brief Look up a symbol by approx addr.
83 It can be useful for unhandled exceptions messages.
84 \param addr The symbol to look up
85 \return The export structure, or NULL on failure
86*/
88
89/** @} */
90
91__END_DECLS
92
93#endif /* __KOS_EXPORTS_H */
export_sym_t * export_lookup_path(const char *name, const char *path)
Look up a symbol by name and Name Manager path.
export_sym_t * export_lookup(const char *name)
Look up a symbol by name.
void export_init(void)
Setup initial kernel exports.
export_sym_t * export_lookup_addr(uintptr_t addr)
Look up a symbol by approx addr.
Name manager.
A single export symbol.
Definition exports.h:41
uintptr_t ptr
A pointer to the symbol.
Definition exports.h:43
const char * name
The name of the symbol.
Definition exports.h:42
A symbol table "handler" for nmmgr.
Definition exports.h:60
export_sym_t * table
Location of the first entry.
Definition exports.h:62
Common integer types.