[303c61d] | 1 | // |
---|
[891790ef] | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
[303c61d] | 6 | // |
---|
| 7 | // startup.c -- |
---|
| 8 | // |
---|
[891790ef] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Tue Jul 24 16:21:57 2018 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[aa15f49] | 12 | // Last Modified On : Mon Jan 17 16:41:54 2022 |
---|
| 13 | // Update Count : 55 |
---|
[303c61d] | 14 | // |
---|
[891790ef] | 15 | |
---|
[e112a24] | 16 | #include <time.h> // tzset |
---|
| 17 | #include <locale.h> // setlocale |
---|
| 18 | #include <stdlib.h> // getenv |
---|
[aa15f49] | 19 | #include "bits/defs.hfa" // rdtscl |
---|
[4834563] | 20 | #include "startup.hfa" |
---|
[1959528] | 21 | |
---|
[aa15f49] | 22 | extern uint32_t __global_random_seed; // sequential/concurrent |
---|
| 23 | extern uint32_t __global_random_state; // sequential |
---|
[891790ef] | 24 | |
---|
| 25 | extern "C" { |
---|
[96f002c1] | 26 | void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) )); |
---|
| 27 | void __cfaabi_appready_startup( void ) { |
---|
[6e7de84] | 28 | tzset(); // initialize time global variables |
---|
[891790ef] | 29 | #ifdef __CFA_DEBUG__ |
---|
| 30 | extern void heapAppStart(); |
---|
| 31 | heapAppStart(); |
---|
| 32 | #endif // __CFA_DEBUG__ |
---|
[96f002c1] | 33 | } // __cfaabi_appready_startup |
---|
[891790ef] | 34 | |
---|
[96f002c1] | 35 | void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) )); |
---|
| 36 | void __cfaabi_appready_shutdown( void ) { |
---|
[891790ef] | 37 | #ifdef __CFA_DEBUG__ |
---|
| 38 | extern void heapAppStop(); |
---|
| 39 | heapAppStop(); |
---|
| 40 | #endif // __CFA_DEBUG__ |
---|
[96f002c1] | 41 | } // __cfaabi_appready_shutdown |
---|
[891790ef] | 42 | |
---|
[032234bd] | 43 | void disable_interrupts() __attribute__(( weak )) libcfa_public {} |
---|
| 44 | void enable_interrupts() __attribute__(( weak )) libcfa_public {} |
---|
[96f002c1] | 45 | |
---|
| 46 | |
---|
| 47 | extern void __cfaabi_interpose_startup( void ); |
---|
| 48 | extern void __cfaabi_device_startup ( void ); |
---|
| 49 | extern void __cfaabi_device_shutdown ( void ); |
---|
| 50 | |
---|
| 51 | void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) )); |
---|
| 52 | void __cfaabi_core_startup( void ) { |
---|
[00f5fde] | 53 | __global_random_state = __global_random_seed = rdtscl(); |
---|
[96f002c1] | 54 | __cfaabi_interpose_startup(); |
---|
| 55 | __cfaabi_device_startup(); |
---|
| 56 | } // __cfaabi_core_startup |
---|
| 57 | |
---|
| 58 | void __cfaabi_core_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_CORE ) )); |
---|
| 59 | void __cfaabi_core_shutdown( void ) { |
---|
| 60 | __cfaabi_device_shutdown(); |
---|
| 61 | } // __cfaabi_core_shutdown |
---|
[891790ef] | 62 | } // extern "C" |
---|
| 63 | |
---|
[36463e2] | 64 | struct __spinlock_t; |
---|
[303c61d] | 65 | |
---|
[891790ef] | 66 | // Local Variables: // |
---|
| 67 | // mode: c // |
---|
| 68 | // tab-width: 4 // |
---|
| 69 | // End: // |
---|