Ignore:
Timestamp:
2020-06-12T16:46:32Z (5 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffccdff0
Parents:
94e75cf
Message:

Replace get_stack_base() with builtin_frame_address(0)

The usage of an intrinsic function to obtain the current stack pointer
should provide the compuler more room for performance optimizations than
the hand-written (and volatile) inline assembly block.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/riscv64/include/arch/asm.h

    r94e75cf r128359eb  
    9191}
    9292
    93 _NO_TRACE static inline uintptr_t get_stack_base(void)
    94 {
    95         uintptr_t base;
    96 
    97         asm volatile (
    98             "and %[base], sp, %[mask]\n"
    99             : [base] "=r" (base)
    100             : [mask] "r" (~(STACK_SIZE - 1))
    101         );
    102 
    103         return base;
    104 }
    105 
    10693_NO_TRACE static inline void cpu_sleep(void)
    10794{
Note: See TracChangeset for help on using the changeset viewer.