Modules: Move last of many C files from sched/module to libc/modlib
This commit is contained in:
parent
6da66fb5c8
commit
86bdd0a4c7
@ -46,7 +46,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/module.h>
|
||||
#include <nuttx/lib/modlib.h>
|
||||
#include <nuttx/binfmt/symtab.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
@ -357,7 +357,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
||||
(FAR const struct boardioc_symtab_s *)arg;
|
||||
|
||||
DEBUGASSERT(symdesc != NULL);
|
||||
mod_setsymtab(symdesc->symtab, symdesc->nsymbols);
|
||||
modlib_setsymtab(symdesc->symtab, symdesc->nsymbols);
|
||||
ret = OK;
|
||||
}
|
||||
break;
|
||||
|
@ -189,8 +189,9 @@ struct mod_loadinfo_s
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
FAR const struct symtab_s *g_mod_symtab;
|
||||
FAR int g_mod_nsymbols;
|
||||
struct symtab_s;
|
||||
FAR const struct symtab_s *g_modlib_symtab;
|
||||
FAR int g_modlib_nsymbols;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
@ -227,6 +228,40 @@ int modlib_initialize(FAR const char *filename,
|
||||
|
||||
int modlib_uninitialize(FAR struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_getsymtab
|
||||
*
|
||||
* Description:
|
||||
* Get the current symbol table selection as an atomic operation.
|
||||
*
|
||||
* Input Parameters:
|
||||
* symtab - The location to store the symbol table.
|
||||
* nsymbols - The location to store the number of symbols in the symbol table.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void modlib_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_setsymtab
|
||||
*
|
||||
* Description:
|
||||
* Select a new symbol table selection as an atomic operation.
|
||||
*
|
||||
* Input Parameters:
|
||||
* symtab - The new symbol table.
|
||||
* nsymbols - The number of symbols in the symbol table.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void modlib_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_load
|
||||
*
|
||||
@ -247,7 +282,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo);
|
||||
*
|
||||
* Description:
|
||||
* Bind the imported symbol names in the loaded module described by
|
||||
* 'loadinfo' using the exported symbol values provided by mod_setsymtab().
|
||||
* 'loadinfo' using the exported symbol values provided by modlib_setsymtab().
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
@ -258,7 +293,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo);
|
||||
int modlib_bind(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_unload
|
||||
* Name: modlib_unload
|
||||
*
|
||||
* Description:
|
||||
* This function unloads the object from memory. This essentially undoes
|
||||
@ -275,7 +310,7 @@ int modlib_bind(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_unload(struct mod_loadinfo_s *loadinfo);
|
||||
int modlib_unload(struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_depend
|
||||
@ -319,21 +354,6 @@ int modlib_depend(FAR struct module_s *importer, FAR struct module_s *exporter);
|
||||
int modlib_undepend(FAR struct module_s *importer);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_verifyheader
|
||||
*
|
||||
* Description:
|
||||
* Given the header from a possible ELF executable, verify that it is
|
||||
* an ELF executable.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_verifyheader(FAR const Elf32_Ehdr *header);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_read
|
||||
*
|
||||
@ -350,47 +370,6 @@ int mod_verifyheader(FAR const Elf32_Ehdr *header);
|
||||
int modlib_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer,
|
||||
size_t readsize, off_t offset);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_symvalue
|
||||
*
|
||||
* Description:
|
||||
* Get the value of a symbol. The updated value of the symbol is returned
|
||||
* in the st_value field of the symbol table entry.
|
||||
*
|
||||
* Input Parameters:
|
||||
* modp - Module state information
|
||||
* loadinfo - Load state information
|
||||
* sym - Symbol table entry (value might be undefined)
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
* EINVAL - There is something inconsistent in the symbol table (should only
|
||||
* happen if the file is corrupted)
|
||||
* ENOSYS - Symbol lies in common
|
||||
* ESRCH - Symbol has no name
|
||||
* ENOENT - Symbol undefined and not provided via a symbol table
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_symvalue(FAR struct module_s *modp,
|
||||
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_freebuffers
|
||||
*
|
||||
* Description:
|
||||
* Release all working buffers.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_freebuffers(FAR struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_registry_lock
|
||||
*
|
||||
|
@ -57,44 +57,6 @@ extern "C"
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_getsymtab
|
||||
*
|
||||
* Description:
|
||||
* Get the current kernel symbol table selection as an atomic operation.
|
||||
*
|
||||
* Input Parameters:
|
||||
* symtab - The location to store the symbol table.
|
||||
* nsymbols - The location to store the number of symbols in the symbol table.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
|
||||
void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_setsymtab
|
||||
*
|
||||
* Description:
|
||||
* Select a new kernel symbol table selection as an atomic operation.
|
||||
*
|
||||
* Input Parameters:
|
||||
* symtab - The new symbol table.
|
||||
* nsymbols - The number of symbols in the symbol table.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
|
||||
void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: insmod
|
||||
*
|
||||
@ -102,7 +64,7 @@ void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
|
||||
* Verify that the file is an ELF module binary and, if so, load the
|
||||
* module into kernel memory and initialize it for use.
|
||||
*
|
||||
* NOTE: mod_setsymtab had to have been called in board-specific OS logic
|
||||
* NOTE: modlib_setsymtab had to have been called in board-specific OS logic
|
||||
* prior to calling this function from application logic (perhaps via
|
||||
* boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to
|
||||
* resolve symbols in the OS module.
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <dllfcn.h>
|
||||
|
||||
#include <nuttx/module.h>
|
||||
#include <nuttx/lib/modlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -71,7 +72,7 @@ int dlsymtab(FAR const struct symtab_s *symtab, int nsymbols)
|
||||
* module.
|
||||
*/
|
||||
|
||||
mod_setsymtab(symtab, nsymbols);
|
||||
modlib_setsymtab(symtab, nsymbols);
|
||||
return OK;
|
||||
|
||||
#elif defined(CONFIG_BUILD_PROTECTED)
|
||||
|
@ -39,7 +39,8 @@ ifeq ($(CONFIG_LIBC_MODLIB),y)
|
||||
|
||||
CSRCS += modlib_bind.c modlib_depend.c modlib_init.c modlib_iobuffer.c
|
||||
CSRCS += modlib_load.c modlib_read.c modlib_registry.c modlib_sections.c
|
||||
CSRCS += modlib_symbols.c modlib_uninit.c
|
||||
CSRCS += modlib_symbols.c modlib_symtab.c modlib_uninit.c modlib_unload.c
|
||||
CSRCS += modlib_verify.c
|
||||
|
||||
# Add the modlib directory to the build
|
||||
|
||||
|
@ -52,6 +52,21 @@
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_verifyheader
|
||||
*
|
||||
* Description:
|
||||
* Given the header from a possible ELF executable, verify that it is
|
||||
* an ELF executable.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int modlib_verifyheader(FAR const Elf32_Ehdr *header);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_findsymtab
|
||||
*
|
||||
@ -86,6 +101,33 @@ int modlib_findsymtab(FAR struct mod_loadinfo_s *loadinfo);
|
||||
int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
|
||||
FAR Elf32_Sym *sym);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_symvalue
|
||||
*
|
||||
* Description:
|
||||
* Get the value of a symbol. The updated value of the symbol is returned
|
||||
* in the st_value field of the symbol table entry.
|
||||
*
|
||||
* Input Parameters:
|
||||
* modp - Module state information
|
||||
* loadinfo - Load state information
|
||||
* sym - Symbol table entry (value might be undefined)
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
* EINVAL - There is something inconsistent in the symbol table (should only
|
||||
* happen if the file is corrupted)
|
||||
* ENOSYS - Symbol lies in common
|
||||
* ESRCH - Symbol has no name
|
||||
* ENOENT - Symbol undefined and not provided via a symbol table
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int modlib_symvalue(FAR struct module_s *modp,
|
||||
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_loadshdrs
|
||||
*
|
||||
@ -150,4 +192,18 @@ int modlib_allocbuffer(FAR struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
int modlib_reallocbuffer(FAR struct mod_loadinfo_s *loadinfo, size_t increment);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: modlib_freebuffers
|
||||
*
|
||||
* Description:
|
||||
* Release all working buffers.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int modlib_freebuffers(FAR struct mod_loadinfo_s *loadinfo);
|
||||
|
||||
#endif /* __LIBC_MODLIB_MODLIB_H */
|
||||
|
@ -150,7 +150,7 @@ static int modlib_relocate(FAR struct module_s *modp,
|
||||
|
||||
/* Get the value of the symbol (in sym.st_value) */
|
||||
|
||||
ret = mod_symvalue(modp, loadinfo, &sym);
|
||||
ret = modlib_symvalue(modp, loadinfo, &sym);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* The special error -ESRCH is returned only in one condition: The
|
||||
@ -217,7 +217,7 @@ static int modlib_relocateadd(FAR struct module_s *modp,
|
||||
*
|
||||
* Description:
|
||||
* Bind the imported symbol names in the loaded module described by
|
||||
* 'loadinfo' using the exported symbol values provided by mod_setsymtab().
|
||||
* 'loadinfo' using the exported symbol values provided by modlib_setsymtab().
|
||||
*
|
||||
* Input Parameters:
|
||||
* modp - Module state information
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include <nuttx/module.h>
|
||||
#include <nuttx/lib/modlib.h>
|
||||
|
||||
#include "modlib/modlib.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -181,13 +183,13 @@ int modlib_initialize(FAR const char *filename,
|
||||
|
||||
/* Verify the ELF header */
|
||||
|
||||
ret = mod_verifyheader(&loadinfo->ehdr);
|
||||
ret = modlib_verifyheader(&loadinfo->ehdr);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* This may not be an error because we will be called to attempt loading
|
||||
* EVERY binary. If mod_verifyheader() does not recognize the ELF header,
|
||||
* EVERY binary. If modlib_verifyheader() does not recognize the ELF header,
|
||||
* it will -ENOEXEC whcih simply informs the system that the file is not an
|
||||
* ELF file. mod_verifyheader() will return other errors if the ELF header
|
||||
* ELF file. modlib_verifyheader() will return other errors if the ELF header
|
||||
* is not correctly formed.
|
||||
*/
|
||||
|
||||
|
@ -287,6 +287,6 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
|
||||
/* Error exits */
|
||||
|
||||
errout_with_buffers:
|
||||
mod_unload(loadinfo);
|
||||
modlib_unload(loadinfo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_symvalue
|
||||
* Name: modlib_symvalue
|
||||
*
|
||||
* Description:
|
||||
* Get the value of a symbol. The updated value of the symbol is returned
|
||||
@ -331,8 +331,8 @@ int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_symvalue(FAR struct module_s *modp,
|
||||
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
|
||||
int modlib_symvalue(FAR struct module_s *modp,
|
||||
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
|
||||
{
|
||||
FAR const struct symtab_s *symbol;
|
||||
struct mod_exportinfo_s exportinfo;
|
||||
@ -400,11 +400,11 @@ int mod_symvalue(FAR struct module_s *modp,
|
||||
if (symbol == NULL)
|
||||
{
|
||||
#ifdef CONFIG_SYMTAB_ORDEREDBYNAME
|
||||
symbol = symtab_findorderedbyname(g_mod_symtab, exportinfo.name,
|
||||
g_mod_nsymbols);
|
||||
symbol = symtab_findorderedbyname(g_modlib_symtab, exportinfo.name,
|
||||
g_modlib_nsymbols);
|
||||
#else
|
||||
symbol = symtab_findbyname(g_mod_symtab, exportinfo.name,
|
||||
g_mod_nsymbols);
|
||||
symbol = symtab_findbyname(g_modlib_symtab, exportinfo.name,
|
||||
g_modlib_nsymbols);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/module/mod_symtab.c
|
||||
* libc/modlib/modlib_symtab.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -49,15 +49,15 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
FAR const struct symtab_s *g_mod_symtab;
|
||||
FAR int g_mod_nsymbols;
|
||||
FAR const struct symtab_s *g_modlib_symtab;
|
||||
FAR int g_modlib_nsymbols;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_getsymtab
|
||||
* Name: modlib_getsymtab
|
||||
*
|
||||
* Description:
|
||||
* Get the current kernel symbol table selection as an atomic operation.
|
||||
@ -71,20 +71,20 @@ FAR int g_mod_nsymbols;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
|
||||
void modlib_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
|
||||
{
|
||||
DEBUGASSERT(symtab != NULL && nsymbols != NULL);
|
||||
|
||||
/* Borrow the registry lock to assure atomic access */
|
||||
|
||||
modlib_registry_lock();
|
||||
*symtab = g_mod_symtab;
|
||||
*nsymbols = g_mod_nsymbols;
|
||||
*symtab = g_modlib_symtab;
|
||||
*nsymbols = g_modlib_nsymbols;
|
||||
modlib_registry_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_setsymtab
|
||||
* Name: modlib_setsymtab
|
||||
*
|
||||
* Description:
|
||||
* Select a new kernel symbol table selection as an atomic operation.
|
||||
@ -98,12 +98,12 @@ void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
|
||||
void modlib_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
|
||||
{
|
||||
/* Borrow the registry lock to assure atomic access */
|
||||
|
||||
modlib_registry_lock();
|
||||
g_mod_symtab = symtab;
|
||||
g_mod_nsymbols = nsymbols;
|
||||
g_modlib_symtab = symtab;
|
||||
g_modlib_nsymbols = nsymbols;
|
||||
modlib_registry_unlock();
|
||||
}
|
@ -48,6 +48,7 @@
|
||||
#include <nuttx/lib/modlib.h>
|
||||
|
||||
#include "libc.h"
|
||||
#include "modlib/modlib.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -70,7 +71,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
|
||||
{
|
||||
/* Free all working buffers */
|
||||
|
||||
mod_freebuffers(loadinfo);
|
||||
modlib_freebuffers(loadinfo);
|
||||
|
||||
/* Close the ELF file */
|
||||
|
||||
@ -83,7 +84,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_freebuffers
|
||||
* Name: modlib_freebuffers
|
||||
*
|
||||
* Description:
|
||||
* Release all working buffers.
|
||||
@ -94,7 +95,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_freebuffers(struct mod_loadinfo_s *loadinfo)
|
||||
int modlib_freebuffers(struct mod_loadinfo_s *loadinfo)
|
||||
{
|
||||
/* Release all working allocations */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/module/mod_unload.c
|
||||
* libc/modlib/modlib_unload.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -42,16 +42,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/module.h>
|
||||
#include <nuttx/lib/modlib.h>
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_unload
|
||||
* Name: modlib_unload
|
||||
*
|
||||
* Description:
|
||||
* This function unloads the object from memory. This essentially undoes
|
||||
@ -64,17 +65,17 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_unload(struct mod_loadinfo_s *loadinfo)
|
||||
int modlib_unload(struct mod_loadinfo_s *loadinfo)
|
||||
{
|
||||
/* Free all working buffers */
|
||||
|
||||
mod_freebuffers(loadinfo);
|
||||
modlib_freebuffers(loadinfo);
|
||||
|
||||
/* Release memory holding the relocated ELF image */
|
||||
|
||||
if (loadinfo->textalloc != 0)
|
||||
{
|
||||
kmm_free((FAR void *)loadinfo->textalloc);
|
||||
lib_free((FAR void *)loadinfo->textalloc);
|
||||
}
|
||||
|
||||
/* Clear out all indications of the allocated address environment */
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/module/mod_verify.c
|
||||
* libc/modlib/modlib_verify.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,7 +45,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/module.h>
|
||||
#include <nuttx/lib/modlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Constant Data
|
||||
@ -61,7 +61,7 @@ static const char g_modmagic[EI_MAGIC_SIZE] =
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mod_verifyheader
|
||||
* Name: modlib_verifyheader
|
||||
*
|
||||
* Description:
|
||||
* Given the header from a possible ELF executable, verify that it
|
||||
@ -77,7 +77,7 @@ static const char g_modmagic[EI_MAGIC_SIZE] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mod_verifyheader(FAR const Elf32_Ehdr *ehdr)
|
||||
int modlib_verifyheader(FAR const Elf32_Ehdr *ehdr)
|
||||
{
|
||||
if (!ehdr)
|
||||
{
|
@ -37,11 +37,7 @@ ifeq ($(CONFIG_MODULE),y)
|
||||
|
||||
# OS module interfaces
|
||||
|
||||
CSRCS += mod_insmod.c mod_rmmod.c mod_modsym.c mod_symtab.c mod_modhandle.c
|
||||
|
||||
# Loadable module library
|
||||
|
||||
CSRCS += mod_unload.c mod_verify.c
|
||||
CSRCS += mod_insmod.c mod_rmmod.c mod_modsym.c mod_modhandle.c
|
||||
|
||||
# procfs support
|
||||
|
||||
|
@ -166,8 +166,8 @@ static void mod_dumpinitializer(mod_initializer_t initializer,
|
||||
* Verify that the file is an ELF module binary and, if so, load the
|
||||
* module into kernel memory and initialize it for use.
|
||||
*
|
||||
* NOTE: mod_setsymtab had to have been called in board-specific OS logic
|
||||
* prior to calling this function from application logic (perhaps via
|
||||
* NOTE: modlib_setsymtab() had to have been called in board-specific OS
|
||||
* logicprior to calling this function from application logic (perhaps via
|
||||
* boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to
|
||||
* resolve symbols in the OS module.
|
||||
*
|
||||
@ -284,7 +284,7 @@ FAR void *insmod(FAR const char *filename, FAR const char *modulename)
|
||||
return (FAR void *)modp;
|
||||
|
||||
errout_with_load:
|
||||
mod_unload(&loadinfo);
|
||||
modlib_unload(&loadinfo);
|
||||
(void)modlib_undepend(modp);
|
||||
errout_with_registry_entry:
|
||||
kmm_free(modp);
|
||||
|
Loading…
Reference in New Issue
Block a user