Ignore:
Timestamp:
Aug 18, 2020, 1:58:59 PM (16 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
133a161, 13d33a7
Parents:
93526ef
Message:

Added forward/reverse rng for later use in the ready queue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/startup.cfa

    r93526ef rf2384c9a  
    7878static void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info);
    7979
     80#if defined(__CFA_WITH_VERIFY__)
     81        static bool verify_fwd_bck_rng(void);
     82#endif
     83
    8084//-----------------------------------------------------------------------------
    8185// Forward Declarations for other modules
     
    158162        __cfa_dbg_global_clusters.list{ __get };
    159163        __cfa_dbg_global_clusters.lock{};
     164
     165        /* paranoid */ verify( verify_fwd_bck_rng() );
    160166
    161167        // Initialize the global scheduler lock
     
    677683        return stack;
    678684}
     685
     686#if defined(__CFA_WITH_VERIFY__)
     687static bool verify_fwd_bck_rng(void) {
     688        kernelTLS.ready_rng.fwd_seed = 25214903917_l64u * (rdtscl() ^ (uintptr_t)&verify_fwd_bck_rng);
     689
     690        unsigned values[10];
     691        for(i; 10) {
     692                values[i] = __tls_rand_fwd();
     693        }
     694
     695        __tls_rand_advance_bck();
     696
     697        for ( i; 9 -~= 0 ) {
     698                if(values[i] != __tls_rand_bck()) {
     699                        return false;
     700                }
     701        }
     702
     703        return true;
     704}
     705#endif
Note: See TracChangeset for help on using the changeset viewer.