wok rev 20793

linld: fix strcatb
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 14 18:37:56 2019 +0100 (2019-02-14)
parents ef6f5156b759
children 8685ee90f6aa
files linld/stuff/src/CRTL.ASM linld/stuff/src/LINLD.CPP
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Thu Feb 14 17:35:20 2019 +0100
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Thu Feb 14 18:37:56 2019 +0100
     1.3 @@ -52,16 +52,18 @@
     1.4  ;_fastcall void strcat(bx:const char* a, ax:const char* b);
     1.5  ;_fastcall void strcatb(bx:const char* a, ax:const char* b);
     1.6  ;***************************************************************
     1.7 +	ifdef	EXTRA
     1.8 +        global  @strcat$qpxzct1:near
     1.9 +@strcat$qpxzct1:
    1.10 +		mov	cx,1h
    1.11 +		db	0bah			; mov	dx,imm opcode
    1.12 +	endif
    1.13          global  @strcatb$qpxzct1:near
    1.14          proc	@strcatb$qpxzct1 near
    1.15  
    1.16  	ifdef	EXTRA
    1.17  		mov	cl,7Fh
    1.18  		db	0bah			; mov	dx,imm opcode
    1.19 -        global  @strcat$qpxzct1:near
    1.20 -@strcat$qpxzct1:
    1.21 -		mov	cl,80h
    1.22 -		db	0bah			; mov	dx,imm opcode
    1.23          global	@strcpy$qpxzct1:near
    1.24  @strcpy$qpxzct1:
    1.25  		xor	cx,cx
    1.26 @@ -77,13 +79,10 @@
    1.27  		or	al,al
    1.28                  jne	@@catlp
    1.29  		dec	si
    1.30 +		mov	al,20h
    1.31  	ifdef	EXTRA
    1.32 -		cmp	bx,si
    1.33 -		adc	al,cl		; set S when bx != si or cl = 80
    1.34 -		mov	al,20h
    1.35 -		jns	@@cpyhead
    1.36 +		loop	@@cpyhead
    1.37  	else
    1.38 -		mov	al,20h
    1.39  		jmp	@@cpyhead
    1.40  	endif
    1.41  @@nocat:
     2.1 --- a/linld/stuff/src/LINLD.CPP	Thu Feb 14 17:35:20 2019 +0100
     2.2 +++ b/linld/stuff/src/LINLD.CPP	Thu Feb 14 18:37:56 2019 +0100
     2.3 @@ -83,12 +83,11 @@
     2.4          }
     2.5      }
     2.6  #else
     2.7 -    if (argv[1]) {for (char i=0;;) {
     2.8 +    if (argv[1]) while (1) {
     2.9  	char *s;
    2.10      next:
    2.11  	argv++;
    2.12  	s=*argv;
    2.13 -	i++;
    2.14  	if (!s) {
    2.15  	    puts(load_kernel());
    2.16  	    load_initrd();
    2.17 @@ -116,52 +115,53 @@
    2.18  	    base_himem = strtol(*argv);
    2.19  	    goto next;
    2.20  	default:
    2.21 -        if(strhead(s,"cl=") == 0) {
    2.22 -            cmdline=s+=3;
    2.23 -            if (*s == '@') {
    2.24 -		static struct image_himem image;
    2.25 -		char c;
    2.26 +	    if(strhead(s,"cl=") == 0) {
    2.27 +		cmdline=s+=3;
    2.28 +		if (*s == '@') {
    2.29 +		    static struct image_himem image;
    2.30 +		    char c;
    2.31  
    2.32 -		s++;
    2.33 -		image.errmsg = "Error in cl=@file";
    2.34 -		open_image(s, &image);
    2.35 -		cmdline=s=(char *)malloc_or_die(image.size);
    2.36 -		s+=image.size;
    2.37 -		read(image.fd, (void *)cmdline, image.size);
    2.38 -		// Strip any trailing cr/lf
    2.39 -		c='\0';
    2.40 -		do {
    2.41 +		    s++;
    2.42 +		    image.errmsg = "Error in cl=@file";
    2.43 +		    open_image(s, &image);
    2.44 +		    cmdline=s=(char *)malloc_or_die(image.size);
    2.45 +		    s+=image.size;
    2.46 +		    read(image.fd, (void *)cmdline, image.size);
    2.47 +		    // Strip any trailing cr/lf
    2.48 +		    c='\0';
    2.49 +		    do {
    2.50  			// Replace all other cr/lfs with spaces
    2.51  			s--;
    2.52  			if(*s>=' ') c=' ';
    2.53  			else *s = c;
    2.54 -		} while (s>cmdline);
    2.55 -                puts("Kernel command line:");
    2.56 -                puts(cmdline);
    2.57 -            }
    2.58 -        }
    2.59 -        else if(strhead(s,"root=") == 0) {
    2.60 -	    s+=5;
    2.61 -            root_dev = strtol(s);
    2.62 -	    goto addincmdline;
    2.63 -        }
    2.64 -        else if(strhead(s,"mem=") == 0) {
    2.65 -	    s+=4;
    2.66 -            topmem = strtol(s);
    2.67 -	    goto addincmdline;
    2.68 -        }
    2.69 -        else if(cmdline == (const char *) buf_cmdline + 1) {
    2.70 -addincmdline:
    2.71 -	    strcatb(buf_cmdline,*argv);
    2.72 -        }
    2.73 -	else if(i == 1 && fileexist(s) != -1) {
    2.74 -	    cmdline = (const char *) buf_cmdline + 1;
    2.75 -	    goto set_kernel_name;
    2.76 -        }
    2.77 -	else
    2.78 -	    break;
    2.79 +		    } while (s>cmdline);
    2.80 +		    puts("Kernel command line:");
    2.81 +		    puts(cmdline);
    2.82 +		}
    2.83 +	    }
    2.84 +            else if(strhead(s,"root=") == 0) {
    2.85 +		s+=5;
    2.86 +		root_dev = strtol(s);
    2.87 +		goto addincmdline;
    2.88 +	    }
    2.89 +	    else if(strhead(s,"mem=") == 0) {
    2.90 +		s+=4;
    2.91 +		topmem = strtol(s);
    2.92 +		goto addincmdline;
    2.93 +	    }
    2.94 +	    else {
    2.95 +	addincmdline:
    2.96 +		if(cmdline == (const char *) buf_cmdline + 1) {
    2.97 +		    strcatb(buf_cmdline,*argv);
    2.98 +		}
    2.99 +		else {
   2.100 +		    if(fileexist(s) != -1) goto set_kernel_name;
   2.101 +		    cmdline = (const char *) buf_cmdline + 1;
   2.102 +		    goto addincmdline;
   2.103 +		}
   2.104 +	    }
   2.105  	}
   2.106 -    }}
   2.107 +    }
   2.108  #endif
   2.109      syntax();
   2.110