wok-6.x annotate 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 |
rev | line source |
---|---|
pascal@19515 | 1 // This file is distributed under GPL |
pascal@19515 | 2 // |
pascal@19515 | 3 // Bare bones of C runtime library |
pascal@19515 | 4 |
pascal@19515 | 5 #define MK_FP(seg,ofs) ((void _seg *)(seg) + (void near *)(ofs)) |
pascal@19515 | 6 #define FP_SEG(fp) ((unsigned) (void _seg*) (void far*)(fp)) |
pascal@19515 | 7 #define FP_OFF(fp) ((unsigned) (fp)) |
pascal@20528 | 8 #define NULL 0 |
pascal@19515 | 9 |
pascal@19515 | 10 const unsigned MIN_STACK = 0x400; |
pascal@19515 | 11 const unsigned MAX_MALLOC = 0xF000; |
pascal@19515 | 12 |
pascal@19636 | 13 const char A_RDONLY = 1; // for fileattr() |
pascal@19636 | 14 const char A_HIDDEN = 2; |
pascal@19636 | 15 const char A_SYSTEM = 4; |
pascal@19636 | 16 const char A_LABEL = 8; |
pascal@19636 | 17 const char A_DIRECTORY = 16; |
pascal@19636 | 18 const char A_ARCHIVE = 32; |
pascal@19538 | 19 |
pascal@19538 | 20 |
pascal@19636 | 21 const char O_RDONLY = 0; // for open() |
pascal@19636 | 22 const char O_BINARY = 0; |
pascal@19515 | 23 |
pascal@19515 | 24 extern char text_start; extern char text_end; |
pascal@19515 | 25 extern char data_start; extern char data_end; |
pascal@19515 | 26 extern char bss_start; extern char bss_end; |
pascal@19515 | 27 extern char* heap_top; |
pascal@20538 | 28 extern char xfer_buf[4096]; |
pascal@19515 | 29 |
pascal@19515 | 30 void parse_cmdline(); |
pascal@20538 | 31 extern _fastcall void strcatb(const char* a,const char* b); |
pascal@20538 | 32 extern _fastcall int strhead(const char* a,const char* head); |
pascal@20538 | 33 extern _fastcall int fileattr(const char* name); |
pascal@19546 | 34 //extern "C" int open(const char* name, int flags); |
pascal@20538 | 35 extern _fastcall int open(const char* name); |
pascal@20538 | 36 extern _fastcall int close(int fd); |
pascal@20538 | 37 extern _fastcall int read(int fd, void* data, int sz); |
pascal@20542 | 38 extern _fastcall long lseekcur(int fd, int where); |
pascal@20538 | 39 extern _fastcall int puts(const char* s); |
pascal@20528 | 40 extern pascal unsigned long strtol(const char *s); |
pascal@19515 | 41 |
pascal@19515 | 42 // Extensions |
pascal@19515 | 43 #define cli() do { asm { cli } } while(0) |
pascal@19515 | 44 #define sti() do { asm { sti } } while(0) |
pascal@19515 | 45 #define int3() do { asm { db 0cch } } while(0) |
pascal@19515 | 46 #define nop() do { asm { db 90h } } while(0) |
pascal@19515 | 47 extern char no_exit; |
pascal@20538 | 48 extern _fastcall int die(const char* msg); |
pascal@20528 | 49 //extern "C" char* malloc_or_die(unsigned size); |
pascal@20528 | 50 //extern "C" unsigned long* malloc_bufv_or_die(struct image_himem *m); |
pascal@20538 | 51 extern _fastcall int malloc_or_die(unsigned size); |
pascal@20538 | 52 extern _fastcall int malloc_bufv_or_die(struct image_himem *m); |
pascal@20538 | 53 extern _fastcall void set_cmdline(const char *filename); |