Ignore:
Timestamp:
Feb 12, 2018, 11:57:55 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
fd062a66
Parents:
c40e7c5 (diff), cfe2f0a (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
  • src/libcfa/concurrency/preemption.c

    rc40e7c5 rd56ca354  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  6 15:00:36 2018
    13 // Update Count     : 10
     12// Last Modified On : Fri Feb  9 16:38:13 2018
     13// Update Count     : 14
    1414//
    1515
    1616#include "preemption.h"
    1717
    18 #define ftype `ftype`
    1918extern "C" {
    2019#include <errno.h>
     
    2322#include <unistd.h>
    2423}
    25 #undef ftype
    2624
    2725#include "bits/signal.h"
     
    5048
    5149// Machine specific register name
    52 #if   defined(__x86_64__)
     50#if   defined( __i386 )
     51#define CFA_REG_IP gregs[REG_EIP]
     52#elif defined( __x86_64 )
    5353#define CFA_REG_IP gregs[REG_RIP]
    54 #elif defined(__i386__)
    55 #define CFA_REG_IP gregs[REG_EIP]
    56 #elif defined(__ARM_ARCH__)
     54#elif defined( __ARM_ARCH )
    5755#define CFA_REG_IP arm_pc
     56#else
     57#error unknown hardware architecture
    5858#endif
    5959
     
    197197
    198198        if ( pthread_sigmask( SIG_UNBLOCK, &mask, NULL ) == -1 ) {
    199             abortf( "internal error, pthread_sigmask" );
     199            abort( "internal error, pthread_sigmask" );
    200200        }
    201201}
     
    208208
    209209        if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
    210             abortf( "internal error, pthread_sigmask" );
     210            abort( "internal error, pthread_sigmask" );
    211211        }
    212212}
     
    247247// Called from kernel_startup
    248248void kernel_start_preemption() {
    249         __cfaabi_dbg_print_safe("Kernel : Starting preemption\n");
     249        __cfaabi_dbg_print_safe( "Kernel : Starting preemption\n" );
    250250
    251251        // Start with preemption disabled until ready
     
    268268// Called from kernel_shutdown
    269269void kernel_stop_preemption() {
    270         __cfaabi_dbg_print_safe("Kernel : Preemption stopping\n");
     270        __cfaabi_dbg_print_safe( "Kernel : Preemption stopping\n" );
    271271
    272272        // Block all signals since we are already shutting down
     
    284284        // Preemption is now fully stopped
    285285
    286         __cfaabi_dbg_print_safe("Kernel : Preemption stopped\n");
     286        __cfaabi_dbg_print_safe( "Kernel : Preemption stopped\n" );
    287287}
    288288
     
    322322                case PREEMPT_TERMINATE: verify(this_processor->do_terminate);
    323323                default:
    324                         abortf( "internal error, signal value is %d", sfp->si_value.sival_int );
     324                        abort( "internal error, signal value is %d", sfp->si_value.sival_int );
    325325        }
    326326
     
    328328        if( !preemption_ready() ) { return; }
    329329
    330         __cfaabi_dbg_print_buffer_decl(" KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
     330        __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
    331331
    332332        preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
     
    348348
    349349        if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
    350             abortf( "internal error, pthread_sigmask" );
     350            abort( "internal error, pthread_sigmask" );
    351351        }
    352352
     
    365365                                        continue;
    366366                        case EINVAL :
    367                                         abortf("Timeout was invalid.");
     367                                        abort( "Timeout was invalid." );
    368368                                default:
    369                                         abortf("Unhandled error %d", err);
     369                                        abort( "Unhandled error %d", err);
    370370                        }
    371371                }
     
    374374                assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
    375375
    376                 // __cfaabi_dbg_print_safe("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
     376                // __cfaabi_dbg_print_safe( "Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
    377377                // Switch on the code (a.k.a. the sender) to
    378378                switch( info.si_code )
     
    382382                case SI_TIMER:
    383383                case SI_KERNEL:
    384                         // __cfaabi_dbg_print_safe("Kernel : Preemption thread tick\n");
     384                        // __cfaabi_dbg_print_safe( "Kernel : Preemption thread tick\n" );
    385385                        lock( event_kernel->lock __cfaabi_dbg_ctx2 );
    386386                        tick_preemption();
     
    396396
    397397EXIT:
    398         __cfaabi_dbg_print_safe("Kernel : Preemption thread stopping\n");
     398        __cfaabi_dbg_print_safe( "Kernel : Preemption thread stopping\n" );
    399399        return NULL;
    400400}
Note: See TracChangeset for help on using the changeset viewer.