Commit Graph

13065 Commits

Author SHA1 Message Date
Aaron Nyholm
c33ed55231 score/rbtree: install and use bsd-tree.h 2024-07-09 22:52:40 +00:00
Aaron Nyholm
b68ef66b49 score: Import <sys/tree.h> from Newlib
Import <sys/tree.h> from Newlib as <rtems/score/bsd-tree.h> using Newlib commit:

commit eb03ac17f16f1bd354482148426353fd35cd879d
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Tue Oct 5 15:53:47 2021 +0200

    sys/tree.h: Red child with black sibling rotations

    Add specialized rotations RB_RED_ROTATE_LEFT() and RB_RED_ROTATE_RIGHT() which
    may be used if we rotate a red child which has a black sibling.  Such a red
    node must have at least two child nodes so that the following red-black tree
    invariant is fulfilled:

      Every path from a given node to any of its descendant NULL nodes goes through
      the same number of black nodes.

          PARENT
         /      \
      BLACK     RED
               /   \
            BLACK BLACK

Close #5049.
2024-07-09 22:52:40 +00:00
xiaojun zheng
acf12498cf add rtems_counting_semaphore_wait_timed_ticks and rtems_counting_semaphore_try_wait for self-contained object counting semaphore
Closes #5055

## Summary
add rtems_counting_semaphore_wait_timed_ticks and rtems_counting_semaphore_try_wait for self-contained object counting semaphore.

1. rtems_counting_semaphore_wait_timed_ticks(rtems_counting_semaphore \*counting_semaphore,uint32_t ticks)
2. rtems_counting_semaphore_try_wait(rtems_counting_semaphore \*counting_semaphore)

close issue #5055.

<!-- Default settings, if it is a dropdown it will set after submission -->
2024-07-02 01:49:24 +00:00
Matheus Pecoraro
dd882e1291 x86_64: Fix ISR handler macros
Modify the ISR handler macros for the x86_64 arch to follow the behavior
expected of them
2024-07-01 17:48:46 +00:00
Matheus Pecoraro
e46135290a x86_64: Enable and add support for FP tasks 2024-07-01 17:48:25 +00:00
alessandronardin
cd4b6761ea cpukit/posix/aio*: Corrected aio_return() and aio_error() behaviour
Added field to the aio control block to track when a result is retrieved
and modified code accordingly.

Updated documentation for aio_return() and aio_error().
Updated test psxaio01 to make it compatible with specifications.

Closes #5039
2024-06-25 04:03:07 +00:00
Sebastian Huber
2953f4c6e3 rtems: Fatal error for rtems_cache_disable_data()
On some targets or configurations, the data cache cannot be disabled.
The data cache may be necessary to provide atomic operations.  In SMP
configurations, the data cache may be required to ensure data coherency.

Close #5050.
2024-06-25 03:58:34 +00:00
Sebastian Huber
d09d61ffe4 doxygen: Clarify system termination 2024-06-24 06:32:26 +02:00
Sebastian Huber
2089f993c0 rtems: Fix typos in documentation 2024-06-21 18:30:34 +02:00
Sebastian Huber
7ce6667e38 score: Conditionally provide ISR_lock_Control
Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
5d63827d07 score: Conditionally provide ISR_LOCK_INITIALIZER()
Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
b0599ef35d score: Remove ISR_LOCK_MEMBER
Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
283b4406c0 score: Remove ISR_LOCK_DECLARE()
Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
fa24398857 score: Remove ISR_LOCK_REFERENCE()
Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
bdbda6a75f score: Remove ISR_LOCK_DEFINE()
Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
050b61aab6 rtems: Add RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT
If the RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT define has a non-zero value,
then the interrupt lock operations require an object of type
rtems_interrupt_lock, otherwise no lock object is required.

This indication can be used to avoid the space overhead for lock objects
when they are not needed.  In this case, the lock operations will not
use a lock objects parameter.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Sebastian Huber
26a0bfcbc2 score: Improve _ISR_lock_Initialize()
Use do {} while (0) approach to avoid stray ';'.

Update #4957 and #5038.
2024-06-21 08:10:27 +02:00
Kinsey Moore
27ec46f11b cpukit/aarch64: Add A53-specific registers
This adds registers specific to the Cortex-A53 processor that describe
L1 and L2 cache errors.
2024-06-21 05:57:21 +00:00
Matheus Pecoraro
ef5ed795ec x86_64: Load rflags after rsp on context restore
When starting multitasking there is a chance an interrupt could be fired
while rsp is still pointing to the ISR stack area if we load rflags
before rsp on "_CPU_Context_restore"
2024-06-20 15:25:23 +00:00
Matheus Pecoraro
7f2b904d6e x86_64: Set CPU_USE_LIBC_INIT_FINI_ARRAY to TRUE 2024-06-17 20:45:32 +00:00
Sebastian Huber
2c0ab5ba0b rtems: Format typedef parameters in comments 2024-06-17 11:26:43 +02:00
Kinsey Moore
b031cf2b19 cpukit: Resolve gcc14 warnings
This resolves several warnings upon upgrading to gcc14 and building
without SMP support.
2024-06-13 17:21:45 -05:00
Sebastian Huber
1e68298847 dev/io: Fix "%hhi" conversion
The signedness of "char" is implementation-dependent.
2024-06-13 17:19:35 +00:00
Sebastian Huber
30125493b5 dev/io: Remove dead code in _IO_Vprintf() 2024-06-13 17:19:35 +00:00
Warner Losh
0c7a972b3c sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2024-06-13 17:19:35 +00:00
Warner Losh
c2041d3a0b sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2024-06-13 17:19:35 +00:00
Marius Strobl
a9e1c29aa6 kvprintf(9): add missing FALLTHROUGH
Reported by:	Coverity
CID:		1005166
2024-06-13 17:19:35 +00:00
Sam Price
20939b213a microblaze: Move interrupt context save to BSP
The interrupt context save is now done in the BSP. This avoids an issue
where a register is modified by the interrupt handler before it is
saved. Specifically, the MSR register was modified by the `addi`
instruction in the interrupt handler before the MSR was saved. This
caused the MSR to be saved with the wrong value.

Closes #4962
2024-06-11 19:24:39 +00:00
alessandronardin
68951fb2a4 cpukit/posix/aio*: Updated aio files documentation
Updated the documentation in all aio files.
Moved the Doxygen comments to the headers when possible.
Fixed some formatting errors.

Updates #5027
2024-06-11 19:49:14 +02:00
Aaron Nyholm
7bfe79c44d libmisc/shell: Improve print messages for flashdev command 2024-06-10 17:58:00 +00:00
Sebastian Huber
cbe60cea71 rtems: Clarify rtems_interrupt_set_priority()
Update #5002.
2024-06-06 23:41:13 +00:00
Sebastian Huber
25ba67963a score: Add _SMP_barrier_Wait_for_other()
This function may be used to ensure that a count of processors performed a set
of actions and then wait on the barrier performing only memory loads (no memory
stores).
2024-06-04 22:00:55 +00:00
Sebastian Huber
f67f1c8718 arm: Add arm_cp15_data_cache_all_invalidate()
Update #4982.
2024-06-04 15:50:57 +00:00
Alesandro Nardin
48f6b5006b cpukit/posix/src/aio_misc.c: created helper method rtems_aio_handle_helper()
Created an helper method that will be called by rtems_aio_handle().
The method will process the various types of aio requests.
Converted the old style documentation to Doxygen.
Formatted the code to adhere to rtems formatting rules.

Closes #5017
2024-05-29 18:54:36 +02:00
Joel Sherrill
e63c867104 x86_64/include/rtems/score/cpuimpl.h: Relicense to 2-BSD
This file had two copyrights but was missed in the earlier review.
Both parties had given permission.

Update #3053.
2024-05-28 15:44:37 -05:00
Sebastian Huber
869071dfb2 score: Add _Processor_mask_And_not()
Add it for completeness.
2024-05-23 21:44:22 +00:00
Alessandro Nardin
3225f69db6 posix: Fixed header comment of aio_read.c
Corrected the header comment of aio_read.c

Fixes #5015
2024-05-23 19:10:32 +00:00
Sebastian Huber
e74cea4172 arm: Fix Armv7-M floating-point support
The _ARMV7M_Pendable_service_call() and _ARMV7M_Supervisor_call() work
as a team. The --ef and ++ef is there to preserve the original exception
frame across the jump to and from _ARMV7M_Thread_dispatch().

void _ARMV7M_Pendable_service_call( void )
{
   Per_CPU_Control *cpu_self = _Per_CPU_Get();

   /*
    * We must check here if a thread dispatch is allowed.  Right after a
    * "msr basepri_max, %[basepri]" instruction an interrupt service may
still
    * take place.  However, pendable service calls that are activated during
    * this interrupt service may be delayed until interrupts are enable
again.
    */
   if (
     ( cpu_self->isr_nest_level |
cpu_self->thread_dispatch_disable_level ) == 0
   ) {
     ARMV7M_Exception_frame *ef;

     cpu_self->isr_nest_level = 1;

     _ARMV7M_SCB->icsr = ARMV7M_SCB_ICSR_PENDSVCLR;
     _ARMV7M_Trigger_lazy_floating_point_context_save();

At this point, the floating point context should be saved on the
exception frame.  The FPCCR.LSPACT bit should be 0, to indicate that lazy
state preservation is no longer active.

     ef = (ARMV7M_Exception_frame *) _ARMV7M_Get_PSP();
     --ef;
     _ARMV7M_Set_PSP( (uint32_t) ef );

This new exception frame is just there to jump to
_ARMV7M_Thread_dispatch(). Here was the problem, that FPCCR.LSPACT was
not set to 1.  This resulted in a floating-point context from
uninitialized memory which could corrupt the floating-point state.  See
also:

https://developer.arm.com/documentation/ddi0403/d/System-Level-Architecture/System-Level-Programmers--Model/ARMv7-M-exception-model/Exception-return-behavior?lang=en

     /*
      * According to "ARMv7-M Architecture Reference Manual" section B1.5.6
      * "Exception entry behavior" the return address is half-word aligned.
      */
     ef->register_pc = (void *)
       ((uintptr_t) _ARMV7M_Thread_dispatch & ~((uintptr_t) 1));

     ef->register_xpsr = 0x01000000U;
   }
}

Close #4923.
2024-05-22 01:46:00 +00:00
Matheus Pecoraro
b874f4c99d x86_64: Fix stack aligment for x86-64 SysV ABI
Makes the code in bsp/x86_64/amd64/start/start.S and the stack frame
setup by _CPU_Context_Initialize align the stack properly according to
what is expected by the x86-64 SysV ABI
2024-05-22 01:31:06 +00:00
Kinsey Moore
2c03b41fdc cpukit/libdl/aarch64: Improve debug output 2024-05-21 23:28:03 +00:00
Sebastian Huber
ab8817ca03 rtems: Add get/set interrupt priorities
Add directives to get and set the priority of an interrupt vector.

Implement the directives for the following BSP families:

* arm/lpc24xx
* arm/lpc32xx
* powerpc/mpc55xxevb
* powerpc/qoriq

Implement the directives for the following interrupt controllers:

* GICv2 and GICv3 (arm and aarch64)
* NVIC (arm)
* PLIC (riscv)

Update #5002.
2024-05-10 13:26:22 +00:00
Josef 'Jeff' Sipek
89ccc65d1a Remove a reference to xrpu from timetc.h
It was removed in 2007, so doesn't make a good example.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44462
2024-05-10 13:24:36 +00:00
Jake Freeland
c71d561bf8 timerfd: Move implementation from linux compat to cpukit/score/src
Move the timerfd impelemntation from linux compat code to cpukit/score/src. Use
it to implement the new system calls for timerfd. Add a hook to kern_tc
to allow timerfd to know when the system time has stepped. Add kqueue
support to timerfd. Adjust a few names to be less Linux centric.

RelNotes: YES
Reviewed by: markj (on irc), imp, kib (with reservations), jhb (slack)
Differential Revision: https://reviews.freebsd.org/D38459
2024-05-10 13:24:36 +00:00
Warner Losh
7867005def sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2024-05-10 13:24:36 +00:00
Warner Losh
770ef97a45 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2024-05-10 13:24:36 +00:00
Dmitriy Alexandrov
426492407b kern_ntptime: Fix undefined behavior of the shift operator
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	https://github.com/freebsd/freebsd-src/pull/769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
2024-05-10 13:24:36 +00:00
Warner Losh
e11536c339 spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2024-05-10 13:24:36 +00:00
Pedro F. Giffuni
b294ef236d sys/sys: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2024-05-10 13:24:36 +00:00
Sebastian Huber
dcdf399676 aarch64: Add files to Doxygen groups 2024-05-07 11:16:49 +02:00
zhengxiaojun
4655ceee4d fix dynamic loading error, close #3740. 2024-05-03 18:03:13 +08:00