Subversion Repositories Kolibri OS

Rev

Rev 6527 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6527 Rev 6902
1
/*
1
/*
2
 * This file has no copyright assigned and is placed in the Public Domain.
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.
3
 * This file is a part of the kos32-runtime package.
4
 * No warranty is given; refer to the file DISCLAIMER within the package.
4
 * No warranty is given; refer to the file DISCLAIMER within the package.
5
 *
5
 *
6
 * Source code for the startup proceedures used by all programs. This code
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.
7
 * is compiled to make crt1.o, which should be located in the library path.
8
 *
8
 *
9
 */
9
 */
10
 
10
 
11
void *load_libc(void);
11
void *load_libc(void);
12
void* get_entry_point(void *raw);
12
void* get_entry_point(void *raw);
13
 
13
 
14
void  __attribute__((noreturn))
14
void  __attribute__((noreturn))
15
__crt_startup (void)
15
__crt_startup (void)
16
{
16
{
17
    void __attribute__((noreturn)) (*entry)(void *img);
17
    void __attribute__((noreturn)) (*entry)(void *img);
18
    void    *img;
18
    void    *img;
19
 
19
 
20
    img = load_libc();
20
    img = load_libc();
21
 
21
 
22
    if(!img)
22
    if(!img)
23
    {
23
    {
-
 
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
24
        asm ("int $0x40" ::"a"(-1));
32
        asm ("int $0x40" ::"a"(-1));
25
    };
33
    };
26
 
34
 
27
    entry = get_entry_point(img);
35
    entry = get_entry_point(img);
28
    entry(img);
36
    entry(img);
29
}
37
}