source: libcfa/src/startup.cfa@ 73d0a84c

Last change on this file since 73d0a84c was 4020f09, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

formatting, switch to typedef for PRNG complex state

  • Property mode set to 100644
File size: 3.0 KB
Line 
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 : Mon Dec 5 11:41:58 2022
13// Update Count : 73
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 "bits/random.hfa" // rdtscl
21#include "startup.hfa"
22
23extern size_t __global_random_seed; // sequential/concurrent
24extern PRNG_STATE_T __global_random_state; // sequential
25
26extern "C" {
27 void __cfaabi_memory_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_MEMORY ) ));
28 void __cfaabi_memory_startup( void ) {
29 extern void memory_startup();
30 memory_startup();
31 } // __cfaabi_memory_startup
32
33 void __cfaabi_memory_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_MEMORY ) ));
34 void __cfaabi_memory_shutdown( void ) {
35 extern void memory_shutdown();
36 memory_shutdown();
37 } // __cfaabi_memory_shutdown
38
39 void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));
40 void __cfaabi_appready_startup( void ) {
41 tzset(); // initialize time global variables
42 extern void heapAppStart();
43 heapAppStart();
44 } // __cfaabi_appready_startup
45
46 void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));
47 void __cfaabi_appready_shutdown( void ) {
48 extern void heapAppStop();
49 heapAppStop();
50 } // __cfaabi_appready_shutdown
51
52 void disable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {}
53 void enable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {}
54 bool poll_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public { return false; }
55
56 __attribute__((visibility("hidden"))) extern void * const __start_cfatext_nopreempt;
57 __attribute__((visibility("hidden"))) extern void * const __stop_cfatext_nopreempt;
58
59 __attribute__((visibility("protected"))) const __cfa_nopreempt_region __libcfa_nopreempt @= {
60 (void * const)&__start_cfatext_nopreempt,
61 (void * const)&__stop_cfatext_nopreempt
62 };
63
64
65 extern void __cfaabi_interpose_startup( void );
66 extern void __cfaabi_device_startup ( void );
67 extern void __cfaabi_device_shutdown ( void );
68
69 void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
70 void __cfaabi_core_startup( void ) {
71 __global_random_seed = rdtscl();
72 PRNG_SET_SEED( __global_random_state, __global_random_seed );
73
74 __cfaabi_interpose_startup();
75 __cfaabi_device_startup();
76 } // __cfaabi_core_startup
77
78 void __cfaabi_core_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_CORE ) ));
79 void __cfaabi_core_shutdown( void ) {
80 __cfaabi_device_shutdown();
81 } // __cfaabi_core_shutdown
82} // extern "C"
83
84struct __spinlock_t;
85
86// Local Variables: //
87// mode: c //
88// tab-width: 4 //
89// End: //
Note: See TracBrowser for help on using the repository browser.