source: libcfa/src/startup.cfa@ 15a0f6f

Last change on this file since 15a0f6f was 97c75bf, checked in by Peter A. Buhr <pabuhr@…>, 5 days ago

change routine name from rdtscl to rdtsc

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