| 1 | //                              -*- Mode: CFA -*- | 
|---|
| 2 | // | 
|---|
| 3 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo | 
|---|
| 4 | // | 
|---|
| 5 | // The contents of this file are covered under the licence agreement in the | 
|---|
| 6 | // file "LICENCE" distributed with Cforall. | 
|---|
| 7 | // | 
|---|
| 8 | // kernel_private.h -- | 
|---|
| 9 | // | 
|---|
| 10 | // Author           : Thierry Delisle | 
|---|
| 11 | // Created On       : Mon Feb 13 12:27:26 2017 | 
|---|
| 12 | // Last Modified By : Thierry Delisle | 
|---|
| 13 | // Last Modified On : -- | 
|---|
| 14 | // Update Count     : 0 | 
|---|
| 15 | // | 
|---|
| 16 |  | 
|---|
| 17 | #ifndef KERNEL_PRIVATE_H | 
|---|
| 18 | #define KERNEL_PRIVATE_H | 
|---|
| 19 |  | 
|---|
| 20 | #include "kernel" | 
|---|
| 21 | #include "thread" | 
|---|
| 22 |  | 
|---|
| 23 | //----------------------------------------------------------------------------- | 
|---|
| 24 | // Scheduler | 
|---|
| 25 | void ScheduleThread( thread_desc * ); | 
|---|
| 26 | thread_desc * nextThread(cluster * this); | 
|---|
| 27 |  | 
|---|
| 28 | void ScheduleInternal(void); | 
|---|
| 29 | void ScheduleInternal(spinlock * lock); | 
|---|
| 30 | void ScheduleInternal(thread_desc * thrd); | 
|---|
| 31 | void ScheduleInternal(spinlock * lock, thread_desc * thrd); | 
|---|
| 32 | void ScheduleInternal(spinlock ** locks, unsigned short count); | 
|---|
| 33 | void ScheduleInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count); | 
|---|
| 34 |  | 
|---|
| 35 | //----------------------------------------------------------------------------- | 
|---|
| 36 | // Processor | 
|---|
| 37 | struct processorCtx_t { | 
|---|
| 38 | processor * proc; | 
|---|
| 39 | coroutine_desc __cor; | 
|---|
| 40 | }; | 
|---|
| 41 |  | 
|---|
| 42 | DECL_COROUTINE(processorCtx_t); | 
|---|
| 43 |  | 
|---|
| 44 | void main(processorCtx_t *); | 
|---|
| 45 | void start(processor * this); | 
|---|
| 46 | void runThread(processor * this, thread_desc * dst); | 
|---|
| 47 | void finishRunning(processor * this); | 
|---|
| 48 | void spin(processor * this, unsigned int * spin_count); | 
|---|
| 49 |  | 
|---|
| 50 | //----------------------------------------------------------------------------- | 
|---|
| 51 | // Threads | 
|---|
| 52 | extern "C" { | 
|---|
| 53 | forall(dtype T | is_thread(T)) | 
|---|
| 54 | void CtxInvokeThread(T * this); | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst); | 
|---|
| 58 |  | 
|---|
| 59 | #endif //KERNEL_PRIVATE_H | 
|---|
| 60 |  | 
|---|
| 61 | // Local Variables: // | 
|---|
| 62 | // mode: c // | 
|---|
| 63 | // tab-width: 4 // | 
|---|
| 64 | // End: // | 
|---|