mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 10:49:33 +01:00
* merged fixes
This commit is contained in:
parent
2e96721c20
commit
de31797244
@ -225,6 +225,9 @@ ASM
|
||||
pushl %ecx;
|
||||
pushl %edx;
|
||||
{ ; caution : ds is not the selector for our data !! }
|
||||
MOVW %cs:v2prt0_ds_alias,%ax
|
||||
movw %ax,%es
|
||||
{ ES now has dataseg alias that is never invalid }
|
||||
{$ifdef DEBUG}
|
||||
MOVL %EDI,%ES:EntryEDI
|
||||
MOVL %ESI,%ES:EntryESI
|
||||
@ -266,20 +269,32 @@ ASM
|
||||
POP %FS; { Restore FS register }
|
||||
POP %DS; { Restore DS register }
|
||||
POP %ES; { Restore ES register }
|
||||
movw %ds,%ax;
|
||||
lsl %eax,%eax;
|
||||
cmpl %eax,%esi;
|
||||
ja .Lsimplecopy;
|
||||
movzwl %si,%eax;
|
||||
jmp .Lcopyend;
|
||||
movw %es,%ax
|
||||
cmpw $0,%ax
|
||||
jne .Lesisok
|
||||
{ ; caution : ds is not the selector for our data !! }
|
||||
MOVW %cs:v2prt0_ds_alias,%ax
|
||||
movw %ax,%es
|
||||
.Lesisok:
|
||||
lsl %eax,%eax
|
||||
cmpl %edi,%eax
|
||||
ja .Ldontzeroedi
|
||||
movzwl %di,%edi
|
||||
.Ldontzeroedi:
|
||||
movw %ds,%ax
|
||||
lsl %eax,%eax
|
||||
cmpl %esi,%eax
|
||||
ja .Lsimplecopy
|
||||
movzwl %si,%eax
|
||||
jmp .Lcopyend
|
||||
.Lsimplecopy:
|
||||
movl %esi,%eax;
|
||||
movl %esi,%eax
|
||||
.Lcopyend:
|
||||
MOVL %ds:(%Eax), %EAX;
|
||||
MOVL %EAX, %ES:42(%EDI); { Set as return addr }
|
||||
ADDW $4, %ES:46(%EDI); { adjust stack }
|
||||
popl %eax;
|
||||
IRET; { Interrupt return }
|
||||
MOVL %ds:(%Eax), %EAX
|
||||
MOVL %EAX, %ES:42(%EDI) { Set as return addr }
|
||||
ADDW $4, %ES:46(%EDI) { adjust stack }
|
||||
popl %eax
|
||||
IRET { Interrupt return }
|
||||
END;
|
||||
|
||||
Function Allocate_mouse_bridge : boolean;
|
||||
@ -755,7 +770,10 @@ Begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2001-12-26 21:20:47 peter
|
||||
Revision 1.5 2002-01-19 11:57:55 peter
|
||||
* merged fixes
|
||||
|
||||
Revision 1.4 2001/12/26 21:20:47 peter
|
||||
* more xp fixes
|
||||
|
||||
Revision 1.3 2001/12/26 21:03:56 peter
|
||||
|
||||
@ -109,14 +109,72 @@ end;
|
||||
|
||||
|
||||
Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
|
||||
var
|
||||
regs : registers;
|
||||
size,
|
||||
readsize : longint;
|
||||
begin
|
||||
result := Do_Read(Handle, longint(@Buffer), Count);
|
||||
readsize:=0;
|
||||
while Count > 0 do
|
||||
begin
|
||||
if Count>tb_size then
|
||||
size:=tb_size
|
||||
else
|
||||
size:=Count;
|
||||
regs.realecx:=size;
|
||||
regs.realedx:=tb_offset;
|
||||
regs.realds:=tb_segment;
|
||||
regs.realebx:=Handle;
|
||||
regs.realeax:=$3f00;
|
||||
RealIntr($21,regs);
|
||||
if (regs.realflags and carryflag) <> 0 then
|
||||
begin
|
||||
Result:=-1;
|
||||
exit;
|
||||
end;
|
||||
syscopyfromdos(Longint(@Buffer)+readsize,lo(regs.realeax));
|
||||
inc(readsize,lo(regs.realeax));
|
||||
dec(Count,lo(regs.realeax));
|
||||
{ stop when not the specified size is read }
|
||||
if lo(regs.realeax)<size then
|
||||
break;
|
||||
end;
|
||||
Result:=readsize;
|
||||
end;
|
||||
|
||||
|
||||
Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
|
||||
var
|
||||
regs : registers;
|
||||
size,
|
||||
writesize : longint;
|
||||
begin
|
||||
result := Do_Write(Handle, longint(@Buffer), Count);
|
||||
writesize:=0;
|
||||
while Count > 0 do
|
||||
begin
|
||||
if Count>tb_size then
|
||||
size:=tb_size
|
||||
else
|
||||
size:=Count;
|
||||
syscopytodos(Longint(@Buffer)+writesize,size);
|
||||
regs.realecx:=size;
|
||||
regs.realedx:=tb_offset;
|
||||
regs.realds:=tb_segment;
|
||||
regs.realebx:=Handle;
|
||||
regs.realeax:=$4000;
|
||||
RealIntr($21,regs);
|
||||
if (regs.realflags and carryflag) <> 0 then
|
||||
begin
|
||||
Result:=-1;
|
||||
exit;
|
||||
end;
|
||||
inc(writesize,lo(regs.realeax));
|
||||
dec(Count,lo(regs.realeax));
|
||||
{ stop when not the specified size is written }
|
||||
if lo(regs.realeax)<size then
|
||||
break;
|
||||
end;
|
||||
Result:=WriteSize;
|
||||
end;
|
||||
|
||||
|
||||
@ -656,7 +714,10 @@ Finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2001-10-25 21:23:49 peter
|
||||
Revision 1.7 2002-01-19 11:57:55 peter
|
||||
* merged fixes
|
||||
|
||||
Revision 1.6 2001/10/25 21:23:49 peter
|
||||
* added 64bit fileseek
|
||||
|
||||
Revision 1.5 2001/06/03 15:18:01 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user