mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-31 19:06:09 +02:00
* merged winxp fixes
This commit is contained in:
parent
190ead04c0
commit
5d17b24542
@ -955,6 +955,9 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{$ifdef CREATE_C_FUNCTIONS}
|
{$ifdef CREATE_C_FUNCTIONS}
|
||||||
|
var
|
||||||
|
_os_trueversion : word;external name '__os_trueversion';
|
||||||
|
|
||||||
procedure djgpp_exception_processor;[public,alias : '___djgpp_exception_processor'];
|
procedure djgpp_exception_processor;[public,alias : '___djgpp_exception_processor'];
|
||||||
var
|
var
|
||||||
sig : longint;
|
sig : longint;
|
||||||
@ -1038,10 +1041,17 @@ begin
|
|||||||
|
|
||||||
for i:=0 to 17{EXCEPTIONCOUNT-1} do
|
for i:=0 to 17{EXCEPTIONCOUNT-1} do
|
||||||
begin
|
begin
|
||||||
if get_pm_exception_handler(i,_except) then
|
{$ifdef DPMIEXCP_DEBUG}
|
||||||
|
errln('new exception '+hexstr(i,2)+' '+hexstr(except_ori[i].segment,4)+':'+hexstr(longint(except_ori[i].offset),8));
|
||||||
|
{$endif DPMIEXCP_DEBUG}
|
||||||
|
{ Windows 2000 seems to not set carryflag on func 0x210 :( PM }
|
||||||
|
if (_os_trueversion <> $532) and get_pm_exception_handler(i,_except) then
|
||||||
begin
|
begin
|
||||||
if (i <> 2) {or (_crt0_startup_flags & _CRT0_FLAG_NMI_SIGNAL))} then
|
if (i <> 2) {or (_crt0_startup_flags & _CRT0_FLAG_NMI_SIGNAL))} then
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DPMIEXCP_DEBUG}
|
||||||
|
errln('Using DPMI 1.0 functions');
|
||||||
|
{$endif DPMIEXCP_DEBUG}
|
||||||
if not set_pm_exception_handler(i,except_ori[i]) then
|
if not set_pm_exception_handler(i,except_ori[i]) then
|
||||||
errln('error setting exception nø'+hexstr(i,2));
|
errln('error setting exception nø'+hexstr(i,2));
|
||||||
end;
|
end;
|
||||||
@ -1051,6 +1061,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
if get_exception_handler(i,_except) then
|
if get_exception_handler(i,_except) then
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DPMIEXCP_DEBUG}
|
||||||
|
errln('Using DPMI 0.9 functions');
|
||||||
|
{$endif DPMIEXCP_DEBUG}
|
||||||
if (i <> 2) {or (_crt0_startup_flags & _CRT0_FLAG_NMI_SIGNAL))} then
|
if (i <> 2) {or (_crt0_startup_flags & _CRT0_FLAG_NMI_SIGNAL))} then
|
||||||
begin
|
begin
|
||||||
if not set_exception_handler(i,except_ori[i]) then
|
if not set_exception_handler(i,except_ori[i]) then
|
||||||
@ -1059,6 +1072,9 @@ begin
|
|||||||
except_ori[i]:=_except;
|
except_ori[i]:=_except;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ifdef DPMIEXCP_DEBUG}
|
||||||
|
errln('prev exception '+hexstr(i,2)+' '+hexstr(_except.segment,4)+':'+hexstr(longint(_except.offset),8));
|
||||||
|
{$endif DPMIEXCP_DEBUG}
|
||||||
end;
|
end;
|
||||||
get_pm_interrupt($75,_except);
|
get_pm_interrupt($75,_except);
|
||||||
set_pm_interrupt($75,npx_ori);
|
set_pm_interrupt($75,npx_ori);
|
||||||
@ -1117,6 +1133,39 @@ var
|
|||||||
_swap_out : pointer;external name '_swap_out';
|
_swap_out : pointer;external name '_swap_out';
|
||||||
_exception_exit : pointer;external name '_exception_exit';
|
_exception_exit : pointer;external name '_exception_exit';
|
||||||
|
|
||||||
|
const
|
||||||
|
STUBINFO_END = $54;
|
||||||
|
|
||||||
|
procedure __maybe_fix_w2k_ntvdm_bug;[public,alias : '___maybe_fix_w2k_ntvdm_bug'];
|
||||||
|
var
|
||||||
|
psp_sel : word;
|
||||||
|
begin
|
||||||
|
if _os_trueversion = $532 then
|
||||||
|
begin
|
||||||
|
{ avoid NTVDM bug on NT,2000 or XP }
|
||||||
|
{ see dpmiexcp.c source of DJGPP PM }
|
||||||
|
if stub_info^.size < STUBINFO_END then
|
||||||
|
begin
|
||||||
|
asm
|
||||||
|
movb $0x51,%ah
|
||||||
|
int $0x21
|
||||||
|
movb $0x50,%ah
|
||||||
|
int $0x21
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
psp_sel:=stub_info^.psp_selector;
|
||||||
|
asm
|
||||||
|
movw psp_sel,%bx
|
||||||
|
movb $0x50,%ah
|
||||||
|
int $0x21
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure dpmiexcp_exit{(status : longint)};[public,alias : 'excep_exit'];
|
procedure dpmiexcp_exit{(status : longint)};[public,alias : 'excep_exit'];
|
||||||
{ We need to restore hardware interrupt handlers even if somebody calls
|
{ We need to restore hardware interrupt handlers even if somebody calls
|
||||||
`_exit' directly, or else we crash the machine in nested programs.
|
`_exit' directly, or else we crash the machine in nested programs.
|
||||||
@ -1128,6 +1177,7 @@ begin
|
|||||||
_exception_exit:=nil;
|
_exception_exit:=nil;
|
||||||
_swap_in:=nil;
|
_swap_in:=nil;
|
||||||
_swap_out:=nil;
|
_swap_out:=nil;
|
||||||
|
__maybe_fix_w2k_ntvdm_bug;
|
||||||
{ restore the FPU state }
|
{ restore the FPU state }
|
||||||
dpmi_set_coprocessor_emulation(1);
|
dpmi_set_coprocessor_emulation(1);
|
||||||
end;
|
end;
|
||||||
@ -1495,7 +1545,10 @@ end;
|
|||||||
{$endif IN_SYSTEM}
|
{$endif IN_SYSTEM}
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2002-01-25 16:23:03 peter
|
Revision 1.9 2002-02-03 09:51:41 peter
|
||||||
|
* merged winxp fixes
|
||||||
|
|
||||||
|
Revision 1.8 2002/01/25 16:23:03 peter
|
||||||
* merged filesearch() fix
|
* merged filesearch() fix
|
||||||
|
|
||||||
Revision 1.7 2001/11/24 14:42:19 carl
|
Revision 1.7 2001/11/24 14:42:19 carl
|
||||||
|
@ -582,6 +582,20 @@ ___dpmi_get_version:
|
|||||||
popl %ebp
|
popl %ebp
|
||||||
ret $4
|
ret $4
|
||||||
|
|
||||||
|
_set_os_trueversion:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp,%ebp
|
||||||
|
movl $0x3306,%eax
|
||||||
|
xorl %ebx,%ebx
|
||||||
|
int $0x21
|
||||||
|
movzbl %bl,%eax
|
||||||
|
shll $8,%eax
|
||||||
|
shrl $8,%ebx
|
||||||
|
andl $0xff,%ebx
|
||||||
|
addl %ebx,%eax
|
||||||
|
movw %ax,__os_trueversion
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
/* .globl ___dpmi_get_segment_base_address*/
|
/* .globl ___dpmi_get_segment_base_address*/
|
||||||
___dpmi_get_segment_base_address:
|
___dpmi_get_segment_base_address:
|
||||||
pushl %ebp; movl %esp,%ebp
|
pushl %ebp; movl %esp,%ebp
|
||||||
@ -739,6 +753,7 @@ ___prt1_startup:
|
|||||||
pushl %ebx
|
pushl %ebx
|
||||||
incl ___bss_count
|
incl ___bss_count
|
||||||
movl $0,___crt0_argv
|
movl $0,___crt0_argv
|
||||||
|
call _set_os_trueversion
|
||||||
call _setup_core_selector
|
call _setup_core_selector
|
||||||
call _setup_screens
|
call _setup_screens
|
||||||
call _setup_go32_info_block
|
call _setup_go32_info_block
|
||||||
@ -751,7 +766,7 @@ ___prt1_startup:
|
|||||||
fninit /* initialize fpu */
|
fninit /* initialize fpu */
|
||||||
push %eax /* Dummy for status store check */
|
push %eax /* Dummy for status store check */
|
||||||
movl %esp,%esi
|
movl %esp,%esi
|
||||||
movw $0x5a5a,(%esi)
|
movw $0x5a5a,(%esi)
|
||||||
/* fwait maybe this one is responsible of exceptions */
|
/* fwait maybe this one is responsible of exceptions */
|
||||||
fnstsw (%esi)
|
fnstsw (%esi)
|
||||||
cmpb $0,(%esi)
|
cmpb $0,(%esi)
|
||||||
@ -916,9 +931,14 @@ ___PROXY:
|
|||||||
___PROXY_LEN:
|
___PROXY_LEN:
|
||||||
.long 7
|
.long 7
|
||||||
|
|
||||||
|
.comm __os_trueversion,2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2001-08-21 13:12:22 florian
|
Revision 1.4 2002-02-03 09:51:41 peter
|
||||||
|
* merged winxp fixes
|
||||||
|
|
||||||
|
Revision 1.3 2001/08/21 13:12:22 florian
|
||||||
* reverted to previous version
|
* reverted to previous version
|
||||||
|
|
||||||
Revision 1.1 2000/07/13 06:30:40 michael
|
Revision 1.1 2000/07/13 06:30:40 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user