# HG changeset patch # User Pascal Bellard # Date 1482603419 -3600 # Node ID 23fc786c04e8abd76e311ab0cb325c5bbf003dbd # Parent baa9bcac7eddaf52ce9a3f5c5ee441b85659c182 linld: add -b switch diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/linld.txt --- a/linld/stuff/linld.txt Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/linld.txt Sat Dec 24 19:16:59 2016 +0100 @@ -40,3 +40,17 @@ Some VCPI comments added 0.96 Do not lowercase entire command line 0.97 memtop() must be rounded down to page boundary + +SliTaz patches +-------------- +New command line arguments: +-f force. Do not ask memory manager for allocation +-b base lower buffer address, default 1088k +root number root filesystem device +mem number higher memory address, default 256m + +Every arguments can be stored in a separate file and load with @filename, i.e +> linld @args.cmd + +The -f and -b are useful skip XMM (max 64M ?) and VCPI (max 32M ?) limits: +> linld -f -b 64m initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz "cl=rw root=/dev/null video=-32" diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/A20.ASM --- a/linld/stuff/src/A20.ASM Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/A20.ASM Sat Dec 24 19:16:59 2016 +0100 @@ -15,7 +15,7 @@ global die:near enable_a20_methods: dw _enable_a20_fast, _enable_a20_kbd, _enable_a20_xmm, die -msg_a20 db "Can't enable A20",0 +msg_a20 db "Can't use A20",0 ends _DATA @@ -51,16 +51,14 @@ xor cx,cx ; 64K iterations @@loop: call @@delay ; 8042 status port - in al,64h ; output buffer? + in al,64h + test al,3 ; is output or input full? + jz @@break ; no - break loop test al,1 ; jz @@no_output call @@delay ; yes: read it in al,60h ; - jmp @@cont ; @@no_output: - test al,2 ; is input buffer full? - jz @@break ; no - break loop -@@cont: loop @@loop @@break: ret @@ -86,9 +84,24 @@ endp _enable_a20_fast ;*************************************************************** +;void enable_a20_or_die(); +;*************************************************************** + global _enable_a20_or_die:near + proc _enable_a20_or_die near + + push si + mov si,offset enable_a20_methods + jmp @@check +@@loop: + lodsw + mov bx,offset msg_a20 + call ax +@@check: + ;call _check_a20 +;*************************************************************** ;int check_a20(); ;*************************************************************** - proc _check_a20 near + ;proc _check_a20 near ; From linux kernel setup.S: ; wait until a20 really *is* enabled; it can take a fair amount of @@ -113,25 +126,10 @@ loopne a20lp xchg ax,cx pop es ds - ret + ;ret - endp _check_a20 + ;endp _check_a20 -;*************************************************************** -;void enable_a20_or_die(); -;*************************************************************** - global _enable_a20_or_die:near - proc _enable_a20_or_die near - - push si - mov si,offset enable_a20_methods - jmp @@check -@@loop: - lodsw - mov bx,offset msg_a20 - call ax -@@check: - call _check_a20 jne @@loop pop si ret diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/COMMON.H --- a/linld/stuff/src/COMMON.H Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/COMMON.H Sat Dec 24 19:16:59 2016 +0100 @@ -22,6 +22,8 @@ const u16 _32k = 32*1024u; const u32 _64k = 64*1024ul; const u32 _1m = 1024ul*1024ul; +const u32 _32m = 32*1024ul*1024ul; +const u32 _64m = 64*1024ul*1024ul; const PAGE_BITS = 12; const PAGE_SIZE = 1<pm // _loadds _saveregs: done by hand @@ -29,14 +30,14 @@ #endif } struct image_himem *m = ± + vm2rm(); if(((u16 *)&m->fallback)[1] >= 0x10) m->fallback = _1m; // >= _1m ? - if(vcpi==0) { + if(m->bufv==0) { // Move kernel memcpy_image(m); // Move initrd memcpy_image(&initrd); } else { //vcpi - vm2rm(); // Move kernel // 'Gathering' copy in chunks of PAGE_SIZE // No risk of overlapping: kernel is copied from above to 1m mark @@ -81,18 +82,17 @@ } } -int skip_xmmalloc; void load_image(struct image_himem *m) { no_exit++; // die() won't return to DOS m->remaining = m->size; m->buf = m->fallback; u32 buf; u32* bufv= &buf; - if(((u16 *)&m->fallback)[1] >= 0x10) { // >= _1m ? + if(((u16 *)&m->fallback)[1] >= 0x10 && !skip_alloc) { // >= _1m ? if(vcpi) { bufv = malloc_bufv_or_die(m); // update m->bufv } - else if (!skip_xmmalloc) { + else { xmm_alloc(m); // update m->buf } } diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/LINLD.CPP --- a/linld/stuff/src/LINLD.CPP Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/LINLD.CPP Sat Dec 24 19:16:59 2016 +0100 @@ -24,11 +24,12 @@ "\tinitrd,vga,root=(void)" NL "\tmem=256m" NL "\tcl=auto" NL + "\t-b 1088k" NL "Use quotes: \"cl=...\" if you need spaces in cmdline" NL "Use cl=@filename to get it from a file" #if 1 NL NL "Examples:" NL - "\tlinld initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz \"cl=rw root=/dev/null video=-32\"" + "\tlinld -f -b 64m initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz \"cl=rw root=/dev/null video=-32\"" NL NL "\tlinld image=memtest" #endif ); @@ -46,6 +47,7 @@ // Parse command line if (argv[1]) {for (char i=0;;) { char *s; + next: argv++; s=*argv; i++; @@ -62,15 +64,20 @@ s+=7; initrd_name=s; } - else if((*(u16 *)s|0x2002) == 0x662F) { // -F /f - extern int skip_xmmalloc; - skip_xmmalloc++; - } else if(strhead(s,"vga=") == 0) { s+=4; vid_mode = strtol(s); // support normal, extended & ask } - else if(strhead(s,"cl=") == 0) { + else switch (*(u16 *)s|0x2002) { + case 0x662F: // -F /f + skip_alloc++; + goto next; + case 0x622F: // -B /b + argv++; + base_himem = strtol(*argv); + goto next; + default: + if(strhead(s,"cl=") == 0) { cmdline=s+=3; if (*s == '@') { static struct image_himem image; @@ -114,6 +121,7 @@ } else break; + } }} syntax(); diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/LOAD.CPP --- a/linld/stuff/src/LOAD.CPP Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/LOAD.CPP Sat Dec 24 19:16:59 2016 +0100 @@ -113,6 +113,7 @@ u8* rm_buf; u16 rm_size; u8 pm_high; +u32 base_himem = _1m+_64k; extern struct image_himem pm, initrd; // register value to launch the kernel real mode code @@ -232,7 +233,7 @@ m->size -= rm_size; m->chunk_size -= rm_size; if(m->fallback+m->size > (((u32)topseg())<<4) || pm_high) { - m->fallback = _1m+_64k; + m->fallback = base_himem; } load_image(m); diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/TAZBOOT.CPP --- a/linld/stuff/src/TAZBOOT.CPP Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/TAZBOOT.CPP Sat Dec 24 19:16:59 2016 +0100 @@ -59,7 +59,6 @@ char _cmdline[256]; const char *cmdline = (const char *) _cmdline; -extern int skip_xmmalloc; static void bootiso(char **iso) { char *init = " rdinit=/init.exe", *mode="menu"; @@ -69,7 +68,9 @@ struct isostate *x=&isostate; if (!*iso || isoreset(*iso) < 0) return; - skip_xmmalloc++; + skip_alloc++; + base_himem = memtop() /2; + if (base_himem > _64m) base_himem = _64m; isoopen("boot") >= 0 || isoopen("live") >= 0 || // debian isoopen("casper") >= 0; // ubuntu @@ -150,7 +151,7 @@ if (argc < 2) { try_default_args(); dousage: - die("Usage: tazboot [[@commands]|[-f][kernel=] \ + die("Usage: tazboot [[@commands]|[-f][-b base_himem][kernel=] \ [initrd=[,...]] [bootfrom=] ...]\r\n\n\ Defaults: tazboot kernel=bzImage auto\r\n\n\ Examples for tazboot.cmd:\r\n\n\ @@ -165,7 +166,7 @@ chdirname(*argv); for (int i=0;;) { char *s; - argv++; + next: argv++; s=*argv; i++; if (!s) break; @@ -195,10 +196,20 @@ s += 4; vid_mode = strtol(s); // support normal, extended & ask } - else if((*(u16 *)s|0x2002) == 0x662F) { // -F /f - skip_xmmalloc++; - } - else if(i == 1 && fileattr(s) != -1) { + else switch (*(u16 *)s|0x2002) { + case 0x662F: // -F /f + skip_alloc++; + goto next; + case 0x652F: // -E /e + argv++; + topmem = strtol(*argv); + goto next; + case 0x622F: // -B /b + argv++; + base_himem = strtol(*argv); + goto next; + default: + if(i == 1 && fileattr(s) != -1) { goto set_kernel; } else { @@ -211,7 +222,7 @@ topmem = strtol(s); } strcatb(_cmdline,*argv); - } + }} } if (iso && isoreset(iso) >= 0) { char *s = (char *) initrd_name; diff -r baa9bcac7edd -r 23fc786c04e8 linld/stuff/src/VCPI.ASM --- a/linld/stuff/src/VCPI.ASM Sat Dec 24 14:13:20 2016 +0100 +++ b/linld/stuff/src/VCPI.ASM Sat Dec 24 19:16:59 2016 +0100 @@ -407,6 +407,9 @@ global _vm2rm:near proc _vm2rm near + extrn _vcpi:byte + test [_vcpi],-1 + jz @@ret push esi ;;pushf ;;cli @@ -452,6 +455,7 @@ ;;popad ;;popf pop esi +@@ret: ret ; We don't care much about rest (FS/GS) endp _vm2rm