# HG changeset patch # User Pascal Bellard # Date 1491648492 -7200 # Node ID 9e8f9b54bd83d20236dcfaece643a5d4f46fecbe # Parent 8525be25baade6b626c771300c61c5e3e3355aac linld: fix seekset link error diff -r 8525be25baad -r 9e8f9b54bd83 linld/receipt --- a/linld/receipt Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/receipt Sat Apr 08 12:48:12 2017 +0200 @@ -33,6 +33,7 @@ EOT SDL_VIDEODRIVER=dummy dosbox MAKE.BAT -exit -c "mount D $src" \ 2>&1 | grep -v 'ALSA lib' + grep Error: */LNK.LOG && return 1 cp LINLD$SUFFIX/LINLD.COM linld.com cp TAZBOOT/TAZBOOT.COM tazboot.com objdump -D -b binary -mi386 -Maddr16,data16 --adjust-vma=0x100 \ diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/COMMON.H --- a/linld/stuff/src/COMMON.H Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/COMMON.H Sat Apr 08 12:48:12 2017 +0200 @@ -49,7 +49,9 @@ void (*next_chunk)(struct image_himem *); u16 state; u16 fd2close; -} pm, initrd; +} imgs[2]; +#define pm (imgs[0]) +#define initrd (imgs[1]) extern int skip_alloc; extern u32 base_himem; diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/CRTL.ASM --- a/linld/stuff/src/CRTL.ASM Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/CRTL.ASM Sat Apr 08 12:48:12 2017 +0200 @@ -261,10 +261,10 @@ endp _read - ifdef EXTRA ;*************************************************************** ;long lseekset(int fd, unsigned long sz); ;*************************************************************** + global _lseekset:near proc _lseekset near @@ -273,22 +273,6 @@ pop dx ; sz lo pop cx ; sz hi push cx - push dx - - else -;*************************************************************** -;long seekset(int fd, unsigned sz); -;*************************************************************** - global _seekset:near - proc _seekset near - - xor cx,cx - pop ax ;caller return address - pop bx ; fd - pop dx ; sz - push dx - endif - push bx push ax global lseekset:near @@ -305,11 +289,7 @@ xor cx,cx jmp dos - ifdef EXTRA endp _lseekset - else - endp _seekset - endif ifdef EXTRA struc isostate ; struct isostate { @@ -599,8 +579,8 @@ endif shl eax,12 ; i*_4k ; if (edx < pm.fallback+i*_4k && edx >= pm.fallback) again - extrn _pm - mov bx,offset _pm+2 + extrn _imgs + mov bx,offset _imgs+2 push eax add eax,[bx-2+2] cmp eax,edx ; pm.fallback+i*_4k <= edx ? @@ -610,8 +590,8 @@ jae @@vcpi_alloc @@pmok: ; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again - extrn _initrd - mov bx,offset _initrd+2 + extrn _imgs + mov bx,offset _imgs+32+2 add eax,[bx-2+2] ; +initrd.fallback cmp eax,edx ; initrd.fallback+i*_4k > edx ? ja @@initrdok diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/CRTL.H --- a/linld/stuff/src/CRTL.H Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/CRTL.H Sat Apr 08 12:48:12 2017 +0200 @@ -36,7 +36,7 @@ extern "C" void abort(); extern "C" int read(int fd, void* data, int sz); extern "C" int write(int fd, const void* data, int sz); -extern "C" long seekset(int fd, unsigned sz); +extern "C" long lseekset(int fd, unsigned long sz); extern "C" void* malloc(unsigned sz); extern "C" int puts(const char* s); extern "C" unsigned long strtol(const char *s); diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/CRTLX.H --- a/linld/stuff/src/CRTLX.H Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/CRTLX.H Sat Apr 08 12:48:12 2017 +0200 @@ -11,7 +11,5 @@ extern "C" unsigned long kver2ul(char *kernel_version); extern "C" char *ultoa(unsigned long n); extern "C" void try_default_args(); -extern "C" long lseekset(int fd, unsigned long sz); -#define seekset(fd,sz) lseekset(fd,(unsigned long) sz) extern char cpu_features[]; #define cpuhaslm() (cpu_features[3]&0x20) diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/HIMEM.CPP --- a/linld/stuff/src/HIMEM.CPP Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/HIMEM.CPP Sat Apr 08 12:48:12 2017 +0200 @@ -6,8 +6,7 @@ #include "crtl.h" #include "common.h" -struct image_himem pm; -struct image_himem initrd; +struct image_himem imgs[2]; int skip_alloc; // Called from inside kernel just before rm->pm diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/JUMP.ASM --- a/linld/stuff/src/JUMP.ASM Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/JUMP.ASM Sat Apr 08 12:48:12 2017 +0200 @@ -16,7 +16,7 @@ segment _BSS byte public use16 'BSS' - global _pm:dword + global _imgs:dword ends _BSS @@ -78,7 +78,7 @@ extrn @last_ditch$qv:near push cs call @last_ditch$qv - mov ax,[word _pm+2+2] ; get pm->fallback high word + mov ax,[word _imgs+2+2] ; get pm->fallback high word ; self move ;cld pop es ; min 2048 bytes for stack diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/LOAD.CPP --- a/linld/stuff/src/LOAD.CPP Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/LOAD.CPP Sat Apr 08 12:48:12 2017 +0200 @@ -115,7 +115,6 @@ u8 pm_high; // @ = @rm_size + 2, see JUMP.ASM u8* rm_buf; // @ = @rm_size + 3, see JUMP.ASM u32 base_himem = _1m+_64k; -extern struct image_himem pm, initrd; // register value to launch the kernel real mode code #ifdef NO386 @@ -155,7 +154,7 @@ if(kernelparams->setup_sects == 0) { #if 1 if(* (int *) &first1k->pad10[0x3F-0x24] == 0x3AE8) { - seekset(pm.fd,rm_seek=0x200); + lseekset(pm.fd,rm_seek=0x200); csip+=0xFFE00042; } else @@ -246,12 +245,12 @@ void load_initrd() { struct image_himem *m = &initrd; + if (!initrd_name && !m->fd) return; m->errmsg = "Can't use initrd file"; - if (!initrd_name && !m->fd) return; open_image(initrd_name, m); - if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK)) < pm.fallback+pm.size) { + if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK)) < m[-1].fallback+m[-1].size) { close(m->fd); puts(m->errmsg); return; diff -r 8525be25baad -r 9e8f9b54bd83 linld/stuff/src/TAZBOOT.CPP --- a/linld/stuff/src/TAZBOOT.CPP Fri Apr 07 21:50:50 2017 +0200 +++ b/linld/stuff/src/TAZBOOT.CPP Sat Apr 08 12:48:12 2017 +0200 @@ -83,10 +83,10 @@ if (iso[1] && !strcmp(mode = iso[1], "text")) init = ""; do { - if ((isoopen(mode) >= 0 && ++noauto) || // custom + if ((isoopen(mode) >= 0 && ++noauto != 0) || // custom isoopen("bzImage") >= 0 || // SliTaz isoopen("vmlinuz") >= 0 || // misc - (isoopen("linux") >= 0 && ++isknoppix)) { + (isoopen("linux") >= 0 && ++isknoppix != 0)) { magic = kver2ul(isokernel()); break; } @@ -117,15 +117,15 @@ } } else if (magic > 0) { - char *initrd = fallback; + char *initrdfilename = fallback; static const unsigned long initrddesc = 18L; if (rootfs[0]) { - initrd = rootfs; + initrdfilename = rootfs; if (rootfs[6] != '.' && isoopen("rootfs.gz") >= 0) addinitrd(); // for loram } - if (isoopen(initrd) >= 0) { + if (isoopen(initrdfilename) >= 0) { addinitrd(); } if (*init && isolseek(&initrddesc) != -1) {