1411 switch (r.type) { 1412 case fex_int: 1413 *(float *)ea = (float) r.val.i; 1414 break; 1415 1416 case fex_llong: 1417 *(float *)ea = (float) r.val.l; 1418 break; 1419 1420 case fex_float: 1421 *(float *)ea = r.val.f; 1422 break; 1423 1424 case fex_double: 1425 *(float *)ea = (float) r.val.d; 1426 break; 1427 1428 case fex_ldouble: 1429 *(float *)ea = (float) r.val.q; 1430 break; 1431 } 1432 if (ex != FPE_FLTRES && (op & 8) != 0) 1433 pop(uap); 1434 return; 1435 1436 case 0x310: 1437 case 0x318: 1438 case 0x350: 1439 case 0x358: 1440 case 0x390: 1441 case 0x398: 1442 if (!ea) 1443 return; 1444 switch (r.type) { 1445 case fex_int: 1446 *(int *)ea = r.val.i; 1447 break; 1448 1449 case fex_llong: 1450 *(int *)ea = (int) r.val.l; 1451 break; 1452 1453 case fex_float: 1454 *(int *)ea = (int) r.val.f; 1455 break; 1456 1457 case fex_double: 1458 *(int *)ea = (int) r.val.d; 1459 break; 1460 1461 case fex_ldouble: 1462 *(int *)ea = (int) r.val.q; 1463 break; 1464 } 1465 if (ex != FPE_FLTRES && (op & 8) != 0) 1466 pop(uap); 1467 return; 1468 1469 case 0x510: 1470 case 0x518: 1471 case 0x550: 1472 case 0x558: 1473 case 0x590: 1474 case 0x598: 1475 if (!ea) 1476 return; 1477 switch (r.type) { 1478 case fex_int: 1479 *(double *)ea = (double) r.val.i; 1480 break; 1481 1482 case fex_llong: 1483 *(double *)ea = (double) r.val.l; 1484 break; 1485 1486 case fex_float: 1487 *(double *)ea = (double) r.val.f; 1488 break; 1489 1490 case fex_double: 1491 *(double *)ea = r.val.d; 1492 break; 1493 1494 case fex_ldouble: 1495 *(double *)ea = (double) r.val.q; 1496 break; 1497 } 1498 if (ex != FPE_FLTRES && (op & 8) != 0) 1499 pop(uap); 1500 return; 1501 1502 case 0x710: 1503 case 0x718: 1504 case 0x750: 1505 case 0x758: 1506 case 0x790: 1507 case 0x798: 1508 if (!ea) 1509 return; 1510 switch (r.type) { 1511 case fex_int: 1512 *(short *)ea = (short) r.val.i; 1513 break; 1514 1515 case fex_llong: 1516 *(short *)ea = (short) r.val.l; 1517 break; 1518 1519 case fex_float: 1520 *(short *)ea = (short) r.val.f; 1521 break; 1522 1523 case fex_double: 1524 *(short *)ea = (short) r.val.d; 1525 break; 1526 1527 case fex_ldouble: 1528 *(short *)ea = (short) r.val.q; 1529 break; 1530 } 1531 if (ex != FPE_FLTRES && (op & 8) != 0) 1532 pop(uap); 1533 return; 1534 1535 case 0x730: 1536 case 0x770: 1537 case 0x7b0: 1538 /* fbstp; don't bother */ 1539 if (ea && ex != FPE_FLTRES) 1540 pop(uap); 1541 return; 1542 1543 case 0x738: 1544 case 0x778: 1545 case 0x7b8: 1546 if (!ea) 1547 return; 1548 switch (r.type) { 1549 case fex_int: 1550 *(long long *)ea = (long long) r.val.i; 1551 break; 1552 1553 case fex_llong: 1554 *(long long *)ea = r.val.l; 1555 break; 1556 1557 case fex_float: 1558 *(long long *)ea = (long long) r.val.f; 1559 break; 1560 1561 case fex_double: 1562 *(long long *)ea = (long long) r.val.d; 1563 break; 1564 1565 case fex_ldouble: 1566 *(long long *)ea = (long long) r.val.q; 1567 break; 1568 } 1569 if (ex != FPE_FLTRES) 1570 pop(uap); 1571 return; 1572 } 1573 1574 /* for all other instructions, the result goes into a register */ 1575 switch (r.type) { 1576 case fex_int: 1577 r.val.q = (long double) r.val.i; 1578 break; 1579 1580 case fex_llong: 1581 r.val.q = (long double) r.val.l; 1582 break; 1583 1584 case fex_float: 1585 r.val.q = (long double) r.val.f; 1586 break; 1587 1588 case fex_double: 1589 r.val.q = (long double) r.val.d; 1590 break; 1591 } 1592 1593 /* for load instructions, push the result onto the stack */ 1594 switch (op & 0x7f8) { 1595 case 0x100: 1596 case 0x140: 1597 case 0x180: 1598 case 0x500: 1599 case 0x540: 1600 case 0x580: 1601 if (ea) 1602 push(r.val.q, uap); 1603 return; 1604 } 1605 1606 /* for all other instructions, if the exception is overflow, 1607 underflow, or inexact, the stack has already been updated */ 1608 stack = (ex == FPE_FLTOVF || ex == FPE_FLTUND || ex == FPE_FLTRES); 1609 switch (op & 0x7f8) { | 1411 switch (r.type) { 1412 case fex_int: 1413 *(float *)ea = (float) r.val.i; 1414 break; 1415 1416 case fex_llong: 1417 *(float *)ea = (float) r.val.l; 1418 break; 1419 1420 case fex_float: 1421 *(float *)ea = r.val.f; 1422 break; 1423 1424 case fex_double: 1425 *(float *)ea = (float) r.val.d; 1426 break; 1427 1428 case fex_ldouble: 1429 *(float *)ea = (float) r.val.q; 1430 break; 1431 1432 default: 1433 break; 1434 } 1435 if (ex != FPE_FLTRES && (op & 8) != 0) 1436 pop(uap); 1437 return; 1438 1439 case 0x310: 1440 case 0x318: 1441 case 0x350: 1442 case 0x358: 1443 case 0x390: 1444 case 0x398: 1445 if (!ea) 1446 return; 1447 switch (r.type) { 1448 case fex_int: 1449 *(int *)ea = r.val.i; 1450 break; 1451 1452 case fex_llong: 1453 *(int *)ea = (int) r.val.l; 1454 break; 1455 1456 case fex_float: 1457 *(int *)ea = (int) r.val.f; 1458 break; 1459 1460 case fex_double: 1461 *(int *)ea = (int) r.val.d; 1462 break; 1463 1464 case fex_ldouble: 1465 *(int *)ea = (int) r.val.q; 1466 break; 1467 1468 default: 1469 break; 1470 } 1471 if (ex != FPE_FLTRES && (op & 8) != 0) 1472 pop(uap); 1473 return; 1474 1475 case 0x510: 1476 case 0x518: 1477 case 0x550: 1478 case 0x558: 1479 case 0x590: 1480 case 0x598: 1481 if (!ea) 1482 return; 1483 switch (r.type) { 1484 case fex_int: 1485 *(double *)ea = (double) r.val.i; 1486 break; 1487 1488 case fex_llong: 1489 *(double *)ea = (double) r.val.l; 1490 break; 1491 1492 case fex_float: 1493 *(double *)ea = (double) r.val.f; 1494 break; 1495 1496 case fex_double: 1497 *(double *)ea = r.val.d; 1498 break; 1499 1500 case fex_ldouble: 1501 *(double *)ea = (double) r.val.q; 1502 break; 1503 1504 default: 1505 break; 1506 } 1507 if (ex != FPE_FLTRES && (op & 8) != 0) 1508 pop(uap); 1509 return; 1510 1511 case 0x710: 1512 case 0x718: 1513 case 0x750: 1514 case 0x758: 1515 case 0x790: 1516 case 0x798: 1517 if (!ea) 1518 return; 1519 switch (r.type) { 1520 case fex_int: 1521 *(short *)ea = (short) r.val.i; 1522 break; 1523 1524 case fex_llong: 1525 *(short *)ea = (short) r.val.l; 1526 break; 1527 1528 case fex_float: 1529 *(short *)ea = (short) r.val.f; 1530 break; 1531 1532 case fex_double: 1533 *(short *)ea = (short) r.val.d; 1534 break; 1535 1536 case fex_ldouble: 1537 *(short *)ea = (short) r.val.q; 1538 break; 1539 1540 default: 1541 break; 1542 } 1543 if (ex != FPE_FLTRES && (op & 8) != 0) 1544 pop(uap); 1545 return; 1546 1547 case 0x730: 1548 case 0x770: 1549 case 0x7b0: 1550 /* fbstp; don't bother */ 1551 if (ea && ex != FPE_FLTRES) 1552 pop(uap); 1553 return; 1554 1555 case 0x738: 1556 case 0x778: 1557 case 0x7b8: 1558 if (!ea) 1559 return; 1560 switch (r.type) { 1561 case fex_int: 1562 *(long long *)ea = (long long) r.val.i; 1563 break; 1564 1565 case fex_llong: 1566 *(long long *)ea = r.val.l; 1567 break; 1568 1569 case fex_float: 1570 *(long long *)ea = (long long) r.val.f; 1571 break; 1572 1573 case fex_double: 1574 *(long long *)ea = (long long) r.val.d; 1575 break; 1576 1577 case fex_ldouble: 1578 *(long long *)ea = (long long) r.val.q; 1579 break; 1580 1581 default: 1582 break; 1583 } 1584 if (ex != FPE_FLTRES) 1585 pop(uap); 1586 return; 1587 } 1588 1589 /* for all other instructions, the result goes into a register */ 1590 switch (r.type) { 1591 case fex_int: 1592 r.val.q = (long double) r.val.i; 1593 break; 1594 1595 case fex_llong: 1596 r.val.q = (long double) r.val.l; 1597 break; 1598 1599 case fex_float: 1600 r.val.q = (long double) r.val.f; 1601 break; 1602 1603 case fex_double: 1604 r.val.q = (long double) r.val.d; 1605 break; 1606 1607 default: 1608 break; 1609 } 1610 1611 /* for load instructions, push the result onto the stack */ 1612 switch (op & 0x7f8) { 1613 case 0x100: 1614 case 0x140: 1615 case 0x180: 1616 case 0x500: 1617 case 0x540: 1618 case 0x580: 1619 if (ea) 1620 push(r.val.q, uap); 1621 return; 1622 } 1623 1624 /* for all other instructions, if the exception is overflow, 1625 underflow, or inexact, the stack has already been updated */ 1626 stack = (ex == FPE_FLTOVF || ex == FPE_FLTUND || ex == FPE_FLTRES); 1627 switch (op & 0x7f8) { |