Git Product home page Git Product logo

Comments (8)

NattyNarwhal avatar NattyNarwhal commented on May 27, 2024

Ugh, I wonder if this is related to #22 - I have some ideas, but not sure (i.e. do we need to restore extended registers if we're mangling them from not 386 protected mode?)

from vmwmouse.

NattyNarwhal avatar NattyNarwhal commented on May 27, 2024

Stupid stupid idea: try this patch. I don't think it'll change much, but it'll guard changing extended registers from 16-bit world.

diff --git a/ps2.asm b/ps2.asm
index c8ef944..bf521bf 100644
--- a/ps2.asm
+++ b/ps2.asm
@@ -253,12 +253,12 @@ ps2_int proc    far
 	test    PS2_DATA_FLAG,0FFh
 	jz      ps2_int_exit            ;Not a valid PS/2 mouse interrupt
 
-	push    ax                      ;Save the world
-	push    bx
-	push    cx
-	push    dx
-	push    si
-	push    di
+	push    eax                      ;Save the world
+	push    ebx
+	push    ecx
+	push    edx
+	push    esi
+	push    edi
 	push    bp
 	push    ds
 	push    es
@@ -357,12 +357,12 @@ ps2_no_data:
 	pop     es
 	pop     ds
 	pop     bp
-	pop     di
-	pop     si
-	pop     dx
-	pop     cx
-	pop     bx
-	pop     ax
+	pop     edi
+	pop     esi
+	pop     edx
+	pop     ecx
+	pop     ebx
+	pop     eax
 
 ps2_int_exit:
 	pop ds
@@ -480,6 +480,10 @@ page
 ps2_search      proc    near
 
 	; Check for the VMware backdoor.
+	push	eax
+	push	ebx
+	push	ecx
+	push	edx
 	xor ebx, ebx
 	mov ecx, CMD_GETVERSION
 	call Backdoor
@@ -490,13 +494,18 @@ ps2_search      proc    near
 	; Under hypervisors, always assume the 286/386 PS/2 mouse vector
 	mov vector, 074h
 	stc                             ;Show mouse was found
-	ret
+	jmp	ps2_search_pop
 
 ps2_cant_use_it:
 	mov     vector,-1               ;Restore to "no mouse" value
 
 ps2_machine_not_found:
 	clc                             ;'C' clear shows not found
+ps2_search_pop:
+	pop	edx
+	pop	ecx
+	pop	ebx
+	pop	eax
 	ret
 
 ps2_search      endp
@@ -642,6 +651,10 @@ vmware_load_ini:
 	mov	wheel_enabled, ax
 
 vmware_enable_absolute:
+	push	eax
+	push	ebx
+	push	ecx
+	push	edx
 	; We need to do this *after* successfully setting up our hook.
 	; I don't know if these can fail, but OSDev Wiki doesn't check,
 	; and we do check if we're on something VMware-shaped before...
@@ -663,6 +676,10 @@ vmware_enable_absolute:
 	mov ebx, ABSPOINTER_ABSOLUTE
 	mov ecx, CMD_ABSPOINTER_COMMAND
 	call Backdoor
+	pop	edx
+	pop	ecx
+	pop	ebx
+	pop	eax
 
 ps2_enable_abort:
 	ret
@@ -728,9 +745,17 @@ ps2_disable_exit:
 	; (CB) Put the mouse back to relative on disable?
 
 	; Enable relative
+	push	eax
+	push	ebx
+	push	ecx
+	push	edx
 	mov ebx, ABSPOINTER_RELATIVE
 	mov ecx, CMD_ABSPOINTER_COMMAND
 	call Backdoor
+	pop	edx
+	pop	ecx
+	pop	ebx
+	pop	eax
 
 	ret
 

from vmwmouse.

FeralChild64 avatar FeralChild64 commented on May 27, 2024

Seems to work. I have manually applied the patch to current main - and the Total Commander works correctly now, at least for me.

from vmwmouse.

NattyNarwhal avatar NattyNarwhal commented on May 27, 2024

Interesting; I wonder what specific hunk is solving the issue. Could you try basically try adding them one by one until you can confirm one solves the issue?

I also wonder if this even solves the issue too, or if it's just luck that it's not triggering. I have to wonder what's happening, and why. I wouldn't think changing the extended registers from 16-bit code would hurt things either, but things surprise me when you drop to this level, unfortunately....

from vmwmouse.

NattyNarwhal avatar NattyNarwhal commented on May 27, 2024

FWIW, this also doesn't solve #22, so this is just for this, it seems.

from vmwmouse.

FeralChild64 avatar FeralChild64 commented on May 27, 2024

Could you try basically try adding them one by one until you can confirm one solves the issue?

I'll try when I have some more time.

from vmwmouse.

FeralChild64 avatar FeralChild64 commented on May 27, 2024

I don't have much time to test (I have full hands with my development), but it seems the first change (in ps2_int / ps2_no_data) is enough to stop the crashes.

from vmwmouse.

javispedro avatar javispedro commented on May 27, 2024

I wouldn't think changing the extended registers from 16-bit code would hurt things either, but things surprise me when you drop to this level, unfortunately....

I am also clobbering the 32-bit upper half of registers during Enable/Disable but I have not seen any issues so far.
As for clobbering inside the actual PS/2 callback, while I don't know the VMware BIOS, the VBox BIOS does push the 32-bit registers before calling the PS/2 callback. If it didn't, clobbering them from the PS/2 callback would be really bad.
Or it could also be that some program is either hooking the PS/2 interrupt or inserting itself in the PS/2 callback chain, and it does not expect the 32-bit registers to be clobbered by the other handlers.

from vmwmouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.