source: libcfa/src/startup.cfa @ 760c88c

ast-experimental
Last change on this file since 760c88c was 4020f09, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

formatting, switch to typedef for PRNG complex state

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[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
[4020f09]12// Last Modified On : Mon Dec  5 11:41:58 2022
13// Update Count     : 73
[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
[d2ad151]20#include "bits/random.hfa"                                                              // rdtscl
[4834563]21#include "startup.hfa"
[1959528]22
[dd46fd3]23extern size_t __global_random_seed;                                             // sequential/concurrent
24extern PRNG_STATE_T __global_random_state;                              // sequential
[891790ef]25
26extern "C" {
[116a2ea]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
[96f002c1]39        void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));
40        void __cfaabi_appready_startup( void ) {
[6e7de84]41                tzset();                                                                                // initialize time global variables
[891790ef]42                extern void heapAppStart();
43                heapAppStart();
[96f002c1]44        } // __cfaabi_appready_startup
[891790ef]45
[96f002c1]46        void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));
47        void __cfaabi_appready_shutdown( void ) {
[891790ef]48                extern void heapAppStop();
49                heapAppStop();
[96f002c1]50        } // __cfaabi_appready_shutdown
[891790ef]51
[b443db0]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        };
[96f002c1]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 ) {
[dd46fd3]71                __global_random_seed = rdtscl();
72                PRNG_SET_SEED( __global_random_state, __global_random_seed );
[4020f09]73
[96f002c1]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
[891790ef]82} // extern "C"
83
[36463e2]84struct __spinlock_t;
[303c61d]85
[891790ef]86// Local Variables: //
87// mode: c //
88// tab-width: 4 //
89// End: //
Note: See TracBrowser for help on using the repository browser.