Commit Graph
13028 Commits
Author SHA1 Message Date
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
Sebastian Huber ae00fcabed doxygen: Fix constraints
Somehow the constraints for CONFIGURE_TICKS_PER_TIMESLICE and
CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK got mixed up.

Update #4986.
2024-04-30 01:39:06 -04:00
Sebastian Huber 237f8662ba score: Improve C/C++ standard compatibility
The processor mask implementation uses flsl() from <strings.h> which is
only BSD visible.  Move the implementation to a separate header file to
hide it from the API level.  This fixes build errors with GCC 14.
2024-04-30 01:39:05 -04:00
Sebastian Huber 1ef5fa07aa rtems: Avoid -Wundef warnings in API header 2024-03-23 10:56:25 +01:00
Sebastian Huber 1df822a922 Mark parameters as intentionally unused
The parameters are unused due to API constraints.  The functions are
used through function pointers.  Alternative implementations may use the
parameters.

Update #4862.
2024-03-22 08:12:22 +01:00
Sebastian Huber d62f299b34 Do not define CONFIGURE_TICKS_PER_TIMESLICE to 0
Unconditionally make a CONFIGURE_TICKS_PER_TIMESLICE value less than or equal
to zero an error.

Update #4986.
2024-03-20 10:52:16 +01:00
Sebastian Huber 9e0bcd4fc7 score: Include missing header file
This fixes:

heap.c:268:3: warning: implicit declaration of function 'memset'
2024-03-20 10:52:16 +01:00
Sebastian Huber bc910e1aac arm: Move _CPU_ISR_install_vector()
The use of this function is optional. Newer BSPs do not use it.
2024-03-20 07:40:41 +01:00
Kinsey Moore 9c84037e93 cpukit: Gate ticks per timeslice config
Gate CONFIGURE_TICKS_PER_TIMESLICE appropriately behind
CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER.
2024-03-18 15:18:38 -05:00
Kinsey Moore 1ecb4e3047 cpukit/jffs2: Properly commit JFFS2 data
When unmounting a JFFS2 filesystem, any outstanding write buffers must
be flushed to disk. In some circumstances, these write buffers are
instantiated by a garbage collection pass and as such no inode number is
associated with it. Due to the way that JFFS2 processes these garbage
collection passes, a write buffer without any associated inodes will not
be flushed unless it is forced with jffs2_flush_wbuf_pad().
2024-03-14 17:13:23 -05:00
Zack leung 5ee87eee8a Ensure ticks per timeslice is greater than zero 2024-03-14 12:58:59 -05:00
Kinsey Moore 3200933e13 cpukit/libtest: Remove unused variable
This unused variable causes a warning. It is never set or used.
2024-03-01 08:33:39 -06:00
Sebastian Huber c454b1048f powerpc: Use RTEMS_XCONCAT()
Prefer macros with a proper namespace.
2024-02-27 16:20:18 +01:00
Kinsey Moore e3972d71ef cpukit/jffs2: Handle used empty file system
On JFFS2 file systems on NOR flash or dataflash that does not have spare
area for metadata and thus does not invoke delayed writes, it is
possible to put the file system into a state where all blocks have been
written to and all files have been deleted from the filesystem. There is
a bug in the JFFS2 file system scan routine that detects this situation
as a corrupted file system since the scan routine relies on "used" space
to discriminate a valid file system when there are blocks that need to
be erased. The correct fix would require a partial rewrite of the scan
routine, so instead this patch tracks the space marked as obsolete along
with space at the end of each block that is otherwise too small to
contain a JFFS2 node so that it can me compared with the dirty space.
Corrupted data (or otherwise non-JFFS2 blocks) will still cause this
check to fail as corrupted data isn't recognized as obsoleted (deleted)
nodes.
2024-02-26 11:07:53 -06:00
Sebastian Huber e9c7ba3e05 libtest: Improve gcov info dump
Make sure there is no spurious empty line between the gcov info and the

*** END OF GCOV INFO BASE64 ***

line.  This helps to recalculate the hash correctly at the consumer
side.
2024-02-22 14:30:40 +01:00
Sebastian Huber fa3a918a2a doxygen: Fix link format 2024-02-16 09:32:04 +01:00
Sebastian Huber fa17765bd4 crc: Add a CRC-24Q implementation 2024-02-16 09:32:04 +01:00
Matthew Joyce 2757b36098 base64: Add decoder 2024-02-16 09:32:04 +01:00
Sebastian Huber c90e2b2fb2 base64: Make base64 encoding tables public
This makes them reusable.  Change the character type to uint8_t.
2024-02-16 09:32:04 +01:00
Sebastian Huber 317df86ba3 base64: Move base64 encoding support 2024-02-16 09:32:04 +01:00
Kinsey Moore 8d22b57969 i386: Restore SMP functionality
When the switch to waf occurred, the SMP support in i386 was left out
causing it to accumulate a minor amount of cruft. This enables SMP for
the i386 BSPs that support it and updates them for the API drift that
has occurred since the change.
2024-02-14 08:22:48 -06:00
Kinsey Moore b03aba3023 cpukit/libblock: Ignore sync status prior to purge 2024-01-31 14:03:33 -06:00
Kinsey Moore 0d5319d49a cpukit/libblock: Ignore error notify return value
This is already in the error path.
2024-01-31 14:03:33 -06:00
Kinsey Moore 9a95f9c638 cpukit/libblock: Ignore return value on error path 2024-01-29 11:08:19 -06:00
Kinsey Moore 4c948a6ae5 cpukit/cache: Report coherent add area failures
This alters the API for rtems_cache_coherent_add_area to allow reporting
of failures that can occur during the process of adding a new area to
the coherent cache heap.
2024-01-26 08:19:15 -06:00
Kinsey Moore 572c95c375 cpukit/dosfs: Simplify expressions where possible 2024-01-22 09:56:40 -06:00
Kinsey Moore 07ee157e5e cpukit/libmisc: Cast getpid() before shifting
Cast getpid() before shifting to avoid truncation of upper bits before
the 64bit XOR occurs.
2024-01-22 09:56:40 -06:00
Kinsey Moore df8e3fcbb6 cpukit/libmisc/uuid: Check for invalid FD 2024-01-22 09:56:40 -06:00
Kinsey Moore 487cdce64d cpukit/dosfs: Don't leak a FAT FD
The tmp_fat_fd variable is unconditionally opened in the branch where it
is used within the loop and so must be closed or else risk a resource
leak.
2024-01-22 09:56:40 -06:00
Kinsey Moore 659a79ef8f cpukit/score: Avoid overflow in multiplication
Change extend_count to uint32_t from uint16_t to avoid a possible
premature integer overflow when it is later used for multiplication.
2024-01-17 10:48:25 -06:00
Kinsey Moore 46c343dd23 cpukit/dosfs: Remove unused internal function arg 2024-01-16 10:57:44 -06:00
Kinsey Moore 6383390886 cpukit: Remove or use unused variable assignments 2024-01-16 10:57:44 -06:00
Bernd Moessner a73b52d6a4 flashdev.c: return error if both buffers are NULL
Updates #4981
2024-01-16 10:57:43 -06:00
Bernd Moessner bd898b503f flashdev: Add missing default case
Updates #4981
2024-01-16 10:57:43 -06:00
Bernd Moessner a43163d058 flashdev.h: Add missing C++ include guards
Updates #4981
2024-01-16 10:57:43 -06:00
Kinsey Moore 150dcf5e47 libio: Clean up usage of rtems_termios_device_mode
This cleans up outputUsesInterrupts usage with rtems_termios_device_mode
enum values. The outputUsesInterrupts member was typed as an int, named
as if it were a boolean value, and used as if it were a
rtems_termios_device_mode enum. In this patch, values assigned to
outputUsesInterrupts have been converted to the corresponding
rtems_termios_device_mode enum value, conversions from
deviceOutputUsesInterrupts have been made explicit, and uses of
rtems_termios_device_mode enum values with deviceOutputUsesInterrupts
have been converted to booleans.
2024-01-10 14:43:53 -06:00
Kinsey Moore c37fdedec2 cpukit/dosfs: Jump to correct error handler
When encountering an error during filesystem creation, fat_fd must be
cleaned up appropriately once the file is opened. There was an
opportunity for a resource leak due to jumping to the incorrect error
handling label.
2024-01-10 14:43:53 -06:00
Kinsey Moore e6fce3cd3d cpukit/dosfs: Cast away ignored return
An error is already being reported. Checking the return value of this
function is not useful.
2024-01-05 08:29:25 -06:00