source: libcfa/src/startup.cfa @ b443db0

ADTast-experimentalpthread-emulation
Last change on this file since b443db0 was b443db0, checked in by Thierry Delisle <tdelisle@…>, 18 months ago

Change how no preempts zone are implemented. From begin/end tags to specific sections.

  • Property mode set to 100644
File size: 2.6 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 Jan 17 16:41:54 2022
13// Update Count     : 55
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
22extern uint32_t __global_random_seed;                                   // sequential/concurrent
23extern uint32_t __global_random_state;                                  // sequential
24
25extern "C" {
26        void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));
27        void __cfaabi_appready_startup( void ) {
28                tzset();                                                                                // initialize time global variables
29                #ifdef __CFA_DEBUG__
30                extern void heapAppStart();
31                heapAppStart();
32                #endif // __CFA_DEBUG__
33        } // __cfaabi_appready_startup
34
35        void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));
36        void __cfaabi_appready_shutdown( void ) {
37                #ifdef __CFA_DEBUG__
38                extern void heapAppStop();
39                heapAppStop();
40                #endif // __CFA_DEBUG__
41        } // __cfaabi_appready_shutdown
42
43        void disable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {}
44        void enable_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public {}
45        bool poll_interrupts() __attribute__(( weak )) libcfa_nopreempt libcfa_public { return false; }
46
47        __attribute__((visibility("hidden"))) extern void * const __start_cfatext_nopreempt;
48        __attribute__((visibility("hidden"))) extern void * const __stop_cfatext_nopreempt;
49
50        __attribute__((visibility("protected"))) const __cfa_nopreempt_region __libcfa_nopreempt @= {
51                (void * const)&__start_cfatext_nopreempt,
52                (void * const)&__stop_cfatext_nopreempt
53        };
54
55
56        extern void __cfaabi_interpose_startup( void );
57        extern void __cfaabi_device_startup   ( void );
58        extern void __cfaabi_device_shutdown  ( void );
59
60        void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
61        void __cfaabi_core_startup( void ) {
62                __global_random_state = __global_random_seed = rdtscl();
63                __cfaabi_interpose_startup();
64                __cfaabi_device_startup();
65        } // __cfaabi_core_startup
66
67        void __cfaabi_core_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_CORE ) ));
68        void __cfaabi_core_shutdown( void ) {
69                __cfaabi_device_shutdown();
70        } // __cfaabi_core_shutdown
71} // extern "C"
72
73struct __spinlock_t;
74
75// Local Variables: //
76// mode: c //
77// tab-width: 4 //
78// End: //
Note: See TracBrowser for help on using the repository browser.