KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
exports.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  kos/exports.h
4  Copyright (C)2003 Dan Potter
5 
6 */
7 
8 /** \file kos/exports.h
9  \brief Kernel exported symbols support.
10 
11  This file contains support related to dynamic linking of the kernel of KOS.
12  The kernel (at compile time) produces a list of exported symbols, which can
13  be looked through using the funtionality in this file.
14 
15  \author Dan Potter
16 */
17 
18 #ifndef __KOS_EXPORTS_H
19 #define __KOS_EXPORTS_H
20 
21 #include <sys/cdefs.h>
22 __BEGIN_DECLS
23 
24 #include <arch/types.h>
25 
26 /** \brief A single export symbol.
27 
28  This structure holds a single symbol that has been exported from the kernel.
29  These will be patched into loaded ELF binaries at load time.
30 
31  \headerfile kos/exports.h
32 */
33 typedef struct export_sym {
34  const char * name; /**< \brief The name of the symbol. */
35  ptr_t ptr; /**< \brief A pointer to the symbol. */
36 } export_sym_t;
37 
38 /** \cond */
39 /* These are the platform-independent exports */
40 extern export_sym_t kernel_symtab[];
41 
42 /* And these are the arch-specific exports */
43 extern export_sym_t arch_symtab[];
44 /** \endcond */
45 
46 #ifndef __EXPORTS_FILE
47 #include <kos/nmmgr.h>
48 
49 /** \brief A symbol table "handler" for nmmgr.
50  \headerfile kos/exports.h
51 */
52 typedef struct symtab_handler {
53  struct nmmgr_handler nmmgr; /**< \brief Name manager handler header */
54  export_sym_t * table; /**< \brief Location of the first entry */
56 #endif
57 
58 /** \brief Setup initial kernel exports.
59  \retval 0 On success
60  \retval -1 On error
61 */
62 int export_init();
63 
64 /** \brief Look up a symbol by name.
65  \param name The symbol to look up
66  \return The export structure, or NULL on failure
67 */
68 export_sym_t * export_lookup(const char * name);
69 
70 __END_DECLS
71 
72 #endif /* __KOS_EXPORTS_H */
73 
Common integer types.
export_sym_t * table
Location of the first entry.
Definition: exports.h:54
export_sym_t * export_lookup(const char *name)
Look up a symbol by name.
Name handler interface.
Definition: nmmgr.h:52
ptr_t ptr
A pointer to the symbol.
Definition: exports.h:35
A single export symbol.
Definition: exports.h:33
A symbol table "handler" for nmmgr.
Definition: exports.h:52
uint32 ptr_t
Pointer arithmetic type.
Definition: types.h:47
const char * name
The name of the symbol.
Definition: exports.h:34
Name manager.
struct nmmgr_handler nmmgr
Name manager handler header.
Definition: exports.h:53
struct symtab_handler symtab_handler_t
A symbol table "handler" for nmmgr.
int export_init()
Setup initial kernel exports.
struct export_sym export_sym_t
A single export symbol.