# HG changeset patch # User Pascal Bellard # Date 1550165876 -3600 # Node ID 03507e8ec4b95403b4a37e4b474e94da21a0b340 # Parent ef6f5156b759a12717da5b34d98bb410ea4a291f linld: fix strcatb diff -r ef6f5156b759 -r 03507e8ec4b9 linld/stuff/src/CRTL.ASM --- a/linld/stuff/src/CRTL.ASM Thu Feb 14 17:35:20 2019 +0100 +++ b/linld/stuff/src/CRTL.ASM Thu Feb 14 18:37:56 2019 +0100 @@ -52,16 +52,18 @@ ;_fastcall void strcat(bx:const char* a, ax:const char* b); ;_fastcall void strcatb(bx:const char* a, ax:const char* b); ;*************************************************************** + ifdef EXTRA + global @strcat$qpxzct1:near +@strcat$qpxzct1: + mov cx,1h + db 0bah ; mov dx,imm opcode + endif global @strcatb$qpxzct1:near proc @strcatb$qpxzct1 near ifdef EXTRA mov cl,7Fh db 0bah ; mov dx,imm opcode - global @strcat$qpxzct1:near -@strcat$qpxzct1: - mov cl,80h - db 0bah ; mov dx,imm opcode global @strcpy$qpxzct1:near @strcpy$qpxzct1: xor cx,cx @@ -77,13 +79,10 @@ or al,al jne @@catlp dec si + mov al,20h ifdef EXTRA - cmp bx,si - adc al,cl ; set S when bx != si or cl = 80 - mov al,20h - jns @@cpyhead + loop @@cpyhead else - mov al,20h jmp @@cpyhead endif @@nocat: diff -r ef6f5156b759 -r 03507e8ec4b9 linld/stuff/src/LINLD.CPP --- a/linld/stuff/src/LINLD.CPP Thu Feb 14 17:35:20 2019 +0100 +++ b/linld/stuff/src/LINLD.CPP Thu Feb 14 18:37:56 2019 +0100 @@ -83,12 +83,11 @@ } } #else - if (argv[1]) {for (char i=0;;) { + if (argv[1]) while (1) { char *s; next: argv++; s=*argv; - i++; if (!s) { puts(load_kernel()); load_initrd(); @@ -116,52 +115,53 @@ base_himem = strtol(*argv); goto next; default: - if(strhead(s,"cl=") == 0) { - cmdline=s+=3; - if (*s == '@') { - static struct image_himem image; - char c; + if(strhead(s,"cl=") == 0) { + cmdline=s+=3; + if (*s == '@') { + static struct image_himem image; + char c; - s++; - image.errmsg = "Error in cl=@file"; - open_image(s, &image); - cmdline=s=(char *)malloc_or_die(image.size); - s+=image.size; - read(image.fd, (void *)cmdline, image.size); - // Strip any trailing cr/lf - c='\0'; - do { + s++; + image.errmsg = "Error in cl=@file"; + open_image(s, &image); + cmdline=s=(char *)malloc_or_die(image.size); + s+=image.size; + read(image.fd, (void *)cmdline, image.size); + // Strip any trailing cr/lf + c='\0'; + do { // Replace all other cr/lfs with spaces s--; if(*s>=' ') c=' '; else *s = c; - } while (s>cmdline); - puts("Kernel command line:"); - puts(cmdline); - } - } - else if(strhead(s,"root=") == 0) { - s+=5; - root_dev = strtol(s); - goto addincmdline; - } - else if(strhead(s,"mem=") == 0) { - s+=4; - topmem = strtol(s); - goto addincmdline; - } - else if(cmdline == (const char *) buf_cmdline + 1) { -addincmdline: - strcatb(buf_cmdline,*argv); - } - else if(i == 1 && fileexist(s) != -1) { - cmdline = (const char *) buf_cmdline + 1; - goto set_kernel_name; - } - else - break; + } while (s>cmdline); + puts("Kernel command line:"); + puts(cmdline); + } + } + else if(strhead(s,"root=") == 0) { + s+=5; + root_dev = strtol(s); + goto addincmdline; + } + else if(strhead(s,"mem=") == 0) { + s+=4; + topmem = strtol(s); + goto addincmdline; + } + else { + addincmdline: + if(cmdline == (const char *) buf_cmdline + 1) { + strcatb(buf_cmdline,*argv); + } + else { + if(fileexist(s) != -1) goto set_kernel_name; + cmdline = (const char *) buf_cmdline + 1; + goto addincmdline; + } + } } - }} + } #endif syntax();