# HG changeset patch # User Pascal Bellard # Date 1573406450 -3600 # Node ID f25cb816bdd9b98657549e9510f3a24b9171071e # Parent 8e65b867668e6a9605a70838e6996bc479974261 linld: 8086 may load zImage (elks) diff -r 8e65b867668e -r f25cb816bdd9 linld/stuff/src/A20.ASM --- a/linld/stuff/src/A20.ASM Sun Nov 10 16:17:01 2019 +0100 +++ b/linld/stuff/src/A20.ASM Sun Nov 10 18:20:50 2019 +0100 @@ -18,6 +18,9 @@ dw _enable_a20_fast, _enable_a20_kbd, _enable_a20_xmm, die msg_a20 db "Can't use A20",0 overflow db "Out of memory",0 + ifdef NO386 +bzimage86 db "No bzImage on 8086",0 + endif global sssp:dword global _initrd_desc:dword _initrd_desc dd 90000218h @@ -110,7 +113,13 @@ mov cx,0fffh extrn _pm_high:byte test [_pm_high],cl + je @zimage + extrn _cpu386:byte + test [_cpu386],cl jne @bzimage + mov bx,offset bzimage86 + jmp godie +@zimage: xchg ax,dx cmp ax,cx jae @sys@ok @@ -138,6 +147,10 @@ extrn _topseg:near call near _topseg mov [word sssp+2],ax + and ch,0 + org $-1 + global _vcpi:byte +_vcpi db ? else p386 movzx eax,[word _heap_top] @@ -169,6 +182,8 @@ @bzimage: xchg ax,dx mov ax,9000h + extrn _vcpi:byte + and ch,[_vcpi] endif add dh,ch ; room for malloc_bufv_or_die cmp dx,ax @@ -176,6 +191,7 @@ @overflow: ; Oops! We can stomp on our toes... better stop now mov bx,offset overflow +godie: call near die @nooverflow: les cx,[bx-4] ; rm size diff -r 8e65b867668e -r f25cb816bdd9 linld/stuff/src/LINLD.CPP --- a/linld/stuff/src/LINLD.CPP Sun Nov 10 16:17:01 2019 +0100 +++ b/linld/stuff/src/LINLD.CPP Sun Nov 10 18:20:50 2019 +0100 @@ -164,5 +164,5 @@ #endif // Let compiler be happy - return _AX; + //return _AX; } diff -r 8e65b867668e -r f25cb816bdd9 linld/stuff/src/_BEG.ASM --- a/linld/stuff/src/_BEG.ASM Sun Nov 10 16:17:01 2019 +0100 +++ b/linld/stuff/src/_BEG.ASM Sun Nov 10 18:20:50 2019 +0100 @@ -18,11 +18,12 @@ global _data_start:byte label _data_start byte ifndef NO386 -msg_badcpu db "I need 386+ CPU in real mode or under VCPI manager",0 +msg_badcpu db "I need 386+ CPU in real mode w/o paging" + db " or " +msg_badmapping db "under VCPI 4.0+ manager with low 640k 1:1 mapping" + global _vcpi:byte +_vcpi db 0 endif - global _vcpi:byte -msg_badmapping db "VCPI: low 640k need 1:1 mapping" -_vcpi db 0 ends _DATA @@ -36,6 +37,11 @@ label _version_string byte db STACK_SIZE-2 dup(?) stktop dw ? + ifdef NO386 + global _cpu386:byte +_cpu386 db ? + org $-1 + endif global _cpu_features:dword _cpu_features dd ? ends _BSS @@ -73,9 +79,9 @@ add dh,bh ; NS=386+, S+NC=286, S+C=86/186 ifndef NO386 mov bx,offset msg_badcpu - js godie ;it is not a 386+ + js godie ;it is not a 386+, die else - js endcpu86 ;it is not a 386+ + js endcpu86 ;it is not a 386+, try ELKS & co endif p386 ; Check for vm @@ -89,11 +95,15 @@ mov eax,cr0 inc eax ;CR0_PG to S jns endcpu386 -no_vcpi: + ifndef NO386 p8086 extrn die:near godie: +no_vcpi: call near die + else + jmp endcpu86 + endif ;*************************************************************** ; checks for vcpi @@ -145,9 +155,16 @@ ; get_vcpi_interface() || die("VCPI: low 640k: need 1:1 mapping"); ;extrn _get_vcpi_interface:near ;call _get_vcpi_interface + ifndef NO386 mov bx,offset msg_badmapping jnz no_vcpi - inc [byte bx+_vcpi-msg_badmapping] + dec [byte bx+_vcpi-msg_badmapping] + else + jnz no_vcpi + extrn _vcpi:byte + dec [byte _vcpi] +no_vcpi: + endif endcpu386: pushfd pop dx @@ -164,6 +181,9 @@ je @@no_cpuid ; CPUID feature bit changed ? mov eax,80000001h ; Extended Processor Info and Feature Bits cpuid + ifdef NO386 + mov dl,-1 ; set 386 flag + endif mov [_cpu_features],edx @@no_cpuid: endcpu86: