Subversion Repositories Kolibri OS

Rev

Rev 6527 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6527 serge 1
/*
2
 * This file has no copyright assigned and is placed in the Public Domain.
3
 * This file is a part of the kos32-runtime package.
4
 * No warranty is given; refer to the file DISCLAIMER within the package.
5
 *
6
 * Source code for the startup proceedures used by all programs. This code
7
 * is compiled to make crt1.o, which should be located in the library path.
8
 *
9
 */
10
 
11
void *load_libc(void);
12
void* get_entry_point(void *raw);
13
 
14
void  __attribute__((noreturn))
15
__crt_startup (void)
16
{
17
    void __attribute__((noreturn)) (*entry)(void *img);
18
    void    *img;
19
 
20
    img = load_libc();
21
 
22
    if(!img)
23
    {
6902 ashmew2 24
        // Inform the user via BOARD that libc could not be loaded.
25
        char *errormsg = "[ERROR] libc.dll failed to load. is /kolibrios folder configured?\n";
26
        while (*errormsg) {
27
          __asm__ __volatile__("int $0x40"::"a"(63), "b"(1), "c"(*errormsg));
28
          ++errormsg;
29
        }
30
 
31
        // Exit
6527 serge 32
        asm ("int $0x40" ::"a"(-1));
33
    };
34
 
35
    entry = get_entry_point(img);
36
    entry(img);
37
}
38