Hi!
23--2006 19:12 [EMAIL PROTECTED] (Michael Devore) wrote to
[email protected]:
>>first task pushes a lot of 32bit registers. ...and this was long ago
>>reported by Eric.
MD> No, Eric reported, multiple times, about SY3PACK which is no longer
MD> used.
I do search over archive on sf.net (unfortunately, three iterations,
but I found):
From: Eric Auer <[EMAIL PROTECTED]>
Re: XMS Manager on "286
2005-03-17 16:53
"
Anyway, I found a PROBLEM which exists in the open source HIMEM code:
proc initialize
pushf
push eax ebx ecx edx esi edi
...
call check_cpu ; do we have at least a 386?
mov dx,offset no_386
jnc have_386
jmp error_exit
have_386:
...
Does not make much sense to add a 386 safety check AFTER having
used 32bit registers earlier in initialize. Plus the DOS 3.0+ and
the "XMS already installed" check might both be using 386+ style
jmp conditional near jumps: As a solution, they can jump conditionally
to the "jmp error_exit" line instead of directly to error_exit :-) .
I think the recipe for an 186+ safe HIMEM *and* EMM386 would therefore
be:
- replace the LSS in the SY2PACK stub (can only be done by Tom)
- move the "call check_cpu" to the very start of "initialize" (with an
pushf, push ax ... pop ax, popf around it, if needed)
- give the error exit for the "check_cpu failed" case a SEPARATE code
thing (bypassing the "clear_table" code - it looks like you NEVER
need "clear_table" after doing error_exit!? - and bypassing the line
pop edi esi edx ecx ebx eax)
- avoid 386-optimizations in the C code for startup_exe / startup_driver
- call a CPU checker before jumping to TheRealMain of EMM386
(at the moment, IS386() is called relatively late from TheRealMain)
- anything else that I might have forgotten
So you got one small fix in SY2PACK,
a bit of reordering of code in HIMEM,
and yet another bit of reordering or code (including replacement of
the C error message by an ASM one) in EMM386.
"
MD> And as I recall, you were posting about the CPU test code recently.
Yes, but this was related to missing popf in procedure, not about this
procedure usage.
But I should say, that current CPU testing code _at least_ not elegant.
Valid and good code is:
pushf
pushf
pop ax
xor ah,11110000b
push ax
popf
pushf
pop bx
popf
xor ah,bh ; 0=8086-80286, else 80386+
and bh,11110000b ; F0h=8086-80186, 0=80286
But, current check_cpu in HIMEM not only not elegant, but also buggy (even
in compare with is386 in emm386)!
proc check_cpu
pushf
xor ax,ax
push ax ; BAD! ALL flags changed!
popf
pushf
pop ax
and ah,0fh ; Should be 0F0h?
cmp ah,0fh ; 0Fh is OF/DF/IF/TF flags, thus
je not386 ; this jump never happena.
mov ah,7
push ax
popf
pushf
pop ax
and ah,7 ; Same as above:
je not386 ; this jump never happens...
popf
clc ; ...so this code always reuturns 'this is 386'!
ret
not386:
popf
stc
ret
endp check_cpu
About is386 in EMM386 - I not analyze it too deeply, but, at least, comment
there is wrong: "a 286 always sets it to Null" is valid only for real mode.
MD> I'd like someone to actually run it on a chip and see what happens anyway.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel