Commit Graph

12702 Commits

Author SHA1 Message Date
Ryan Long
df3fa4e005 interr.h: Fix gcc 12 warning
The warning that this fixes states that "ISO C restricts enumerator values to
range of 'int'."

Updates #4662
2022-08-19 15:34:46 -05:00
Ryan Long
f930206724 linkersets.h: Fix gcc 12 warning
Changing the offset from 0 to 1 got rid of a warning stating that offset 0 is
out of bounds.

Updates #4662
2022-08-19 15:34:46 -05:00
Ryan Long
ec7d6c092f threads.h: Add pragmas to get rid of gcc 12 errors
Updates #4662
2022-08-19 15:34:46 -05:00
Joel Sherrill
36895bd2c5 cpukit/include/rtems/test-info.h: Change @returns to @return 2022-08-10 14:15:47 -05:00
Joel Sherrill
4b04589b09 Add support for CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
This adds the configure option CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
which allows the application to choose whether to have the POSIX
timer_create() function follow the behavior defined by POSIX or
the FACE Technical Standard.

Updates #4691.
2022-08-10 14:15:46 -05:00
Sebastian Huber
cf3d2b37c8 rtems/malloc.h: Add API level Doxygen group
The interfaces in the MallocSupport group belong to the implementation.  They
are used by confdefs.h for example.
2022-08-10 15:41:58 +02:00
Sebastian Huber
7219d3c0e9 libtest: Add T_report_hash_sha256_update()
Update #3716.
2022-08-10 07:51:14 +02:00
Ryan Long
5500232a89 libdl: Refactor shared code in ARM and AArch64
rtl-mdreloc-arm.c was used as the basis for rtl-mdreloc-aarch64.c. This lead
to some code being shared by the two files. The code was consolidated into
rtl-unwind-arm.c.

Closes #4686
2022-08-08 12:02:03 -05:00
Sebastian Huber
c3c4525a32 posix: Avoid dead code in clock_nanosleep()
This issue was reported by Coverity Scan for RTEMS:

CID 1507760: Control flow issues (DEADCODE)

Closes #4690.
2022-08-05 08:20:58 +02:00
Chris Johns
46131ce0e1 libdl: Fix warnings on 64bit architectures
Updates #4662
2022-08-05 07:54:13 +10:00
Sebastian Huber
c64c638f6d posix: Fix relative CLOCK_REALTIME sleep
A relative CLOCK_REALTIME time out shall not be affected by CLOCK_REALTIME
changes through clock_settime().  Since our CLOCK_REALTIME is basically just
CLOCK_MONOTONIC plus an offset, we can simply use the CLOCK_MONOTONIC watchdog
for relative CLOCK_REALTIME time outs.

Update #4690.
2022-08-04 07:55:30 +02:00
Chris Johns
071640d310 libmisc/shell: Add an 'rtems' command to report a running build
- Report version, cpu, bsp, tools and options.
2022-08-03 10:46:10 +10:00
Ryan Long
1c6ac88f93 cpukit/libdl/rtl-sym.c: Fix increment of variable
In rtems_rtl_symbol_global_add() the loop that gets to the end of the symbol
table used "unsigned long" to increment the index for the table. For most
architectures this resulted in 4, but with AArch64, it results in 8. This
resulted in the symbols being read in wrong. Changing this to void* along with
changing the RISC-V specific code for 8 byte pointers in rtems-tools to work
independent of the architecture.

Updates #4673
Closes #4682
2022-07-29 08:32:47 -05:00
Ryan Long
0bd6514aa2 cpukit/libdl: Add support for AArch64
rtl-mdreloc-aarch64.c and elf_machdep.h came from NetBSD.

Updates #4682
2022-07-29 08:32:47 -05:00
Ryan Long
f643215648 libdl/rtl-elf.h: Fix aarch64 define
The aarch64 define was incorrect. This was causing the libdl tests to not
work correctly.

Updates #4682
2022-07-29 08:32:47 -05:00
Ryan Long
ad94dc352e sys/exec_elf.h: Bring in newer file
Updated this file with the newer version in NetBSD.

Updates #4682
2022-07-29 08:32:47 -05:00
Sebastian Huber
6a6580331d score: Allow linker garbage collection
Place the object control blocks in dedicated sections to allow a linker garbage
collection.

Update #4678.
2022-07-28 08:21:57 +02:00
Sebastian Huber
8a864bc62c score: Use PTHREAD_CANCELED for _Thread_Cancel()
The rtems_task_delete() directive is basically just a combined pthread_cancel()
and pthread_join().  In addition, it removes the PTHREAD_DETACHED state.  The
exit value returned by pthread_join() of threads cancelled by
rtems_task_delete() should reflect this by getting a PTHREAD_CANCELED value
instead of NULL which could be a normal exit value.

Close #4680.
2022-07-28 07:53:04 +02:00
Sebastian Huber
31036f1dc8 score: Use priority inheritance for thread join
Threads may join the thread termination of another thread using the
pthread_join() or rtems_task_delete() directives.  The thread cancel operation
used a special case priority boosting mechanism implemented by
_Thread_Raise_real_priority().  The problem was that this approach

* is not transitive,

* does not account for priority adjustments of the calling task
  while waiting for the join,

* does not support clustered scheduling, and

* does not detect deadlocks.

All these problems are fixed by using a priority inheritance thread queue for
the join operation.

Close #4679.
2022-07-28 07:52:59 +02:00
Sebastian Huber
5810a08b57 Use __asm__ for standard C compatibility 2022-07-27 17:01:14 +02:00
Sebastian Huber
2501c64bb6 score: Fix objects local table initialization
The objects local table must be statically zero-initialized so that
_Objects_Get() and _Objects_Get_no_protection() return NULL if no object is
associated with the identifier.

Update #4678.
2022-07-27 08:59:45 +02:00
Sebastian Huber
7fe6d60bf0 score: Remove PRIORITY_PSEUDO_ISR thread priority
The uniprocessor schedulers had some special case logic for the
PRIORITY_PSEUDO_ISR priority.  Tasks with a priority of PRIORITY_PSEUDO_ISR
were allowed to preempt a not preemptible task.  If other higher priority task
are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible
task, then the other tasks run before the not preemptible task.  This made the
RTEMS_NO_PREEMPT mode ineffective.

Remove the PRIORITY_PSEUDO_ISR special case logic.  This simplifies the
uniprocessor schedulers.  Move the uniprocessor-specific scheduler support to
the new header file <rtems/score/scheduleruniimpl.h>.

Close #2365.
2022-07-26 11:26:22 +02:00
Sebastian Huber
8dc651f8fc imfs: Add <rtems/imfsimpl.h> 2022-07-25 16:11:36 +02:00
Sebastian Huber
e584ee4bde libtest: Add missing initializer 2022-07-25 10:02:18 +02:00
Kinsey Moore
10ef7087f6 aarch64: Use page table level 0
This alters the AArch64 page table generation and mapping code and MMU
configuration to use page table level 0 in addition to levels 1, 2, and
3. This allows the mapping of up to 48 bits of memory space and is the
maximum that can be mapped without relying on additional processor
extensions. Mappings are restricted based on the number of physical
address bits that the CPU supports.
2022-07-21 12:26:35 -05:00
Matt Joyce
6d4b390f99 Support _REENT_THREAD_LOCAL Newlib configuration
In case the Newlib _REENT_THREAD_LOCAL configuration option is enabled, the
struct _reent is not defined (there is only a forward declaration in
<sys/reent.h>).  Instead, the usual members of struct _reent are available as
dedicatd thread-local storage objects.

Update #4560.
2022-07-21 07:22:13 +02:00
Sebastian Huber
098186b9b3 dtc: Update VERSION 2022-07-19 09:28:22 +02:00
LoveSy
6f79435915 Fix a UB when fdt_get_string return null
When fdt_get_string return null, `namep` is not correctly reset.
From the document of `fdt_getprop_by_offset`, the parameter `namep` will
be always overwritten (that is, it will be overwritten without exception
of error occurance).

As for the caller (like
e097c097fe/native/jni/magiskboot/dtb.cpp (L42)),
the code may be like:
```cpp
size_t size;
const char *name;
auto *value = fdt_getprop_by_offset(fdt, prop, &name, &size);
```
and if `value == nullptr`, `size` is also be overwritten correctly but
`name` is not, which is quite inconsistent.

This commit makes sure `name` and `size` behavior consistently (reset to
reasonable value) when error occurs.

Signed-off-by: LoveSy <shana@zju.edu.cn>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-19 09:28:22 +02:00
Sebastian Huber
12a03bea4f score: Fix unlimited objects support
Commit 21275b58a5 ("score: Static
Objects_Information initialization") introduced an off-by-one error in the
maintenance of inactive objects.

Close #4677.
2022-07-18 09:33:16 +02:00
Sebastian Huber
e0942613f1 score: Fix _Objects_Active_count()
With unlimited objects the object maximum may be larger than the sum of active
and inactive objects.

Update #4677.
2022-07-18 09:33:16 +02:00
Sebastian Huber
1bf878f7ff score: Extend memory dirty/zero actions
Dirty or zero also the part of the .noinit section used by RTEMS.

Close #4678.
2022-07-15 10:46:02 +02:00
Sebastian Huber
4b911a7516 score: Place object controls into .noinit sections
Place the statically allocated object control blocks, local tables, and thread
queue heads into the dedicated .noinit intput sections.  The output section is
not zero initialized.  Placing these elements into the .noinit section reduces
the system initialization time by decreasing the .bss section size.

It may improve the cache efficiency since the mostly read local tables are
placed in a contiguous memory area.

Update #4678.
2022-07-15 10:46:02 +02:00
Gleb Smirnoff
388dd97e39 Add in_localip_fib(), in6_localip_fib().
Check if given address/FIB exists locally.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D32913
2022-07-11 13:28:10 +02:00
Gleb Smirnoff
94c33ba992 Use network epoch to protect local IPv4 addresses hash.
The modification to the hash are already naturally locked by
in_control_sx.  Convert the hash lists to CK lists. Remove the
in_ifaddr_rmlock. Assert the network epoch where necessary.

Most cases when the hash lookup is done the epoch is already entered.
Cover a few cases, that need entering the epoch, which mostly is
initial configuration of tunnel interfaces and multicast addresses.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D32584
2022-07-11 13:28:10 +02:00
Alexander V. Chernikov
7846249e1a routing: fix source address selection rules for IPv4 over IPv6.
Current logic always selects an IFA of the same family from the
 outgoing interfaces. In IPv4 over IPv6 setup there can be just
 single non-127.0.0.1 ifa, attached to the loopback interface.

Create a separate rt_getifa_family() to handle entire ifa selection
 for the IPv4 over IPv6.

Differential Revision: https://reviews.freebsd.org/D31868
MFC after:	1 week
2022-07-11 13:28:10 +02:00
John Baldwin
070f1b552c Remove copyinfrom() and copyinstrfrom().
These functions were added in 2001 and are currently unused.
copyinfrom() looks to have never been used.  copyinstrfrom() was used
for two weeks before the code was refactored to remove it's sole use.

Reviewed by:	brooks, kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24928
2022-07-11 13:28:10 +02:00
Sebastian Huber
e7d01e7803 rtems: Simplify rtems_scheduler_ident()
Use early returns to simplify rtems_scheduler_ident().
2022-07-07 08:48:26 +02:00
Sebastian Huber
80090639a6 score: Use RTEMS_SMP in _Thread_Create_idle()
Conditional expressions with inline functions are not optimized away if
optimization is disabled.  Avoid such expressions to prevent dead
branches.
2022-07-07 08:48:26 +02:00
Sebastian Huber
6e74cebb62 score: Conditional _Thread_Priority_replace()
This function is only used in SMP configurations.
2022-07-07 08:46:48 +02:00
Kinsey Moore
22015c0251 cpukit/aarch64: Remove _CPU_ISR_install_vector
This function was never actually used and is dead code.
2022-07-05 15:35:56 -05:00
Sebastian Huber
03e4d1e931 score: Add _CPU_Use_thread_local_storage()
At some point during system initialization, the idle threads are created.
Afterwards, the boot processor basically executes within the context of an idle
thread with thread dispatching disabled.  On some architectures, the
thread-local storage area of the associated thread must be set in dedicated
processor registers.  Add the new CPU port function to do this:

void _CPU_Use_thread_local_storage( const Context_Control *context )

Close #4672.
2022-07-04 08:30:42 +02:00
Sebastian Huber
7452f67dd9 gcov: Add wrapper to dump the gcov info
Update #4670.
2022-07-04 08:29:52 +02:00
Sebastian Huber
4f87edbb75 gcov: Add functions to dump the gcov information
Update #4670.
2022-07-04 08:29:52 +02:00
Sebastian Huber
2bc233fe58 gcov: Add fork(), etc. gcov wrappers
The compiler wraps fork(), etc. system calls if coverage generation is enabled.
These functions must be provided by the system.  For RTEMS, they just return an
error status.

Update #4670.
2022-07-04 08:29:52 +02:00
Sebastian Huber
39c09b3b3d riscv: Include missing header file 2022-06-24 13:15:00 +02:00
Sebastian Huber
ba56e23999 score: Account for <sys/bitset.h> API changes
Update #4667.
2022-06-23 10:29:31 +02:00
Sebastian Huber
a76988c881 score: Remove unused _Processor_mask_Nand()
Update #4667.
2022-06-23 10:29:31 +02:00
Sebastian Huber
5dffbc424e score: Make SMP only code explicit
Conditional expressions with inline functions are not optimized away if
optimization is disabled.  Avoid such expressions to prevent dead
branches.  It helps also during code review to immediately see if a loop
is used or not.
2022-06-23 10:28:49 +02:00
Sebastian Huber
94df3a7a6d kern_tc.c: Provide a weak hardpps() implementation
The real implementation of hardpps() is defined in kern_ntptime.c.  Use it only
if the NTP support is needed by the application.

Update #2349.
2022-06-23 09:47:48 +02:00
Sebastian Huber
cd50bea678 score: Use right clock for threadq timeouts
Use CLOCK_REALTIME and CLOCK_MONOTONIC for relative thread queue timeouts
instead of CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE.  This fixes an
issue with clock_nanosleep() in combination with clock_gettime().

Close #4669.
2022-06-23 09:20:11 +02:00