Ignore:
Timestamp:
Dec 1, 2017, 11:58:32 AM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
3ca540f, 86ad276
Parents:
d16d159 (diff), 3d560060 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/preemption.c

    rd16d159 r5da9d6a  
    1414//
    1515
    16 #include "libhdr.h"
    1716#include "preemption.h"
    1817
     
    148147//=============================================================================================
    149148
    150 LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; )
     149__cfaabi_dbg_debug_do( static thread_local void * last_interrupt = 0; )
    151150
    152151extern "C" {
     
    159158        // Enable interrupts by decrementing the counter
    160159        // If counter reaches 0, execute any pending CtxSwitch
    161         void enable_interrupts( DEBUG_CTX_PARAM ) {
     160        void enable_interrupts( __cfaabi_dbg_ctx_param ) {
    162161                processor * proc   = this_processor;      // Cache the processor now since interrupts can start happening after the atomic add
    163162                thread_desc * thrd = this_thread;         // Cache the thread now since interrupts can start happening after the atomic add
     
    173172
    174173                // For debugging purposes : keep track of the last person to enable the interrupts
    175                 LIB_DEBUG_DO( proc->last_enable = caller; )
     174                __cfaabi_dbg_debug_do( proc->last_enable = caller; )
    176175        }
    177176
     
    233232// Called from kernel_startup
    234233void kernel_start_preemption() {
    235         LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n");
     234        __cfaabi_dbg_print_safe("Kernel : Starting preemption\n");
    236235
    237236        // Start with preemption disabled until ready
     
    255254// Called from kernel_shutdown
    256255void kernel_stop_preemption() {
    257         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n");
     256        __cfaabi_dbg_print_safe("Kernel : Preemption stopping\n");
    258257
    259258        // Block all signals since we are already shutting down
     
    271270        // Preemption is now fully stopped
    272271
    273         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n");
     272        __cfaabi_dbg_print_safe("Kernel : Preemption stopped\n");
    274273}
    275274
     
    297296// Receives SIGUSR1 signal and causes the current thread to yield
    298297void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
    299         LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
     298        __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
    300299
    301300        // Check if it is safe to preempt here
     
    346345                assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
    347346
    348                 // LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
     347                // __cfaabi_dbg_print_safe("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
    349348                // Switch on the code (a.k.a. the sender) to
    350349                switch( info.si_code )
     
    354353                case SI_TIMER:
    355354                case SI_KERNEL:
    356                         // LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
    357                         lock( event_kernel->lock DEBUG_CTX2 );
     355                        // __cfaabi_dbg_print_safe("Kernel : Preemption thread tick\n");
     356                        lock( event_kernel->lock __cfaabi_dbg_ctx2 );
    358357                        tick_preemption();
    359358                        unlock( event_kernel->lock );
     
    368367
    369368EXIT:
    370         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n");
     369        __cfaabi_dbg_print_safe("Kernel : Preemption thread stopping\n");
    371370        return NULL;
    372371}
     
    380379
    381380        if ( sigaction( sig, &act, NULL ) == -1 ) {
    382                 LIB_DEBUG_PRINT_BUFFER_DECL(
     381                __cfaabi_dbg_print_buffer_decl(
    383382                        " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
    384383                        sig, handler, flags, errno, strerror( errno )
     
    397396
    398397        if ( sigaction( sig, &act, NULL ) == -1 ) {
    399                 LIB_DEBUG_PRINT_BUFFER_DECL(
     398                __cfaabi_dbg_print_buffer_decl(
    400399                        " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
    401400                        sig, errno, strerror( errno )
     
    409408//=============================================================================================
    410409
    411 LIB_DEBUG_DO(
     410__cfaabi_dbg_debug_do(
    412411        static void __kernel_backtrace( int start ) {
    413412                // skip first N stack frames
     
    476475
    477476// void sigHandler_segv( __CFA_SIGPARMS__ ) {
    478 //      LIB_DEBUG_DO(
     477//      __cfaabi_dbg_debug_do(
    479478//              #ifdef __USE_STREAM__
    480479//              serr    | "*CFA runtime error* program cfa-cpp terminated with"
     
    493492// void sigHandler_abort( __CFA_SIGPARMS__ ) {
    494493//      // skip first 6 stack frames
    495 //      LIB_DEBUG_DO( __kernel_backtrace( 6 ); )
     494//      __cfaabi_dbg_debug_do( __kernel_backtrace( 6 ); )
    496495
    497496//      // reset default signal handler
Note: See TracChangeset for help on using the changeset viewer.