wok-6.x rev 19826
linld: remove dead code
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Mar 07 12:21:16 2017 +0100 (2017-03-07) |
parents | 6f494adb2c71 |
children | e619bff66a02 |
files | linld/stuff/src/CRTL.ASM linld/stuff/src/CRTL.H linld/stuff/src/CRTLX.H linld/stuff/src/ISO9660.CPP linld/stuff/src/ISO9660.H linld/stuff/src/LINLD.CPP |
line diff
1.1 --- a/linld/stuff/src/CRTL.ASM Sun Mar 05 13:22:08 2017 +0100 1.2 +++ b/linld/stuff/src/CRTL.ASM Tue Mar 07 12:21:16 2017 +0100 1.3 @@ -51,18 +51,20 @@ 1.4 ;char* strcat(const char* a, const char* b); 1.5 ;char* strcatb(const char* a, const char* b); 1.6 ;*************************************************************** 1.7 - global _strcpy:near 1.8 - proc _strcpy near 1.9 + global _strcatb:near 1.10 + proc _strcatb near 1.11 1.12 - mov dl,0 1.13 + ifdef EXTRA 1.14 + mov dl,3 1.15 db 0bbh ; mov bx,imm opcode 1.16 global _strcat:near 1.17 _strcat: 1.18 mov dl,1 1.19 db 0bbh ; mov bx,imm opcode 1.20 - global _strcatb:near 1.21 -_strcatb: 1.22 - mov dl,3 1.23 + global _strcpy:near 1.24 +_strcpy: 1.25 + mov dl,0 1.26 + endif 1.27 pop ax ;caller return address 1.28 pop cx ; a 1.29 pop bx ; b 1.30 @@ -71,15 +73,19 @@ 1.31 push ax 1.32 push si 1.33 mov si,cx 1.34 + ifdef EXTRA 1.35 shr dl,1 1.36 jnc @@nocat 1.37 + endif 1.38 @@catlp: 1.39 lodsb 1.40 cmp al,0 1.41 jne @@catlp 1.42 dec si 1.43 + ifdef EXTRA 1.44 shr dl,1 1.45 jnc @@nocat 1.46 + endif 1.47 cmp cx,si 1.48 jz @@nocat 1.49 mov [word si],20h 1.50 @@ -96,7 +102,7 @@ 1.51 pop si 1.52 ret 1.53 1.54 - endp _strcpy 1.55 + endp _strcatb 1.56 1.57 1.58 ;*************************************************************** 1.59 @@ -159,6 +165,29 @@ 1.60 endp _puts 1.61 1.62 1.63 + ifdef EXTRA 1.64 +;*************************************************************** 1.65 +;int chdir(char *path); 1.66 +;*************************************************************** 1.67 + global _chdir:near 1.68 + proc _chdir near 1.69 + 1.70 + pop ax 1.71 + pop dx 1.72 + push dx 1.73 + push ax 1.74 +chdir: 1.75 + stc 1.76 + mov ax,713Bh 1.77 + int 21h 1.78 + jnc chkc 1.79 + mov ah,3Bh 1.80 + jmp dos 1.81 + 1.82 + endp _chdir 1.83 + endif 1.84 + 1.85 + 1.86 ;*************************************************************** 1.87 ;int fileattr(const char* name); 1.88 ;*************************************************************** 1.89 @@ -1352,30 +1381,6 @@ 1.90 1.91 1.92 ;*************************************************************** 1.93 -;int chdir(char *path); 1.94 -;*************************************************************** 1.95 - global _chdir:near 1.96 - proc _chdir near 1.97 - 1.98 - pop ax 1.99 - pop dx 1.100 - push dx 1.101 - push ax 1.102 -chdir: 1.103 - stc 1.104 - mov ax,713Bh 1.105 - int 21h 1.106 - jnc @@end 1.107 - mov ah,3Bh 1.108 - int 21h 1.109 -@@end: 1.110 - sbb ax,ax 1.111 - ret 1.112 - 1.113 - endp _chdir 1.114 - 1.115 - 1.116 -;*************************************************************** 1.117 ;int chdirname(char *path) 1.118 ;*************************************************************** 1.119 global _chdirname:near
2.1 --- a/linld/stuff/src/CRTL.H Sun Mar 05 13:22:08 2017 +0100 2.2 +++ b/linld/stuff/src/CRTL.H Tue Mar 07 12:21:16 2017 +0100 2.3 @@ -25,11 +25,7 @@ 2.4 extern char bss_start; extern char bss_end; 2.5 extern char* heap_top; 2.6 2.7 -extern int ximage_size, ximage_fd; 2.8 - 2.9 void parse_cmdline(); 2.10 -extern "C" char* strcpy(const char* a,const char* b); 2.11 -extern "C" char* strcat(const char* a,const char* b); 2.12 extern "C" char* strcatb(const char* a,const char* b); 2.13 extern "C" int strhead(const char* a,const char* b); 2.14 extern "C" int fileattr(const char* name); 2.15 @@ -46,10 +42,6 @@ 2.16 extern "C" unsigned long strtol(const char *s); 2.17 2.18 // Extensions 2.19 -//static void barrier() {} 2.20 -//static void cli() { asm { cli } } 2.21 -//static void sti() { asm { sti } } 2.22 -#define barrier() do {} while(0) 2.23 #define cli() do { asm { cli } } while(0) 2.24 #define sti() do { asm { sti } } while(0) 2.25 #define int3() do { asm { db 0cch } } while(0)
3.1 --- a/linld/stuff/src/CRTLX.H Sun Mar 05 13:22:08 2017 +0100 3.2 +++ b/linld/stuff/src/CRTLX.H Tue Mar 07 12:21:16 2017 +0100 3.3 @@ -1,6 +1,8 @@ 3.4 // This file is distributed under GPL 3.5 // 3.6 #define NULL 0 3.7 +extern "C" char* strcpy(const char* a,const char* b); 3.8 +extern "C" char* strcat(const char* a,const char* b); 3.9 extern "C" int strcmp(const char* a,const char* b); 3.10 extern "C" int strlen(const char* s); 3.11 extern "C" char* strstr(const char* a,const char* b); 3.12 @@ -12,5 +14,5 @@ 3.13 extern "C" void try_default_args(); 3.14 extern "C" long lseekset(int fd, unsigned long sz); 3.15 #define seekset(fd,sz) lseekset(fd,(unsigned long) sz) 3.16 -extern long cpu_features; 3.17 -#define cpuhaslm() (((char *)&cpu_features)[3]&(char)0x20) 3.18 +extern char cpu_features[]; 3.19 +#define cpuhaslm() (cpu_features[3]&0x20)
4.1 --- a/linld/stuff/src/ISO9660.CPP Sun Mar 05 13:22:08 2017 +0100 4.2 +++ b/linld/stuff/src/ISO9660.CPP Tue Mar 07 12:21:16 2017 +0100 4.3 @@ -5,13 +5,13 @@ 4.4 4.5 #define SECTORSZ 2048 4.6 #define SECTORBITS 11 4.7 -static char buffer[SECTORSZ]; 4.8 +static char buffer[SECTORSZ+512]; // RR overflow 4.9 struct isostate isostate; 4.10 4.11 static int readsector(const unsigned long *offset) 4.12 { 4.13 return (isolseek(offset) != -1 4.14 - && read(isostate.fd, buffer, SECTORSZ) == SECTORSZ); 4.15 + && read(isostate.fd, buffer, sizeof(buffer)) >= SECTORSZ); 4.16 } 4.17 4.18 int isoreset(char *name) 4.19 @@ -26,7 +26,7 @@ 4.20 return -1; 4.21 } 4.22 x->dirofs = (* (unsigned long *) (buffer + 0x9E)) << SECTORBITS; 4.23 - x->dirsize = * (unsigned long *) (buffer + 0xA6); 4.24 + x->dirsize = filesize2dirsize(* (unsigned long *) (buffer + 0xA6)); 4.25 return 0; 4.26 } 4.27 4.28 @@ -41,20 +41,20 @@ 4.29 struct isostate *x=&isostate; 4.30 4.31 if (restart) { 4.32 - x->curpos = SECTORSZ; 4.33 + x->curdirsize = x->dirsize; 4.34 x->curdirofs = x->dirofs; 4.35 - x->curdirsize = x->dirsize; 4.36 + goto restarted; 4.37 } 4.38 if (x->curpos >= SECTORSZ || * (short *) (buffer + x->curpos) == 0) { 4.39 - if (x->curdirsize < SECTORSZ) return -1; 4.40 + if (x->curdirsize < DIRSECTORSZ) return -1; 4.41 + restarted: 4.42 readsector(&x->curdirofs); 4.43 x->curdirofs += SECTORSZ; 4.44 - x->curdirsize -= SECTORSZ; 4.45 + x->curdirsize -= DIRSECTORSZ; 4.46 x->curpos = 0; 4.47 } 4.48 p = buffer + x->curpos; 4.49 - size = * (short *) p; 4.50 - if (size == 0) 4.51 + if ((size = * (short *) p) == 0) 4.52 return -1; 4.53 x->fileofs = (* (unsigned long *) (p + 2)) << SECTORBITS; 4.54 x->filesize = * (unsigned long *) (p + 10); 4.55 @@ -113,13 +113,12 @@ 4.56 char _64bits = cpuhaslm(); 4.57 struct isostate *x=&isostate; 4.58 4.59 -retry32: 4.60 + retry32: 4.61 for (s = (char *) filename; *s == '/' ; s++) { 4.62 isoreset(NULL); 4.63 } 4.64 next: 4.65 - name = s; 4.66 - do s++; while (*s && *s != '/'); 4.67 + for (name = s; *s && *s != '/'; s++); 4.68 c = *s; 4.69 *s = 0; 4.70 for (restart = 1; isoreaddir(restart) == 0; restart = 0) { 4.71 @@ -133,7 +132,7 @@ 4.72 *s++ = c; 4.73 if (IS_DIR(x->filemod)) { 4.74 x->dirofs = x->fileofs; 4.75 - x->dirsize = x->filesize; 4.76 + x->dirsize = filesize2dirsize(x->filesize); 4.77 if (c) goto next; 4.78 } 4.79 isolseek(&x->fileofs);
5.1 --- a/linld/stuff/src/ISO9660.H Sun Mar 05 13:22:08 2017 +0100 5.2 +++ b/linld/stuff/src/ISO9660.H Tue Mar 07 12:21:16 2017 +0100 5.3 @@ -1,5 +1,11 @@ 5.4 #ifndef __ISO9660_H 5.5 #define __ISO9660_H 5.6 +//typedef unsigned long dirsizetype; 5.7 +//#define filesize2dirsize(x) (x) 5.8 +//#define DIRSECTORSZ SECTORSZ 5.9 +typedef unsigned dirsizetype; 5.10 +#define filesize2dirsize(x) (*(unsigned *)((char *)&(x)+1)) 5.11 +#define DIRSECTORSZ (SECTORSZ/256) 5.12 extern struct isostate { 5.13 int fd; 5.14 unsigned long fileofs; 5.15 @@ -7,8 +13,8 @@ 5.16 unsigned short filemod; 5.17 char *filename; 5.18 //private 5.19 - unsigned long dirofs, dirsize; 5.20 - unsigned long curdirofs, curdirsize; 5.21 + dirsizetype curdirsize, dirsize; 5.22 + unsigned long curdirofs, dirofs; 5.23 unsigned curpos; 5.24 } isostate; 5.25 #define isofd isostate.fd
6.1 --- a/linld/stuff/src/LINLD.CPP Sun Mar 05 13:22:08 2017 +0100 6.2 +++ b/linld/stuff/src/LINLD.CPP Tue Mar 07 12:21:16 2017 +0100 6.3 @@ -35,7 +35,7 @@ 6.4 ); 6.5 } 6.6 6.7 -static char _cmdline[256]; 6.8 +static char _cmdline[128]; 6.9 int main(int argc, char *argv[]) { 6.10 6.11 (void) argc; 6.12 @@ -112,12 +112,12 @@ 6.13 topmem = strtol(s); 6.14 goto addincmdline; 6.15 } 6.16 - else if(cmdline == (const char *) _cmdline) { 6.17 + else if(cmdline == (const char *) _cmdline + 1) { 6.18 addincmdline: 6.19 strcatb(_cmdline,*argv); 6.20 } 6.21 else if(i == 1 && fileattr(s) != -1) { 6.22 - cmdline = (const char *) _cmdline; 6.23 + cmdline = (const char *) _cmdline + 1; 6.24 goto set_kernel_name; 6.25 } 6.26 else