diff --git a/rtl/go32v2/mouse.pp b/rtl/go32v2/mouse.pp index 72562f11a9..90de659cc5 100644 --- a/rtl/go32v2/mouse.pp +++ b/rtl/go32v2/mouse.pp @@ -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 diff --git a/rtl/go32v2/sysutils.pp b/rtl/go32v2/sysutils.pp index 4f9740a188..d1d9724635 100644 --- a/rtl/go32v2/sysutils.pp +++ b/rtl/go32v2/sysutils.pp @@ -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) 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)