wok diff linld/stuff/src/_BEG.ASM @ rev 20458
Up amule (2.3.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Oct 10 10:43:41 2018 +0200 (2018-10-10) |
parents | 46b511e941a7 |
children | 049ced0bd387 |
line diff
1.1 --- a/linld/stuff/src/_BEG.ASM Fri Oct 05 23:02:32 2018 +0200 1.2 +++ b/linld/stuff/src/_BEG.ASM Wed Oct 10 10:43:41 2018 +0200 1.3 @@ -50,7 +50,7 @@ 1.4 ; clear bss 1.5 ;*************************************************************** 1.6 mov si,offset _bss_start 1.7 - mov bx, 0F000h ; cld ; cli 1.8 + mov bx, 0F000h ; cld ; cli & empty string 1.9 clearbss: 1.10 mov [si],bl ; clear bss + heap + sp 1.11 inc si 1.12 @@ -68,40 +68,33 @@ 1.13 add dh,bh ; NS=386+, S+NC=286, S+C=86/186 1.14 ifndef NO386 1.15 mov bx,offset msg_badcpu 1.16 - js no_vcpi ;it is not a 386+ 1.17 + js godie ;it is not a 386+ 1.18 else 1.19 - js endcpu ;it is not a 386+ 1.20 + js endcpu86 ;it is not a 386+ 1.21 endif 1.22 p386 1.23 - ifdef EXTRA 1.24 - pushfd 1.25 - pop dx 1.26 - pop ax 1.27 - mov bl,al 1.28 - xor al,20h ; toggle CPUID feature bit 21 1.29 - push ax 1.30 - push dx 1.31 - popfd 1.32 - pushfd 1.33 - pop dx 1.34 - pop ax 1.35 - xor al,bl ; clear C 1.36 - je @@check_vm ; CPUID feature bit changed ? 1.37 - mov eax,80000001h ; Extended Processor Info and Feature Bits 1.38 - cpuid 1.39 - mov [_cpu_features],edx 1.40 -@@check_vm: 1.41 - endif 1.42 ; Check for vm 1.43 smsw ax ;SMSW cannot be trapped! :-) 1.44 and al,1 ;MSW_PE 1.45 ; We're in vm 1.46 - jz check_rm_paging 1.47 + jnz check_vcpi 1.48 + 1.49 +check_rm_paging: 1.50 +; It's a 386 in real mode, chk for paging (crazy but possible) 1.51 + mov eax,cr0 1.52 + inc eax ;CR0_PG to S 1.53 + jns endcpu386 1.54 +no_vcpi: 1.55 + p8086 1.56 + extrn die:near 1.57 +godie: 1.58 + call near die 1.59 1.60 ;*************************************************************** 1.61 ; checks for vcpi 1.62 ;*************************************************************** 1.63 label check_vcpi near 1.64 + p386 1.65 push ds 1.66 ; Check whether it is safe to call 67h (we trust only known EMM managers) 1.67 push si 1.68 @@ -142,29 +135,35 @@ 1.69 test ah,ah 1.70 jnz no_vcpi 1.71 is386vcpi: 1.72 - inc [byte _vcpi] 1.73 extrn prepare_vcpi:near 1.74 call prepare_vcpi 1.75 ; get_vcpi_interface() || die("VCPI: low 640k: need 1:1 mapping"); 1.76 ;extrn _get_vcpi_interface:near 1.77 ;call _get_vcpi_interface 1.78 mov bx,offset msg_badmapping 1.79 - jz endcpu 1.80 -no_vcpi: 1.81 - p8086 1.82 - ;;pop dx ;$ handle 1.83 - ;;mov ax,4500h ; DEALLOCATE PAGES 1.84 - ;;int 67h 1.85 - extrn die:near 1.86 -godie: 1.87 - call near die 1.88 -check_rm_paging: 1.89 -; It's a 386 in real mode, chk for paging (crazy but possible) 1.90 - p386 1.91 - mov eax,cr0 1.92 - inc eax ;CR0_PG to S 1.93 - js no_vcpi 1.94 -endcpu: 1.95 + jnz no_vcpi 1.96 + inc [byte bx+_vcpi-msg_badmapping] 1.97 +endcpu386: 1.98 + ifdef EXTRA 1.99 + pushfd 1.100 + pop dx 1.101 + pop ax 1.102 + mov bl,al 1.103 + xor al,20h ; toggle CPUID feature bit 21 1.104 + push ax 1.105 + push dx 1.106 + popfd 1.107 + pushfd 1.108 + pop dx 1.109 + pop ax 1.110 + xor al,bl ; clear C 1.111 + je @@no_cpuid ; CPUID feature bit changed ? 1.112 + mov eax,80000001h ; Extended Processor Info and Feature Bits 1.113 + cpuid 1.114 + mov [_cpu_features],edx 1.115 +@@no_cpuid: 1.116 + endif 1.117 +endcpu86: 1.118 p8086 1.119 1.120 ;***************************************************************