Changeset 297cf18


Ignore:
Timestamp:
Dec 10, 2020, 3:20:39 PM (12 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
3e3f236, ee913e0
Parents:
bfcf6b9 (diff), adf34b3 (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:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    rbfcf6b9 r297cf18  
    354354}
    355355
     356//-----------------------------------------------------------------------------
     357// Kernel Signal Debug
     358void __cfaabi_check_preemption() {
     359        bool ready = __preemption_enabled();
     360        if(!ready) { abort("Preemption should be ready"); }
     361
     362        __cfaasm_label(debug, before);
     363
     364                sigset_t oldset;
     365                int ret;
     366                ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
     367                if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
     368
     369                ret = sigismember(&oldset, SIGUSR1);
     370                if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
     371                if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
     372
     373                ret = sigismember(&oldset, SIGALRM);
     374                if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
     375                if(ret == 0) { abort("ERROR SIGALRM is enabled"); }
     376
     377                ret = sigismember(&oldset, SIGTERM);
     378                if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
     379                if(ret == 1) { abort("ERROR SIGTERM is disabled"); }
     380
     381        __cfaasm_label(debug, after);
     382}
     383
     384#ifdef __CFA_WITH_VERIFY__
     385bool __cfaabi_dbg_in_kernel() {
     386        return !__preemption_enabled();
     387}
     388#endif
     389
    356390#undef __cfaasm_label
     391
     392//-----------------------------------------------------------------------------
     393// Signal handling
    357394
    358395// sigprocmask wrapper : unblock a single signal
     
    479516        __cfaasm_label( check  );
    480517        __cfaasm_label( dsable );
     518        __cfaasm_label( debug  );
    481519
    482520        // Check if preemption is safe
     
    485523        if( __cfaasm_in( ip, check  ) ) { ready = false; goto EXIT; };
    486524        if( __cfaasm_in( ip, dsable ) ) { ready = false; goto EXIT; };
     525        if( __cfaasm_in( ip, debug  ) ) { ready = false; goto EXIT; };
    487526        if( !__cfaabi_tls.preemption_state.enabled) { ready = false; goto EXIT; };
    488527        if( __cfaabi_tls.preemption_state.in_progress ) { ready = false; goto EXIT; };
     
    696735}
    697736
    698 //=============================================================================================
    699 // Kernel Signal Debug
    700 //=============================================================================================
    701 
    702 void __cfaabi_check_preemption() {
    703         bool ready = __preemption_enabled();
    704         if(!ready) { abort("Preemption should be ready"); }
    705 
    706         sigset_t oldset;
    707         int ret;
    708         ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
    709         if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
    710 
    711         ret = sigismember(&oldset, SIGUSR1);
    712         if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
    713         if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
    714 
    715         ret = sigismember(&oldset, SIGALRM);
    716         if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
    717         if(ret == 0) { abort("ERROR SIGALRM is enabled"); }
    718 
    719         ret = sigismember(&oldset, SIGTERM);
    720         if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
    721         if(ret == 1) { abort("ERROR SIGTERM is disabled"); }
    722 }
    723 
    724 #ifdef __CFA_WITH_VERIFY__
    725 bool __cfaabi_dbg_in_kernel() {
    726         return !__preemption_enabled();
    727 }
    728 #endif
    729 
    730737// Local Variables: //
    731738// mode: c //
Note: See TracChangeset for help on using the changeset viewer.