Changeset 660665f for libcfa/src/concurrency/kernel_private.hfa
- Timestamp:
- Jun 29, 2021, 5:35:19 PM (5 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dcad80a
- Parents:
- 5a46e09 (diff), d02e547 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
libcfa/src/concurrency/kernel_private.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel_private.hfa
r5a46e09 r660665f 16 16 #pragma once 17 17 18 #if !defined(__cforall_thread__) 19 #error kernel_private.hfa should only be included in libcfathread source 20 #endif 21 18 22 #include "kernel.hfa" 19 23 #include "thread.hfa" … … 22 26 #include "stats.hfa" 23 27 28 extern "C" { 29 #if defined(CFA_HAVE_LINUX_LIBRSEQ) 30 #include <rseq/rseq.h> 31 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 32 #include <linux/rseq.h> 33 #else 34 #ifndef _GNU_SOURCE 35 #error kernel_private requires gnu_source 36 #endif 37 #include <sched.h> 38 #endif 39 } 40 24 41 //----------------------------------------------------------------------------- 25 42 // Scheduler 26 27 28 43 extern "C" { 29 44 void disable_interrupts() OPTIONAL_THREAD; … … 39 54 40 55 //----------------------------------------------------------------------------- 56 // Hardware 57 58 #if defined(CFA_HAVE_LINUX_LIBRSEQ) 59 // No data needed 60 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 61 extern "Cforall" { 62 extern __attribute__((aligned(128))) thread_local volatile struct rseq __cfaabi_rseq; 63 } 64 #else 65 // No data needed 66 #endif 67 68 static inline int __kernel_getcpu() { 69 /* paranoid */ verify( ! __preemption_enabled() ); 70 #if defined(CFA_HAVE_LINUX_LIBRSEQ) 71 return rseq_current_cpu(); 72 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 73 int r = __cfaabi_rseq.cpu_id; 74 /* paranoid */ verify( r >= 0 ); 75 return r; 76 #else 77 return sched_getcpu(); 78 #endif 79 } 80 81 //----------------------------------------------------------------------------- 41 82 // Processor 42 83 void main(processorCtx_t *); … … 44 85 void * __create_pthread( pthread_t *, void * (*)(void *), void * ); 45 86 void __destroy_pthread( pthread_t pthread, void * stack, void ** retval ); 46 47 48 87 49 88 extern cluster * mainCluster;
Note:
See TracChangeset
for help on using the changeset viewer.