wok-current view linld/stuff/src/CRTL.H @ rev 19634
linld: some fixes for strtoul
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Jan 16 10:15:15 2017 +0100 (2017-01-16) |
parents | e428345df29a |
children | 76087975885f |
line source
1 // This file is distributed under GPL
2 //
3 // Bare bones of C runtime library
5 #define MK_FP(seg,ofs) ((void _seg *)(seg) + (void near *)(ofs))
6 #define FP_SEG(fp) ((unsigned) (void _seg*) (void far*)(fp))
7 #define FP_OFF(fp) ((unsigned) (fp))
9 const unsigned MIN_STACK = 0x400;
10 const unsigned MAX_MALLOC = 0xF000;
12 const A_RDONLY = 1; // for fileattr()
13 const A_HIDDEN = 2;
14 const A_SYSTEM = 4;
15 const A_LABEL = 8;
16 const A_DIRECTORY = 16;
17 const A_ARCHIVE = 32;
20 const O_RDONLY = 0; // for open()
21 const O_BINARY = 0;
23 extern char text_start; extern char text_end;
24 extern char data_start; extern char data_end;
25 extern char bss_start; extern char bss_end;
26 extern char* heap_top;
28 extern int ximage_size, ximage_fd;
30 void parse_cmdline();
31 extern "C" char* strcpy(const char* a,const char* b);
32 extern "C" char* strcat(const char* a,const char* b);
33 extern "C" char* strcatb(const char* a,const char* b);
34 extern "C" int strhead(const char* a,const char* b);
35 extern "C" int fileattr(const char* name);
36 //extern "C" int open(const char* name, int flags);
37 extern "C" int open(const char* name);
38 extern "C" int close(int fd);
39 extern "C" void exit(int n);
40 extern "C" void abort();
41 extern "C" int read(int fd, void* data, int sz);
42 extern "C" int write(int fd, const void* data, int sz);
43 extern "C" long lseekset(int fd, long sz);
44 extern "C" void* malloc(unsigned sz);
45 extern "C" void puts(const char* s);
46 extern "C" unsigned long strtol(const char *s);
48 // Extensions
49 //static void barrier() {}
50 //static void cli() { asm { cli } }
51 //static void sti() { asm { sti } }
52 #define barrier() do {} while(0)
53 #define cli() do { asm { cli } } while(0)
54 #define sti() do { asm { sti } } while(0)
55 #define int3() do { asm { db 0cch } } while(0)
56 #define nop() do { asm { db 90h } } while(0)
57 extern char no_exit;
58 extern "C" int die(const char* msg);
59 extern "C" char* malloc_or_die(unsigned size);
60 extern "C" unsigned long* malloc_bufv_or_die(struct image_himem *m);