wok-current view linld/stuff/src/CRTL.H @ rev 20542
linld: relative lseek for load.cpp
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Nov 30 15:12:24 2018 +0100 (2018-11-30) |
parents | 65366955881f |
children | cb4579b9835b |
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))
8 #define NULL 0
10 const unsigned MIN_STACK = 0x400;
11 const unsigned MAX_MALLOC = 0xF000;
13 const char A_RDONLY = 1; // for fileattr()
14 const char A_HIDDEN = 2;
15 const char A_SYSTEM = 4;
16 const char A_LABEL = 8;
17 const char A_DIRECTORY = 16;
18 const char A_ARCHIVE = 32;
21 const char O_RDONLY = 0; // for open()
22 const char O_BINARY = 0;
24 extern char text_start; extern char text_end;
25 extern char data_start; extern char data_end;
26 extern char bss_start; extern char bss_end;
27 extern char* heap_top;
28 extern char xfer_buf[4096];
30 void parse_cmdline();
31 extern _fastcall void strcatb(const char* a,const char* b);
32 extern _fastcall int strhead(const char* a,const char* head);
33 extern _fastcall int fileattr(const char* name);
34 //extern "C" int open(const char* name, int flags);
35 extern _fastcall int open(const char* name);
36 extern _fastcall int close(int fd);
37 extern _fastcall int read(int fd, void* data, int sz);
38 extern _fastcall long lseekcur(int fd, int where);
39 extern _fastcall int puts(const char* s);
40 extern pascal unsigned long strtol(const char *s);
42 // Extensions
43 #define cli() do { asm { cli } } while(0)
44 #define sti() do { asm { sti } } while(0)
45 #define int3() do { asm { db 0cch } } while(0)
46 #define nop() do { asm { db 90h } } while(0)
47 extern char no_exit;
48 extern _fastcall int die(const char* msg);
49 //extern "C" char* malloc_or_die(unsigned size);
50 //extern "C" unsigned long* malloc_bufv_or_die(struct image_himem *m);
51 extern _fastcall int malloc_or_die(unsigned size);
52 extern _fastcall int malloc_bufv_or_die(struct image_himem *m);
53 extern _fastcall void set_cmdline(const char *filename);