Commit graph

5860 commits

Author SHA1 Message Date
Robin Kastberg
c858c8d6ba arch: arm: cortex_m: 'movs reg, imm' mnemonic
One nmemonic was missed by f84342828cd1

That commit said:

The ARM Thumb-1 instruction set, used by ARMv6-M and ARMv8-M Baseline
cores, does not have a valid encoding for "immediate-to-register move
without affecting flags" instruction (i.e. `mov reg, imm`), and the only
valid variant of immediate-to-register move instruction for it is `movs`,
which affects the flags.

Since none of the register initialisation instructions used here are
flag-sensitive in their context, this commit changes `mov` to `movs`.

This fixes the compilation errors with Clang/LLVM, which is more picky
about the `mov` mnemonic usage and prints out an "invalid instruction"
error when `mov reg, imm` is specified in Thumb-1 mode.

Note that GNU assembler implicitly converts `mov reg, imm` to `movs reg,
imm` when assembling in Thumb-1 mode.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-17 21:15:44 +01:00
Robin Kastberg
9ab06ec667 toolchain: iar: Add experimental IAR support
This adds experimental support for the IAR toolchain.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-14 19:12:44 +00:00
Robin Kastberg
f5a1585426 toolchain: iar: tls: no tls pointer offset in IAR
The IAR Toolchain currently doesn't use the two
pointer offset.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-14 19:12:44 +00:00
Robin Kastberg
e9a0d146cf toolchain: move some hardcoded flags to properties
Some basic flags that were hardcoded needed
to be moved to properties to be able to implement
alternative toolchains.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-14 19:12:44 +00:00
Wilfried Chauveau
d88575b5f8 arch: arm: cortex_a_r: move exit_exc from vector_table.S to exc.S
It makes more sense to keep the exit_exc code close to the exc code.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-14 00:45:35 +01:00
Ryan McClelland
ef232f34d0 arch: arm: fix compile issue if MEM_ATTR=n and ARM_MPU=y
It's possible to have MEM_ATTR=n and ARM_MPU=y. This fixes the compile
issue with it by compiling out the calls to define the DT mpu regions.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-02-13 16:43:11 +01:00
Wilfried Chauveau
caafe23891 arch: arm: cortex_m: Apply clang-format on cortex_m related code
This commit updates cortex_m related code to align it with the rules from
.clang-format. This is done to simplify future changes in these files as
we are about to implement use_switch support.

Some rules conflict with checkpatch and therefore some small part of the
code locally disable clang-format.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-13 16:42:48 +01:00
Anas Nashif
10506f8a25 x86: lakemont: split lakemont into families
Define multiple lakemont cpu families: value and performance.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-02-12 23:16:38 +01:00
Wilfried Chauveau
3e6dd56133 arch: arm: cortex_m: make reading tls pointer faster on v7m and v8m.main
Encoding T3 allows for an offset of up to 12bits in size allowing for a
single instruction instead of 3.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-08 10:09:10 +01:00
Wilfried Chauveau
5261680312 arch: arm: cortex_m: use local label in ASM code
Regular label are exported in the object file and cause gdb to consider
them as function start. Local labels on the other hand are not exported.
For example, using `disassemble z_arm_pendsv` after this change will
disassemble the whole function rather than stop at the first branch.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-08 08:14:07 +01:00
Björn Bergman
5a57c3b7e8 toolchain: x86: Broken -Os detection in ia32.cmake
Fix followup problems after laguage-correct zephyr COMPILE_OPTIONS

Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
2025-02-06 03:16:07 +01:00
Sudan Landge
ce60dd2a27 arch: arm: fix mpu compiler warnings
What is the change?
 - Use a macro that search for "zephyr, memory-attr" in only
   those nodes that have the property "zephyr, memory-regions".
 - Fixes #83448.

Why is this needed?
 - Using `DT_REG_ADDR` inside `DT_FOREACH_STATUS_OKAY_NODE_VARGS` can
   lead to compiler warnings if a devicetree node has an addresses
   larger than 64bits. An example of such node is wm8904 i3c with 92
   bit encoding addresses `audio_codec: wm8904@1a0000000000000000`.
   We can avoid this warning since this is not applicable for nodes
   that have the attribute "zephyr,memory-regions".

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-02-06 03:15:48 +01:00
Filip Kokosinski
ee07eba569 arch/riscv: add Zaamo and Zlrsc extension subsets
The Zaamo and Zalrsc Extension (Version v1.0.0, 2024-04-25; Ratified) split
the standard A extension into two subextensions. As of date, the `_zaamo`
and `_zlrsc` extension specifications are accepted by the upstream
in-development GCC through the `march` argument. This means that those
subextensions are not yet supported by GCC shipped with Zephyr SDK.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-02-05 17:49:13 +01:00
Jimmy Zheng
3804387350 arch: riscv: handle interrupt level for CLIC
CLIC supports mintstatus.MIL (RO) and mcause.MPIL (RW) for the current
interrupt level and the previous interrut level before a trap. Each ISR
must execute MRET to set mcause.MPIL back to mintstatus.MIL.

This commit introduces CONFIG_CLIC_SUPPORT_INTERRUPT_LEVEL to handle
mcause.MPIL for interrupt preemption in nested ISR, and uses
CONFIG_RISCV_ALWAYS_SWITCH_THROUGH_ECALL to ensure ISR always switch out
with MRET.

e.g.
  With CONFIG_RISCV_ALWAYS_SWITCH_THROUGH_ECALL=n, a context-switch in
  ISR may skip MRET in this flow:
  IRQ -> _isr_wrapper -> z_riscv_switch() -> retrun to arch_switch()

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2025-02-05 17:48:45 +01:00
Kalle Kietäväinen
d929b8a9fa Revert "arch: arm: cortex_m: Only trigger context switch if thread is preemptible"
This reverts commit 42036cdbca.

Architecture specific code should not do preemption checking before context
switch. This is already handled by the scheduler, so duplicating it would
be redundant and error prone. These checks used to be necessary, but the
scheduler has been rewritten since then and the checks were removed in
3a0cb2d35d (kernel: Remove legacy preemption checking, 2018-05-23).

The check this reverts was also incorrect, as it didn't take scheduler
locking nor meta-IRQs into account.

Fixes #80574

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
2025-02-04 12:03:20 +01:00
Anisetti Avinash Krishna
9353abf162 arch: x86: core: reboot_rst_cnt: Enable support for warm reboot
Enable support for warm reboot for x86 arch as per the Reset Control
Register description.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2025-02-04 09:19:24 +01:00
Joel Holdsworth
d640f15955 arch: riscv: Rename _Fault to z_riscv_fault
The exception fault handler function is named _Fault which is inconsistent
with all other arch-specific functions present in Zephyr. This patch
replaces the name with z_riscv_fault.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-28 23:42:06 +01:00
Joel Holdsworth
58499aca7c arch: nios2: Rename _Fault to z_nios2_fault
The exception fault handler function is named _Fault which is inconsistent
with all other arch-specific functions present in Zephyr. This patch
replaces the name with z_nios2_fault.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-28 23:42:06 +01:00
Joel Holdsworth
bdb3f4fd73 arch: nios2: Corrected a typo
An existing comment references a function "irq_oflload()", which should be
written "irq_offload()".

This issue was detecte by the GitHub CI compliance check.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-28 23:42:06 +01:00
Joel Holdsworth
d76cf5b57e arch: mips: Rename _Fault to z_mips_fault
The exception fault handler function is named _Fault which is inconsistent
with all other arch-specific functions present in Zephyr. This patch
replaces the name with z_mips_fault.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-28 23:42:06 +01:00
Joel Holdsworth
4611e169e2 arch: arc: Rename _Fault to z_arc_fault
The exception fault handler function is named _Fault which is inconsistent
with all other arch-specific functions present in Zephyr. This patch
replaces the name with z_arc_fault.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-28 23:42:06 +01:00
Abe Kohandel
9163d5852f arch: arm: mmu: Make all device memory shareable
ARM has deprecated usage of non-shareable device memory.
K_MEM_CACHE_NONE flag used by devices to map physical memory translates
to MT_DEVICE but no MATTR_SHARED attribute is set in such a request.
This results in mapping device memory that is non-shareable.

Depending on the memory interconnect of a SoC, mapping the device memory
as non-shareable can prevent access to the device. Such behavior has
been observed on the TI AM3358 SoC.

To comply with the ARM deprecation notice and prevent access issues to
device memory, all device memory is mapped as shareable.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2025-01-28 09:51:21 +01:00
Chris Friedt
75ad6e1d00 arch: x86: fatal: initialize was_valid_access
This change initializes was_valid_access in the case that
CONFIG_X86_KPTI is selected. Previously, the variable was
causing an uninitialized variable warning that would be
escalated to an error when run with twister.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-01-27 17:09:19 +01:00
Yong Cong Sin
588ccd9698 arch: remove CONFIG_LEGACY_MULTI_LEVEL_TABLE_GENERATION
`CONFIG_LEGACY_MULTI_LEVEL_TABLE_GENERATION` had been deprecated since
#66877 for 2 releases, interrupt controller drivers should have been
updated to use the new `IRQ_PARENT_ENTRY_DEFINE()` macro. Remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-01-23 16:32:36 +01:00
Yong Cong Sin
ecc2b0fb33 arch: arm64: remove CONFIG_ARM64_ENABLE_FRAME_POINTER
`CONFIG_ARM64_ENABLE_FRAME_POINTER` had been deprecated since #72646
for 2 releases and served not functional effect, it's now time to
say goodbye.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-01-23 16:32:36 +01:00
Maciej Kusio
ddff91fef6 arch: Changes MPU alignment to 128 when FPU_SHARING and MPU_STACK_GUARD
With our builds for Arm M7 we are selecting FPU_SHARING and
MPU_STACK_GUARD. For that setup, we have
ARM_MPU_REGION_MIN_ALIGN_AND_SIZE=64 and
MPU_STACK_GUARD_MIN_SIZE_FLOAT=128. So worst case scenario,
we are going to have stack that is 64-byte aligned and
128-byte guard at the bottom of the buffer.

Fixes: #83714

Signed-off-by: Maciej Kusio <rysiof@gmail.com>
2025-01-22 10:48:02 +01:00
Chris Friedt
c057f91eb5 arch: x86: add missing semicolon for z_x86_kpti_is_access_ok()
The function prototype / extern declaration for
z_x86_kpti_is_access_ok() in x86_mmu.h was missing a semicolon.

Add it to avoid being surprised by compile errors in certain
circumstances.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-01-22 08:08:40 +01:00
Łukasz Stępnicki
9c574ed922 arch: riscv: option to init custom hw stacked esf members.
When RISCV_SOC_HAS_ISR_STACKING is used, it may
be needed to initialize custom hw stacked esf members.
Some initial values may need to be aligned with
hw stacking mechanism to avoid any side effects.

Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
2025-01-20 16:27:33 +01:00
Dmitrii Golovanov
9c7288e86e arch: common: timing: Fix timing cycles 32bit rollover
Fix `arch_timing_cycles_get()` to prevent overflow on 32bit cycles
rollover. Also make `arch_timing_counter_get()` to work 64bit when
`CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER` is set.

The issue was observable, for example when `tests/benchmarks/wait_queues`
or `tests/benchmarks/sched_queues` were executed on qemu for `mps2/an385`
and the benchmark has its iterations large enough as the default
BENCHMARK_NUM_ITERATIONS=1000.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2025-01-17 20:07:16 +01:00
Fin Maaß
b10781ba45 arch: common: be able to use ROM_START_OFFSET on RISCV
be able to use ROM_START_OFFSET on RISCV.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-17 09:07:45 +01:00
Sudan Landge
743fe63651 arch: arm: fix: pm_s2ram with CONFIG_DEBUG_THREAD_INFO
What is the change?
 - Fixes #83660 allowing device to now enter suspend mode even if
   CONFIG_DEBUG_THREAD_INFO is enabled.

Why is this needed?
 - z_sys_post_kernel was cleared as part of #d778d5c
   to "allow debuggers to display the correct thread state after
   the first 3 instructions have run".
   This is not required while resuming from suspend and
   it prevents the device from entering suspend so,
   move it out of resume path.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-01-14 15:39:30 +01:00
Eric Ackermann
2d3390f866 llext: Fix off-by-one in RISC-V truncation check
The RISC-V architecture-specific relocations need to check whether
each required relocation can fit into the modified instruction's
immediate. All immediates in RISC-V are encoded as two's complement.
The current truncation check has an off-by-one error for checking
the maximum negative distance, as two's complement encoding can
represent a negative value that is the maximum positive value plus
one, causing LLEXT to refuse loading valid code.
This commit adds an additional condition to the check that fixes
the aforementioned issue.

Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
2025-01-10 14:47:39 +01:00
Nicolas Pitre
7a3124d866 kernel: move current thread pointer management to core code
Define the generic _current directly and get rid of the generic
arch_current_get().

The SMP default implementation is now known as z_smp_current_get().
It is no longer inlined which saves significant binary size (about 10%
for some random test case I checked).

Introduce z_current_thread_set() and use it in place of
arch_current_thread_set() for updating the current thread pointer
given this is not necessarily an architecture specific operation.
The architecture specific optimization, when enabled, should only care
about its own things and not have to also update the generic
_current_cpu->current copy.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
Nicolas Pitre
46aa6717ff Revert "arch: deprecate _current"
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").

This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.

The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.

Hence this revert.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
Samuel Chee
d9eed167d0 arm: mpu: Unify ARM_MPU kconfig definitions
Previously, there were two separate Kconfig definitions
of ARM_MPU located at:
- arch/arm/core/mpu/Kconfig
- arch/arm64/core/cortex_r/Kconfig

This lead to incomplete default settings and unexpected
missing configurations.

This commit combines the two into a single unified definition
now located at arch/common/Kconfig to prevent this.

Signed-off-by: Samuel Chee <samche01@arm.com>
2025-01-09 11:55:22 +01:00
Andy Ross
8b39d4a613 arch/xtensa: Add build-time validation of cache line kconfig
Xtensa cache line sizes aren't an obtuse area of pedantry like they
are in x86.  Different cores already in Zephyr are already using
variant cache line sizes (64 and 128 bytes are both common).

And I tripped over this by using the wrong value because the kconfig
was being inherited (incorrectly) from a default somewhere.

Xtensa exposes the correct value in core-isa.h (well, unless the
toolchain/hal gets messed up).  Add a check to make sure that our
platform kconfig gets it right.

Note that qemu/dc233c was already getting this wrong, leaving the
value at the kconfig default of zero.  That was benign (qemu doesn't
provide any cache emulation for incoherent DMA), but needs to be
fixed.

Signed-off-by: Andy Ross <andyross@google.com>
2025-01-06 20:33:04 +01:00
Dmitrii Golovanov
d2c19a0535 arch: nios2: timing: Fix timing cycles rollover
Fix arch_timing_cycles_get() to prevent overflow on the clock rollover.

The issue is observable on tests/benchmarks/wait_queues and
tests/benchmarks/sched_queues with BENCHMARK_NUM_ITERATIONS is large
enough, e.g. default 1000.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2025-01-06 17:13:10 +00:00
Hessel van der Molen
8316f097ce arch: arm: cortex_m: pm_s2ram: fix system_off rv as rv of s2ram_suspend
The return value of the system_off call is overwritten by the the call to
pm_s2ram_mark_check_and_clear. As arch_pm_s2ram_suspend needs to specify
why system_off failed, we need to make sure the rv of system_off is moved
to a safe register before calling pm_s2ram_mark_check_and_clear and moved
to r0 als rv of arch_pm_s2ram_suspend when the suspend call exits.

Signed-off-by: Hessel van der Molen <hvandermolen@dexels.com>
2025-01-03 17:11:09 +00:00
Guennadi Liakhovetski
00b6ae5bbc llext: xtensa: fix RELATIVE relocations
With dynamically linked / shared ELF objects the displacement
between file offsets and memory addresses can differ between
sections. Therefore we cannot use .text for all such relocations and
have to locate the respective section instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Guennadi Liakhovetski
92287c4e8e llext: xtensa: (cosmetic) simplify a calculation
To obtain a section header reference we don't need to calculate its
location in the ELF image, we already have a pointer to all section
headers, just use them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Guennadi Liakhovetski
024f43b1f0 llext: move a calculation to a more logical location
Currently llext_link_plt() calculates offsets to relocation addresses
relative to the .text section and passes them to
arch_elf_relocate_global() and arch_elf_relocate_local(), where then
.text memory address is added to them. Instead it's more logical to
concentrate the entire calculation in the caller, which then also
removes the assumption, that all sections have the same VMA - LMA
offset from those functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Guennadi Liakhovetski
acbd183b72 llext: fix .bss on heap
With writable LLEXT but without pre-assigned section addresses
.bss section offset in its ELF header will not match .bss eventual
location as it's allocated on the heap. Use llext_loaded_sect_ptr()
to get a correct address in both cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Stephanos Ioannidis
734fa185c8 arch: arm: cortex_m: Use Thumb-1 compatible 'mov reg, imm' mnemonic
The ARM Thumb-1 instruction set, used by ARMv6-M and ARMv8-M Baseline
cores, does not have a valid encoding for "immediate-to-register move
without affecting flags" instruction (i.e. `mov reg, imm`), and the only
valid variant of immediate-to-register move instruction for it is `movs`,
which affects the flags.

Since none of the register initialisation instructions used here are
flag-sensitive in their context, this commit changes `mov` to `movs`.

This fixes the compilation errors with Clang/LLVM, which is more picky
about the `mov` mnemonic usage and prints out an "invalid instruction"
error when `mov reg, imm` is specified in Thumb-1 mode.

Note that GNU assembler implicitly converts `mov reg, imm` to `movs reg,
imm` when assembling in Thumb-1 mode.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2024-12-13 11:35:06 +01:00
Peter Mitsis
909ff45f0c kernel: arch: move arch_swap() declaration
Moves the arch_swap() declaration out of kernel_arch_interface.h
and into the various architectures' kernel_arch_func.h. This
permits the arch_swap() to be inlined on ARM, but extern'd on
the other architectures that still implement arch_swap().

Inlining this function on ARM has shown at least a +5% performance
boost according to the thread_metric benchmark on the disco_l475_iot1
board.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-12-11 21:33:49 +01:00
Grant Ramsay
31b54e7cee arch: arm: cortex_m: Include TBLBASE in VTOR mask if present
In some Cortex-M3 implementations SCB_VTOR bit[29] is called
the TBLBASE bit.
This enables setting VTOR to an SRAM address for qemu_cortex_m3

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2024-12-10 03:16:23 +00:00
Manuel Argüelles
87798f9e16 arch: arm: rename CPU_HAS_NXP_MPU to align with binding
Following the binding rename to "nxp,sysmpu", update the Kconfig
option to align with the binding name and to better reflect the
option's purpose.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-12-06 22:23:06 +01:00
Alexandru Lastur
9cebb3ff63 arm: mpu: Remove FLASH_0 mpu region when XIP=n
When not using CONFIG_XIP (CONFIG_XIP=n)
the FLASH_0 mpu region needs to be removed,
otherwise it will have the default base
address = 0, which means that MPU will try
to configure the region with address 0.
We don't want this as in some situations
address 0 can be a restricted memory region
such as ROM code.

Signed-off-by: Alexandru Lastur <alexandru.lastur@nxp.com>
2024-12-06 18:20:48 +01:00
Dmytro Firsov
da43d97627 Revert "arch: arm64: init xen in arch_kernel_init()"
This reverts commit 7c90f1bca1.

Xen initialization maps enlighten page to Zephyr memory and also
initializes Xen event channels. It is used for communication between
Xen domains and based on interrupt connected to domain virtual GIC.
Moving event channel initialization to arch_kernel_init() make it call
irq_enable() when GIC is not initialized. Since GIC is initialized
on PRE_KERNEL_1 stage, this lead to fatal error during boot.

Revert these changes to make xenvm operable again.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2024-12-06 18:20:40 +01:00
Carles Cufi
6160ff24ef arch: local ISR table declaration: Remove experimental label
The local ISR table generation was introduced in 13638a0351, and
included in Zephyr v3.6.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-12-05 12:29:58 +01:00
Daniel Leung
42b209f816 xtensa: optimize syscall helper functions
The original idea of the syscall helpers is to workaround
an issue where the compiler could not correctly model register
usage with inline functions. It was supposed to be only used
when there are more then 3 arguments to syscalls. However,
during the original MMU code development, the helper got
expanded to cover "less then 2 arguments syscalls" as a way
for debugging syscall handling code and was never removed.
So fix that now by limiting the helper for syscalls with
more than 3 arguments.

Moreover, instead of using one helper with 6 arguments, now
we have separate implementations for both 4 and 5 arguments
syscall helpers. Now the compiler does not have to generate
code to always handle 6 arguments which saves a few code bytes
as there is no need to pass extra zeroes as arguments.

This has been verified to work with xt-clang RI-2022.10.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-12-04 14:16:15 -05:00