Commit Graph

273 Commits

Author SHA1 Message Date
Xiang Xiao 2d794f4102 Configuration: Auto-select CONFIG_BUILD_LOADABLE when either CONFIG_BUILD_KERNEL or CONFIG_BINFMT_LOADABLE is selected. 2019-09-30 06:57:16 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt 2925c28f8f All linker scripts: Preface all _edata defininitions with . = ALIGN(4). Otherwise, the last bytes in the .data section may not be initialized properly. Also convert all linker scripts indent in units of 8-spaces to units of 4-spaces. 2019-09-15 17:22:16 -06:00
Gregory Nutt 254a906409 libs/libc/builtin/: builtint_isavail() should not set the errno variable because this functions may be used by internal OS logic for which setting the rrno variable would be inappropriate. 2019-09-11 12:37:29 -06:00
Michael Jung 4227d2aaa5 binfmt/: Fix FLAT build with BUILTIN support. Fixes problems introduced in a recent commit. 2019-08-25 08:58:30 -06:00
Gregory Nutt dd97fb991b This commit moves shared builtin information out of binfmt/libbuiltin and into libs/libc/builtin where it can be shared. This should permit builtin application in the PROTECTED build where binfmt/libbuiltin is not available in user space.
Squashed commit of the following:

    Correct some additional compile-related issues.

    Move  include/nuttx/binfmt/builtin.h to include/nuttx/lib/builtin.h.  Move apps/builtin/lib_builtin_forindex.c to libs/libc/builtin/lib_builtin_forindex.c.

    Move binfmt/libbuiltin to libs/libc/builtin.  There are calls made directly from apps/nshlib into this logic and hence, must be part of a library that can be shared between the OS and applications.
2019-08-23 09:07:40 -06:00
Pavel Pisa 04f0ee5198 binfmt/: Change debug macro from berr() to binfo() when dumping module data. The report of problems is important during development but when it enables complete informative output about load binaries then the important information can be easily overlooked. The huge output sent to serial terminal slows loading significantly as well. 2019-08-15 14:41:42 -06:00
Gregory Nutt 721994846c tools/: Change preferred argument of configurations tools to use ':' as the delimiter between <board-name> and <config-name>. This is to emphasize that this is not a path; it is configuration specification.
The legacy '/' delimiter is still supported but not recommend and not advertised.

Squashed commit of the following:

    Update configurations instructions in more README.txt files to show ':' delimiter vs '/' delimiter.
    Update configurations instructions in various README.txt file to show ':' delimiter vs '/' delimiter.
    tools:  Update all configuration-related tools to accept ':' separator between board and configuration name.
2019-08-05 16:55:51 -06:00
Gregory Nutt da1a561b6e binfmt/libelf/libelf_bind.c: Make naming of internal type compliant with coding standard. Yes, the ELF32 types do not follow the standard for historical reasons (and will be fixed someday), but let's not perpetuate the naming violation. 2019-03-20 09:34:08 -06:00
Xiang Xiao 64252a298f arch/: Unify the cache interface for all architectures 2019-03-19 10:37:13 -06:00
anchao 6e69dba341 binfmt/libelf/ and libs/libc/modlib: Add symbol buffer table to reduce filesystem access. 2019-03-19 09:13:50 -06:00
anchao 2f2d432f7c binfmt/libelf and libs/libc/modlib: Add relocation buffer table to reduce access fs. 2019-03-19 08:57:13 -06:00
Valmantas Palikša 956175d9b1 binfmt/libnxflat/libnxflat_init.c: File descriptor leaks when nxflat loading fails 2019-03-19 07:00:54 -06:00
Gregory Nutt ba859ad302 tools/nxstyle.c: Don't complain about certain lowercase characters in otherwise uppercase pre-processor identifers: IPv6, IPv4, ICMPv6, IGMPv2, p as a decimal point, d signifying a divisor. It was a bad idea to let the door open a crack for there. While they improve readability, the inconsistently also causes other problems. 2019-03-12 14:22:52 -06:00
Gregory Nutt 82b276a34c binfmt/nxflat.c: Trivial design simplification. 2019-03-12 10:09:03 -06:00
Gregory Nutt 622202da20 binfmt/nxflat.c: Update to last NxFLAT change: The logic must respect the reference count before freeing the dspace memory region. 2019-03-12 09:44:18 -06:00
Valmantas Palikša ba8714daac binfmt/nxflat.c: Correct a double free debug assertion. This occurs when groups are enabled: (1) once via binfmt_exit and unload_module, and (2) once via sched_releasetcb(). this was corrected by adding logic to free/unload the memory once and nullify the pointer so that cannot be freed a second time. This commit resolves Bitbucket issue #145. 2019-03-12 09:44:04 -06:00
Gregory Nutt a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt bb623d1e04 This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().
Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
2019-02-04 13:42:51 -06:00
Gregory Nutt c17145e550 Revert "binfmt/libelf/libelf_load.c: Remove the guard(CONFIG_BUILD_KERNEL) for umm_initialize()"
This commit has to be reverted because it causes errors in build testing.

This reverts commit b9c7a9a18f.
2019-02-03 18:08:46 -06:00
Xiang Xiao b9c7a9a18f binfmt/libelf/libelf_load.c: Remove the guard(CONFIG_BUILD_KERNEL) for umm_initialize() 2019-01-28 06:19:48 -06:00
Gregory Nutt 78c8485b0d Fix some warnings found in build testing. 2019-01-27 17:23:01 -06:00
Gregory Nutt 6e64b05ef3 Update some Kconfig comments. 2019-01-26 13:34:01 -06:00
Xiang Xiao b7f958a02e binfmt/, binfmt/libelf: binfmt/elf: Call umm_initialize as soon as possible otherwise elf_loadctors/elf_loaddtors will fail to allocate memory. 2019-01-26 11:36:38 -06:00
Xiang Xiao 0edcd6b85e binfmt/libelf, libs/libc/modlib: Optimize elf load speed: (1) Don't zero out memory, (2) Reduce the initial buffer size to 32 bytes. 2019-01-26 11:34:40 -06:00
Xiang Xiao 264a7164bc binfmt/: If there is an address environment (CONFIG_ARCH_ADDRENV), binfmt/elf doesn't need to free ctor/dtor alloc since freeing the address environment releases the heap automatically. 2019-01-26 11:29:08 -06:00
Xiang Xiao 38ffb98f1b Kconfig files, binfmt/libelf, libs/libc/machin, libs/libxx: Correct libcxx exception handling by introducing the generic config(CXX_EXCEPTION and CXX_LIBSUPCXX) 2019-01-26 11:23:31 -06:00
Xiang Xiao 095e28d45e binfmt/, binfmt/libelf/, include/nuttx, libs/libc/machine, libs/libc/modlib, and others: Move elf related arch function to include/nuttx/elf.h because the implementation is located in libs/libc/machine and in order to avoid the conflict with the 3rd party libraries and clean up the file inclusion: (1) Remove redundant elf32.h, (2) Remove nuttx/binfmt/elf.h in libs/libc/machine, (2) Remove nuttx/binfmt/elf.h in modlib, and (4) Rmove nuttx/module.h in modlib. 2019-01-26 11:18:45 -06:00
nchao 6509a0c0ca binfmt/ and libs/libc: Make exepath_*() more common:
1. Move exepath_*() related code to libc/misc
  1. Rename exepath_ to envpath_
  2. Rename BINFMT_EXEPATH to LIB_ENVPATH

libs/libc/modlib:  Add pre module library symbol table support
2018-11-08 07:27:14 -06:00
Gregory Nutt a83b6d990b Replace callse to ioctl() in the OS to file_ioctl() 2018-09-15 11:47:24 -06:00
Gregory Nutt a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
Gregory Nutt 9546481054 Fix some typographical errors. 2018-09-14 06:55:45 -06:00
Gregory Nutt e90f0403a6 binfmt/: Mostly cosmetic changes from review of a previous commit. 2018-08-24 06:10:50 -06:00
Gregory Nutt 2722fd8192 tools/nxstyle.c: Add capability to detect multiple blank lines. Single spacing required by the coding standard. Also coding standard fixes to server .c files for problems found during testing nxstyle. 2018-08-24 05:51:44 -06:00
Xiang Xiao 86eef8ce3a mm/: add mm_heapmember function and reimplement kmm_heapmember base on mm_heapmember since this function is very useful if multiple heaps exist. 2018-08-23 09:38:49 -06:00
Xiang Xiao 377eb30129 binfmt: Add binfmt_initialize(). All binary formats are now registered centrally vs. in board-specific logic. This simplifies the usage of the binfmt subsystem. 2018-08-23 09:09:39 -06:00
Gregory Nutt 2edfe7ed42 Revert "binfmt/elf: Set elf tcb priority level to default"
This reverts commit 1137927bd7.

Superceded by commit f1b5a80ae9
2018-08-22 08:35:52 -06:00
anchao f1b5a80ae9 binfmt/elf: Set priority level to default if parent has no priority. 2018-08-22 07:20:24 -06:00
anchao 1137927bd7 binfmt/elf: Set elf tcb priority level to default 2018-08-22 07:16:52 -06:00
Gregory Nutt 4becaea8e3 This commit extends support for the two-pass build. Its primary purpose is to incorporate source logic generated by applications into the kernel phase of the build.
In the two pass build, the application logic is built during the first phase, pass 1.  In that phase, the application may generate and install source files in the pass1/directory.  The operating system is built during phase 2 of the build.  At that time, those source files in the pass1/ directory will be built and incorporated into the kernel address space.

The primary purpose of the pass1/ directory is to such application-generated kernel symbol tables.  For an example of the use of this feature, look at apps/examples/module/drivers/Makefile.  Kernel symbol tables are needed to support kernel modules.  Of course, addition board-specific logic in, say, configs/<board>/src would have to be included to make use of the application-installed symbol tables.
2018-08-07 08:31:00 -06:00
Gregory Nutt 20a86dfc1b binfmt/ and sched/group: Re-architect the way that loadable ELF or NXFLAT modules are unloaded. Memory resources must be recovered when the task loaded into memory exits. The originmal implementatino used the death-of-child SIGCHLD signal to perform the unload. There are several problems with this: It is overly complex, it requires that the parent task stay resident while the loaded task runs, and it has fatal logic flaws in the protected and kernel model builds because the user signal handler attempts to run in the kernel address space. This commit corrects with using a mindlessly simply BINFMT callback when the task exits. 2018-08-05 08:09:54 -06:00
Masayuki Ishikawa 8ec22e916e Merged in masayuki2009/nuttx.nuttx/refactor_binfmt_exec (pull request #697)
binfmt: Refactor binfmt_exec.c

This change also fixes an argv issue for CONFIG_SCHED_ONEXIT=n
or CONFIG_SCHED_HAVE_PARENT=n

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-07-26 13:40:28 +00:00
Gregory Nutt 2553df7edc binfmt/binfmt_execsymtab.c: Fix a recently introduced error: The size of the symbol table is now an 'int' variable; but a variable cannot be used as an initializer because it is not constant. Also updates a README file. 2018-07-17 10:34:56 -06:00
Gregory Nutt a3f80e1894 binfmt/binfmt_execsymtab.c: Fix a typo in a configuration variable name. 2018-07-16 12:15:09 -06:00
Gregory Nutt 4c67062457 Squashed commit of the following:
binfmt/, libs/libc/unistd, and others:  Rename CONFIG_EXECFUNCS_SYMTAB to CONFIG_EXECFUNCS_SYMTAB_ARRAY.  Rename CONFIG_EXECFUNCS_NSYMBOLS to CONFIG_EXECFUNCS_NSYMBOLS_VAR.  Unlike CONFIG_EXECFUNCS_NSYMBOLS, CONFIG_EXECFUNCS_NSYMBOLS_VAR holds the name of an 'int' variable that contains the number of symbols in the symbol table.

    configs/sama5d4-ek:  Partial update to knsh build instructions.
2018-07-15 11:20:37 -06:00
Gregory Nutt 664af2a69b Default for CONFIG_EXECFUNCS_HAVE_SYMTAB should be 'not set' 2018-07-13 14:56:45 -06:00
Alan Carvalho de Assis 283b73edc5 Fix lots of typos in C comments and Kconfig help text 2018-07-08 18:24:45 -06:00
Gregory Nutt 8b4b61f140 fs/cromfs: Fix a error in reading partial compressed blocks. The LZF decompressor does not support that operation. Instead we have to decompress full block into a temporary buffer and copy out the parts that we need. To compensate for the performance hit, a caching mechanism was added so that we do not have to read the same block repeatedly. Unrelated: Also updates some README files. 2018-03-24 11:30:35 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt a096bc1266 binfmt/: Fix one more inappropriate access to the errno variable. 2018-02-01 08:33:04 -06:00