wok-6.x rev 19899
linld: fix seekset link error
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 08 12:48:12 2017 +0200 (2017-04-08) |
parents | 8525be25baad |
children | df6498976257 |
files | linld/receipt linld/stuff/src/COMMON.H linld/stuff/src/CRTL.ASM linld/stuff/src/CRTL.H linld/stuff/src/CRTLX.H linld/stuff/src/HIMEM.CPP linld/stuff/src/JUMP.ASM linld/stuff/src/LOAD.CPP linld/stuff/src/TAZBOOT.CPP |
line diff
1.1 --- a/linld/receipt Fri Apr 07 21:50:50 2017 +0200 1.2 +++ b/linld/receipt Sat Apr 08 12:48:12 2017 +0200 1.3 @@ -33,6 +33,7 @@ 1.4 EOT 1.5 SDL_VIDEODRIVER=dummy dosbox MAKE.BAT -exit -c "mount D $src" \ 1.6 2>&1 | grep -v 'ALSA lib' 1.7 + grep Error: */LNK.LOG && return 1 1.8 cp LINLD$SUFFIX/LINLD.COM linld.com 1.9 cp TAZBOOT/TAZBOOT.COM tazboot.com 1.10 objdump -D -b binary -mi386 -Maddr16,data16 --adjust-vma=0x100 \
2.1 --- a/linld/stuff/src/COMMON.H Fri Apr 07 21:50:50 2017 +0200 2.2 +++ b/linld/stuff/src/COMMON.H Sat Apr 08 12:48:12 2017 +0200 2.3 @@ -49,7 +49,9 @@ 2.4 void (*next_chunk)(struct image_himem *); 2.5 u16 state; 2.6 u16 fd2close; 2.7 -} pm, initrd; 2.8 +} imgs[2]; 2.9 +#define pm (imgs[0]) 2.10 +#define initrd (imgs[1]) 2.11 2.12 extern int skip_alloc; 2.13 extern u32 base_himem;
3.1 --- a/linld/stuff/src/CRTL.ASM Fri Apr 07 21:50:50 2017 +0200 3.2 +++ b/linld/stuff/src/CRTL.ASM Sat Apr 08 12:48:12 2017 +0200 3.3 @@ -261,10 +261,10 @@ 3.4 3.5 endp _read 3.6 3.7 - ifdef EXTRA 3.8 ;*************************************************************** 3.9 ;long lseekset(int fd, unsigned long sz); 3.10 ;*************************************************************** 3.11 + 3.12 global _lseekset:near 3.13 proc _lseekset near 3.14 3.15 @@ -273,22 +273,6 @@ 3.16 pop dx ; sz lo 3.17 pop cx ; sz hi 3.18 push cx 3.19 - push dx 3.20 - 3.21 - else 3.22 -;*************************************************************** 3.23 -;long seekset(int fd, unsigned sz); 3.24 -;*************************************************************** 3.25 - global _seekset:near 3.26 - proc _seekset near 3.27 - 3.28 - xor cx,cx 3.29 - pop ax ;caller return address 3.30 - pop bx ; fd 3.31 - pop dx ; sz 3.32 - push dx 3.33 - endif 3.34 - 3.35 push bx 3.36 push ax 3.37 global lseekset:near 3.38 @@ -305,11 +289,7 @@ 3.39 xor cx,cx 3.40 jmp dos 3.41 3.42 - ifdef EXTRA 3.43 endp _lseekset 3.44 - else 3.45 - endp _seekset 3.46 - endif 3.47 3.48 ifdef EXTRA 3.49 struc isostate ; struct isostate { 3.50 @@ -599,8 +579,8 @@ 3.51 endif 3.52 shl eax,12 ; i*_4k 3.53 ; if (edx < pm.fallback+i*_4k && edx >= pm.fallback) again 3.54 - extrn _pm 3.55 - mov bx,offset _pm+2 3.56 + extrn _imgs 3.57 + mov bx,offset _imgs+2 3.58 push eax 3.59 add eax,[bx-2+2] 3.60 cmp eax,edx ; pm.fallback+i*_4k <= edx ? 3.61 @@ -610,8 +590,8 @@ 3.62 jae @@vcpi_alloc 3.63 @@pmok: 3.64 ; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again 3.65 - extrn _initrd 3.66 - mov bx,offset _initrd+2 3.67 + extrn _imgs 3.68 + mov bx,offset _imgs+32+2 3.69 add eax,[bx-2+2] ; +initrd.fallback 3.70 cmp eax,edx ; initrd.fallback+i*_4k > edx ? 3.71 ja @@initrdok
4.1 --- a/linld/stuff/src/CRTL.H Fri Apr 07 21:50:50 2017 +0200 4.2 +++ b/linld/stuff/src/CRTL.H Sat Apr 08 12:48:12 2017 +0200 4.3 @@ -36,7 +36,7 @@ 4.4 extern "C" void abort(); 4.5 extern "C" int read(int fd, void* data, int sz); 4.6 extern "C" int write(int fd, const void* data, int sz); 4.7 -extern "C" long seekset(int fd, unsigned sz); 4.8 +extern "C" long lseekset(int fd, unsigned long sz); 4.9 extern "C" void* malloc(unsigned sz); 4.10 extern "C" int puts(const char* s); 4.11 extern "C" unsigned long strtol(const char *s);
5.1 --- a/linld/stuff/src/CRTLX.H Fri Apr 07 21:50:50 2017 +0200 5.2 +++ b/linld/stuff/src/CRTLX.H Sat Apr 08 12:48:12 2017 +0200 5.3 @@ -11,7 +11,5 @@ 5.4 extern "C" unsigned long kver2ul(char *kernel_version); 5.5 extern "C" char *ultoa(unsigned long n); 5.6 extern "C" void try_default_args(); 5.7 -extern "C" long lseekset(int fd, unsigned long sz); 5.8 -#define seekset(fd,sz) lseekset(fd,(unsigned long) sz) 5.9 extern char cpu_features[]; 5.10 #define cpuhaslm() (cpu_features[3]&0x20)
6.1 --- a/linld/stuff/src/HIMEM.CPP Fri Apr 07 21:50:50 2017 +0200 6.2 +++ b/linld/stuff/src/HIMEM.CPP Sat Apr 08 12:48:12 2017 +0200 6.3 @@ -6,8 +6,7 @@ 6.4 #include "crtl.h" 6.5 #include "common.h" 6.6 6.7 -struct image_himem pm; 6.8 -struct image_himem initrd; 6.9 +struct image_himem imgs[2]; 6.10 int skip_alloc; 6.11 6.12 // Called from inside kernel just before rm->pm
7.1 --- a/linld/stuff/src/JUMP.ASM Fri Apr 07 21:50:50 2017 +0200 7.2 +++ b/linld/stuff/src/JUMP.ASM Sat Apr 08 12:48:12 2017 +0200 7.3 @@ -16,7 +16,7 @@ 7.4 7.5 segment _BSS byte public use16 'BSS' 7.6 7.7 - global _pm:dword 7.8 + global _imgs:dword 7.9 7.10 ends _BSS 7.11 7.12 @@ -78,7 +78,7 @@ 7.13 extrn @last_ditch$qv:near 7.14 push cs 7.15 call @last_ditch$qv 7.16 - mov ax,[word _pm+2+2] ; get pm->fallback high word 7.17 + mov ax,[word _imgs+2+2] ; get pm->fallback high word 7.18 ; self move 7.19 ;cld 7.20 pop es ; min 2048 bytes for stack
8.1 --- a/linld/stuff/src/LOAD.CPP Fri Apr 07 21:50:50 2017 +0200 8.2 +++ b/linld/stuff/src/LOAD.CPP Sat Apr 08 12:48:12 2017 +0200 8.3 @@ -115,7 +115,6 @@ 8.4 u8 pm_high; // @ = @rm_size + 2, see JUMP.ASM 8.5 u8* rm_buf; // @ = @rm_size + 3, see JUMP.ASM 8.6 u32 base_himem = _1m+_64k; 8.7 -extern struct image_himem pm, initrd; 8.8 8.9 // register value to launch the kernel real mode code 8.10 #ifdef NO386 8.11 @@ -155,7 +154,7 @@ 8.12 if(kernelparams->setup_sects == 0) { 8.13 #if 1 8.14 if(* (int *) &first1k->pad10[0x3F-0x24] == 0x3AE8) { 8.15 - seekset(pm.fd,rm_seek=0x200); 8.16 + lseekset(pm.fd,rm_seek=0x200); 8.17 csip+=0xFFE00042; 8.18 } 8.19 else 8.20 @@ -246,12 +245,12 @@ 8.21 8.22 void load_initrd() { 8.23 struct image_himem *m = &initrd; 8.24 + if (!initrd_name && !m->fd) return; 8.25 m->errmsg = "Can't use initrd file"; 8.26 - if (!initrd_name && !m->fd) return; 8.27 8.28 open_image(initrd_name, m); 8.29 8.30 - if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK)) < pm.fallback+pm.size) { 8.31 + if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK)) < m[-1].fallback+m[-1].size) { 8.32 close(m->fd); 8.33 puts(m->errmsg); 8.34 return;
9.1 --- a/linld/stuff/src/TAZBOOT.CPP Fri Apr 07 21:50:50 2017 +0200 9.2 +++ b/linld/stuff/src/TAZBOOT.CPP Sat Apr 08 12:48:12 2017 +0200 9.3 @@ -83,10 +83,10 @@ 9.4 if (iso[1] && !strcmp(mode = iso[1], "text")) 9.5 init = ""; 9.6 do { 9.7 - if ((isoopen(mode) >= 0 && ++noauto) || // custom 9.8 + if ((isoopen(mode) >= 0 && ++noauto != 0) || // custom 9.9 isoopen("bzImage") >= 0 || // SliTaz 9.10 isoopen("vmlinuz") >= 0 || // misc 9.11 - (isoopen("linux") >= 0 && ++isknoppix)) { 9.12 + (isoopen("linux") >= 0 && ++isknoppix != 0)) { 9.13 magic = kver2ul(isokernel()); 9.14 break; 9.15 } 9.16 @@ -117,15 +117,15 @@ 9.17 } 9.18 } 9.19 else if (magic > 0) { 9.20 - char *initrd = fallback; 9.21 + char *initrdfilename = fallback; 9.22 static const unsigned long initrddesc = 18L; 9.23 9.24 if (rootfs[0]) { 9.25 - initrd = rootfs; 9.26 + initrdfilename = rootfs; 9.27 if (rootfs[6] != '.' && isoopen("rootfs.gz") >= 0) 9.28 addinitrd(); // for loram 9.29 } 9.30 - if (isoopen(initrd) >= 0) { 9.31 + if (isoopen(initrdfilename) >= 0) { 9.32 addinitrd(); 9.33 } 9.34 if (*init && isolseek(&initrddesc) != -1) {