Changeset 0fd8287 in rtems


Ignore:
Timestamp:
Jun 26, 2018, 5:15:28 AM (10 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
9704d86f
Parents:
3be4478f
git-author:
Sebastian Huber <sebastian.huber@…> (06/26/18 05:15:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/28/18 13:03:23)
Message:

riscv: Add _CPU_Get_current_per_CPU_control()

Update #3433.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bsps/riscv/riscv/start/start.S

    r3be4478f r0fd8287  
    2929
    3030#include <rtems/asm.h>
    31 #include <rtems/score/cpu.h>
     31#include <rtems/score/percpu.h>
    3232#include <rtems/score/riscv-utility.h>
    3333#include <bsp/linker-symbols.h>
     
    5656#ifdef RTEMS_SMP
    5757        csrr    s0, mhartid
     58        la      t0, _Per_CPU_Information
     59        slli    t1, s0, PER_CPU_CONTROL_SIZE_LOG2
     60        add     t0, t0, t1
     61        csrw    mscratch, t0
    5862        bnez    s0, .Lwait_for_go
    5963#endif
  • cpukit/score/cpu/riscv/include/rtems/asm.h

    r3be4478f r0fd8287  
    118118#define TYPE_FUNC(sym) .type SYM (sym), %function
    119119
     120.macro GET_SELF_CPU_CONTROL REG
     121#ifdef RTEMS_SMP
     122        csrr    \REG, mscratch
     123#else
     124        la      \REG, _Per_CPU_Information
    120125#endif
     126.endm
     127
     128#endif
  • cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h

    r3be4478f r0fd8287  
    5353#endif
    5454
     55#ifdef RTEMS_SMP
     56
     57static inline struct Per_CPU_Control *_RISCV_Get_current_per_CPU_control( void )
     58{
     59  struct Per_CPU_Control *cpu_self;
     60
     61  __asm__ volatile ( "csrr %0, mscratch" : "=r" ( cpu_self ) );
     62
     63  return cpu_self;
     64}
     65
     66#define _CPU_Get_current_per_CPU_control() _RISCV_Get_current_per_CPU_control()
     67
     68#endif /* RTEMS_SMP */
     69
    5570#ifdef __cplusplus
    5671}
Note: See TracChangeset for help on using the changeset viewer.