Changeset 7dd98b6


Ignore:
Timestamp:
Nov 3, 2021, 11:47:32 AM (13 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
a1574e2
Parents:
3eb540fb
Message:

Moved cfa_main_returned to libcfa so it works when the main is written in C.

Location:
libcfa
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/bootloader.cf

    r3eb540fb r7dd98b6  
    33char ** cfa_args_argv;
    44char ** cfa_args_envp;
    5 int cfa_main_returned = 0;
     5__attribute__((weak)) extern int cfa_main_returned;
    66
    77int main(int argc, char* argv[], char* envp[]) {
     
    1010        cfa_args_envp = envp;
    1111        int ret = invoke_main(argc, argv, envp);
    12         cfa_main_returned = 1;
     12        if(&cfa_main_returned) cfa_main_returned = 1;
    1313        return ret;
    1414}
  • libcfa/src/concurrency/kernel/startup.cfa

    r3eb540fb r7dd98b6  
    100100// Other Forward Declarations
    101101extern void __wake_proc(processor *);
     102extern int cfa_main_returned;                                                   // from interpose.cfa
    102103
    103104//-----------------------------------------------------------------------------
     
    268269
    269270static void __kernel_shutdown(void) {
     271        if(!cfa_main_returned) return;
    270272        /* paranoid */ verify( __preemption_enabled() );
    271273        disable_interrupts();
  • libcfa/src/heap.cfa

    r3eb540fb r7dd98b6  
    102102} // prtUnfreed
    103103
    104 extern int cfa_main_returned;                                                   // from bootloader.cf
     104extern int cfa_main_returned;                                                   // from interpose.cfa
    105105extern "C" {
    106106        void heapAppStart() {                                                           // called by __cfaabi_appready_startup
  • libcfa/src/interpose.cfa

    r3eb540fb r7dd98b6  
    9494} __cabi_libc;
    9595
     96int cfa_main_returned;
     97
    9698extern "C" {
    9799        void __cfaabi_interpose_startup( void ) {
    98100                const char *version = 0p;
     101                cfa_main_returned = 0;
    99102
    100103                preload_libgcc();
     
    313316
    314317void sigHandler_term( __CFA_SIGPARMS__ ) {
     318        write( STDERR_FILENO, "Handler Term\n", sizeof("Handler Term\n") - 1 );
    315319        abort( true, "Application interrupted by signal: %s.\n", strsignal( sig ) );
    316320}
Note: See TracChangeset for help on using the changeset viewer.