Fixed the overflow checks for all IDIV instructions for 286+ CPU's;
Fixed the mouse close functions.
This commit is contained in:
@@ -477,7 +477,7 @@ int idivl(int32_t val)
|
|||||||
rem=num%val;
|
rem=num%val;
|
||||||
quo32=(int32_t)(quo&0xFFFFFFFF);
|
quo32=(int32_t)(quo&0xFFFFFFFF);
|
||||||
|
|
||||||
if (quo!=(int64_t)quo32)
|
if ((quo > 0x000000007FFFFFFFLL) || (quo < 0xFFFFFFFF80000000LL))
|
||||||
{
|
{
|
||||||
divexcp();
|
divexcp();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ static int opF6_a16(uint32_t fetchdat)
|
|||||||
int tempws, tempws2 = 0;
|
int tempws, tempws2 = 0;
|
||||||
uint16_t tempw, src16;
|
uint16_t tempw, src16;
|
||||||
uint8_t src, dst;
|
uint8_t src, dst;
|
||||||
int8_t temps;
|
|
||||||
|
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
dst = geteab(); if (cpu_state.abrt) return 1;
|
dst = geteab(); if (cpu_state.abrt) return 1;
|
||||||
@@ -133,8 +132,7 @@ static int opF6_a16(uint32_t fetchdat)
|
|||||||
case 0x38: /*IDIV AL,b*/
|
case 0x38: /*IDIV AL,b*/
|
||||||
tempws = (int)(int16_t)AX;
|
tempws = (int)(int16_t)AX;
|
||||||
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
||||||
temps = tempws2 & 0xff;
|
if (dst && ((tempws2 > 0x0000007F) || (tempws2 < 0xFFFFFF80)))
|
||||||
if (dst && ((int)temps == tempws2))
|
|
||||||
{
|
{
|
||||||
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
||||||
AL = tempws2 & 0xff;
|
AL = tempws2 & 0xff;
|
||||||
@@ -164,7 +162,6 @@ static int opF6_a32(uint32_t fetchdat)
|
|||||||
int tempws, tempws2 = 0;
|
int tempws, tempws2 = 0;
|
||||||
uint16_t tempw, src16;
|
uint16_t tempw, src16;
|
||||||
uint8_t src, dst;
|
uint8_t src, dst;
|
||||||
int8_t temps;
|
|
||||||
|
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
dst = geteab(); if (cpu_state.abrt) return 1;
|
dst = geteab(); if (cpu_state.abrt) return 1;
|
||||||
@@ -230,8 +227,7 @@ static int opF6_a32(uint32_t fetchdat)
|
|||||||
case 0x38: /*IDIV AL,b*/
|
case 0x38: /*IDIV AL,b*/
|
||||||
tempws = (int)(int16_t)AX;
|
tempws = (int)(int16_t)AX;
|
||||||
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
if (dst != 0) tempws2 = tempws / (int)((int8_t)dst);
|
||||||
temps = tempws2 & 0xff;
|
if (dst && ((tempws2 > 0x0000007F) || (tempws2 < 0xFFFFFF80)))
|
||||||
if (dst && ((int)temps == tempws2))
|
|
||||||
{
|
{
|
||||||
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
AH = (tempws % (int)((int8_t)dst)) & 0xff;
|
||||||
AL = tempws2 & 0xff;
|
AL = tempws2 & 0xff;
|
||||||
@@ -263,7 +259,6 @@ static int opF7_w_a16(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint32_t templ, templ2;
|
uint32_t templ, templ2;
|
||||||
int tempws, tempws2 = 0;
|
int tempws, tempws2 = 0;
|
||||||
int16_t temps16;
|
|
||||||
uint16_t src, dst;
|
uint16_t src, dst;
|
||||||
|
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
@@ -329,8 +324,7 @@ static int opF7_w_a16(uint32_t fetchdat)
|
|||||||
case 0x38: /*IDIV AX,w*/
|
case 0x38: /*IDIV AX,w*/
|
||||||
tempws = (int)((DX << 16)|AX);
|
tempws = (int)((DX << 16)|AX);
|
||||||
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
||||||
temps16 = tempws2 & 0xffff;
|
if ((dst != 0) && ((tempws2 > 0x00007FFF) || (tempws2 < 0xFFFF8000)))
|
||||||
if ((dst != 0) && ((int)temps16 == tempws2))
|
|
||||||
{
|
{
|
||||||
DX = tempws % (int)((int16_t)dst);
|
DX = tempws % (int)((int16_t)dst);
|
||||||
AX = tempws2 & 0xffff;
|
AX = tempws2 & 0xffff;
|
||||||
@@ -355,7 +349,6 @@ static int opF7_w_a32(uint32_t fetchdat)
|
|||||||
{
|
{
|
||||||
uint32_t templ, templ2;
|
uint32_t templ, templ2;
|
||||||
int tempws, tempws2 = 0;
|
int tempws, tempws2 = 0;
|
||||||
int16_t temps16;
|
|
||||||
uint16_t src, dst;
|
uint16_t src, dst;
|
||||||
|
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
@@ -421,8 +414,7 @@ static int opF7_w_a32(uint32_t fetchdat)
|
|||||||
case 0x38: /*IDIV AX,w*/
|
case 0x38: /*IDIV AX,w*/
|
||||||
tempws = (int)((DX << 16)|AX);
|
tempws = (int)((DX << 16)|AX);
|
||||||
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
if (dst) tempws2 = tempws / (int)((int16_t)dst);
|
||||||
temps16 = tempws2 & 0xffff;
|
if ((dst != 0) && ((tempws2 > 0x00007FFF) || (tempws2 < 0xFFFF8000)))
|
||||||
if ((dst != 0) && ((int)temps16 == tempws2))
|
|
||||||
{
|
{
|
||||||
DX = tempws % (int)((int16_t)dst);
|
DX = tempws % (int)((int16_t)dst);
|
||||||
AX = tempws2 & 0xffff;
|
AX = tempws2 & 0xffff;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
* only the Logitech part is considered to
|
* only the Logitech part is considered to
|
||||||
* be OK.
|
* be OK.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse_bus.c 1.0.27 2017/12/09
|
* Version: @(#)mouse_bus.c 1.0.28 2017/12/14
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -584,6 +584,7 @@ bm_close(void *priv)
|
|||||||
bm_read, NULL, NULL, bm_write, NULL, NULL, dev);
|
bm_read, NULL, NULL, bm_write, NULL, NULL, dev);
|
||||||
|
|
||||||
free(dev);
|
free(dev);
|
||||||
|
dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of PS/2 series Mouse devices.
|
* Implementation of PS/2 series Mouse devices.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse_ps2.c 1.0.3 2017/12/09
|
* Version: @(#)mouse_ps2.c 1.0.4 2017/12/13
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*/
|
*/
|
||||||
@@ -261,6 +261,7 @@ ps2_close(void *priv)
|
|||||||
keyboard_at_set_mouse(NULL, NULL);
|
keyboard_at_set_mouse(NULL, NULL);
|
||||||
|
|
||||||
free(dev);
|
free(dev);
|
||||||
|
dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* TODO: Add the Genius Serial Mouse.
|
* TODO: Add the Genius Serial Mouse.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse_serial.c 1.0.16 2017/12/09
|
* Version: @(#)mouse_serial.c 1.0.17 2017/12/13
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*/
|
*/
|
||||||
@@ -199,12 +199,13 @@ sermouse_close(void *priv)
|
|||||||
mouse_t *dev = (mouse_t *)priv;
|
mouse_t *dev = (mouse_t *)priv;
|
||||||
|
|
||||||
/* Detach serial port from the mouse. */
|
/* Detach serial port from the mouse. */
|
||||||
if (dev->serial != NULL) {
|
if ((dev != NULL) && (dev->serial != NULL)) {
|
||||||
dev->serial->rcr_callback = NULL;
|
dev->serial->rcr_callback = NULL;
|
||||||
dev->serial->rcr_callback_p = NULL;
|
dev->serial->rcr_callback_p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dev);
|
free(dev);
|
||||||
|
dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user