1 | // |
---|
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. |
---|
6 | // |
---|
7 | // startup.c -- |
---|
8 | // |
---|
9 | // Author : Peter A. Buhr |
---|
10 | // Created On : Tue Jul 24 16:21:57 2018 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Thu Oct 6 13:51:57 2022 |
---|
13 | // Update Count : 57 |
---|
14 | // |
---|
15 | |
---|
16 | #include <time.h> // tzset |
---|
17 | #include <locale.h> // setlocale |
---|
18 | #include <stdlib.h> // getenv |
---|
19 | #include "bits/defs.hfa" // rdtscl |
---|
20 | #include "startup.hfa" |
---|
21 | |
---|
22 | extern uint32_t __global_random_seed; // sequential/concurrent |
---|
23 | extern uint32_t __global_random_state; // sequential |
---|
24 | |
---|
25 | extern "C" { |
---|
26 | void __cfaabi_memory_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_MEMORY ) )); |
---|
27 | void __cfaabi_memory_startup( void ) { |
---|
28 | extern void memory_startup(); |
---|
29 | memory_startup(); |
---|
30 | } // __cfaabi_memory_startup |
---|
31 | |
---|
32 | void __cfaabi_memory_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_MEMORY ) )); |
---|
33 | void __cfaabi_memory_shutdown( void ) { |
---|
34 | extern void memory_shutdown(); |
---|
35 | memory_shutdown(); |
---|
36 | } // __cfaabi_memory_shutdown |
---|
37 | |
---|
38 | void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) )); |
---|
39 | void __cfaabi_appready_startup( void ) { |
---|
40 | tzset(); // initialize time global variables |
---|
41 | extern void heapAppStart(); |
---|
42 | heapAppStart(); |
---|
43 | } // __cfaabi_appready_startup |
---|
44 | |
---|
45 | void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) )); |
---|
46 | void __cfaabi_appready_shutdown( void ) { |
---|
47 | extern void heapAppStop(); |
---|
48 | heapAppStop(); |
---|
49 | } // __cfaabi_appready_shutdown |
---|
50 | |
---|
51 | void disable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {} |
---|
52 | void enable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {} |
---|
53 | bool poll_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public { return false; } |
---|
54 | |
---|
55 | __attribute__((visibility("hidden"))) extern void * const __start_cfatext_nopreempt; |
---|
56 | __attribute__((visibility("hidden"))) extern void * const __stop_cfatext_nopreempt; |
---|
57 | |
---|
58 | __attribute__((visibility("protected"))) const __cfa_nopreempt_region __libcfa_nopreempt @= { |
---|
59 | (void * const)&__start_cfatext_nopreempt, |
---|
60 | (void * const)&__stop_cfatext_nopreempt |
---|
61 | }; |
---|
62 | |
---|
63 | |
---|
64 | extern void __cfaabi_interpose_startup( void ); |
---|
65 | extern void __cfaabi_device_startup ( void ); |
---|
66 | extern void __cfaabi_device_shutdown ( void ); |
---|
67 | |
---|
68 | void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) )); |
---|
69 | void __cfaabi_core_startup( void ) { |
---|
70 | __global_random_state = __global_random_seed = rdtscl(); |
---|
71 | __cfaabi_interpose_startup(); |
---|
72 | __cfaabi_device_startup(); |
---|
73 | } // __cfaabi_core_startup |
---|
74 | |
---|
75 | void __cfaabi_core_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_CORE ) )); |
---|
76 | void __cfaabi_core_shutdown( void ) { |
---|
77 | __cfaabi_device_shutdown(); |
---|
78 | } // __cfaabi_core_shutdown |
---|
79 | } // extern "C" |
---|
80 | |
---|
81 | struct __spinlock_t; |
---|
82 | |
---|
83 | // Local Variables: // |
---|
84 | // mode: c // |
---|
85 | // tab-width: 4 // |
---|
86 | // End: // |
---|