trunk/src/emu/cpu/i386/i386.c
r241533 | r241534 | |
125 | 125 | UINT32 base, limit; |
126 | 126 | int entry; |
127 | 127 | |
| 128 | if(!seg->selector) |
| 129 | { |
| 130 | seg->flags = 0; |
| 131 | seg->base = 0; |
| 132 | seg->limit = 0; |
| 133 | seg->d = 0; |
| 134 | seg->valid = false; |
| 135 | return 0; |
| 136 | } |
| 137 | |
128 | 138 | if ( seg->selector & 0x4 ) |
129 | 139 | { |
130 | 140 | base = m_ldtr.base; |
r241533 | r241534 | |
147 | 157 | if (seg->flags & 0x8000) |
148 | 158 | seg->limit = (seg->limit << 12) | 0xfff; |
149 | 159 | seg->d = (seg->flags & 0x4000) ? 1 : 0; |
150 | | seg->valid = (seg->selector & ~3)?(true):(false); |
| 160 | seg->valid = true; |
151 | 161 | |
152 | 162 | if(desc) |
153 | 163 | *desc = ((UINT64)v2<<32)|v1; |
r241533 | r241534 | |
212 | 222 | if (!V8086_MODE) |
213 | 223 | { |
214 | 224 | i386_load_protected_mode_segment(&m_sreg[segment], NULL ); |
215 | | i386_set_descriptor_accessed(m_sreg[segment].selector); |
| 225 | if(m_sreg[segment].selector) |
| 226 | i386_set_descriptor_accessed(m_sreg[segment].selector); |
216 | 227 | } |
217 | 228 | else |
218 | 229 | { |
r241533 | r241534 | |
3132 | 3143 | save_item(NAME(m_sreg[ES].base)); |
3133 | 3144 | save_item(NAME(m_sreg[ES].limit)); |
3134 | 3145 | save_item(NAME(m_sreg[ES].flags)); |
| 3146 | save_item(NAME(m_sreg[ES].d)); |
3135 | 3147 | save_item(NAME(m_sreg[CS].selector)); |
3136 | 3148 | save_item(NAME(m_sreg[CS].base)); |
3137 | 3149 | save_item(NAME(m_sreg[CS].limit)); |
3138 | 3150 | save_item(NAME(m_sreg[CS].flags)); |
| 3151 | save_item(NAME(m_sreg[CS].d)); |
3139 | 3152 | save_item(NAME(m_sreg[SS].selector)); |
3140 | 3153 | save_item(NAME(m_sreg[SS].base)); |
3141 | 3154 | save_item(NAME(m_sreg[SS].limit)); |
3142 | 3155 | save_item(NAME(m_sreg[SS].flags)); |
| 3156 | save_item(NAME(m_sreg[SS].d)); |
3143 | 3157 | save_item(NAME(m_sreg[DS].selector)); |
3144 | 3158 | save_item(NAME(m_sreg[DS].base)); |
3145 | 3159 | save_item(NAME(m_sreg[DS].limit)); |
3146 | 3160 | save_item(NAME(m_sreg[DS].flags)); |
| 3161 | save_item(NAME(m_sreg[DS].d)); |
3147 | 3162 | save_item(NAME(m_sreg[FS].selector)); |
3148 | 3163 | save_item(NAME(m_sreg[FS].base)); |
3149 | 3164 | save_item(NAME(m_sreg[FS].limit)); |
3150 | 3165 | save_item(NAME(m_sreg[FS].flags)); |
| 3166 | save_item(NAME(m_sreg[FS].d)); |
3151 | 3167 | save_item(NAME(m_sreg[GS].selector)); |
3152 | 3168 | save_item(NAME(m_sreg[GS].base)); |
3153 | 3169 | save_item(NAME(m_sreg[GS].limit)); |
3154 | 3170 | save_item(NAME(m_sreg[GS].flags)); |
| 3171 | save_item(NAME(m_sreg[GS].d)); |
3155 | 3172 | save_item(NAME(m_eip)); |
3156 | 3173 | save_item(NAME(m_prev_eip)); |
3157 | 3174 | save_item(NAME(m_CF)); |
trunk/src/emu/cpu/i386/i386op16.inc
r241533 | r241534 | |
1746 | 1746 | |
1747 | 1747 | void i386_device::i386_push_ax() // Opcode 0x50 |
1748 | 1748 | { |
1749 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1750 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1749 | UINT32 offset; |
| 1750 | if(STACK_32BIT) |
| 1751 | offset = REG32(ESP) - 2; |
| 1752 | else |
| 1753 | offset = (REG16(SP) - 2) & 0xffff; |
| 1754 | if(i386_limit_check(SS,offset) == 0) |
1751 | 1755 | PUSH16(REG16(AX) ); |
1752 | 1756 | else |
1753 | 1757 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1756 | 1760 | |
1757 | 1761 | void i386_device::i386_push_cx() // Opcode 0x51 |
1758 | 1762 | { |
1759 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1760 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1763 | UINT32 offset; |
| 1764 | if(STACK_32BIT) |
| 1765 | offset = REG32(ESP) - 2; |
| 1766 | else |
| 1767 | offset = (REG16(SP) - 2) & 0xffff; |
| 1768 | if(i386_limit_check(SS,offset) == 0) |
1761 | 1769 | PUSH16(REG16(CX) ); |
1762 | 1770 | else |
1763 | 1771 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1766 | 1774 | |
1767 | 1775 | void i386_device::i386_push_dx() // Opcode 0x52 |
1768 | 1776 | { |
1769 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1770 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1777 | UINT32 offset; |
| 1778 | if(STACK_32BIT) |
| 1779 | offset = REG32(ESP) - 2; |
| 1780 | else |
| 1781 | offset = (REG16(SP) - 2) & 0xffff; |
| 1782 | if(i386_limit_check(SS,offset) == 0) |
1771 | 1783 | PUSH16(REG16(DX) ); |
1772 | 1784 | else |
1773 | 1785 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1776 | 1788 | |
1777 | 1789 | void i386_device::i386_push_bx() // Opcode 0x53 |
1778 | 1790 | { |
1779 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1780 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1791 | UINT32 offset; |
| 1792 | if(STACK_32BIT) |
| 1793 | offset = REG32(ESP) - 2; |
| 1794 | else |
| 1795 | offset = (REG16(SP) - 2) & 0xffff; |
| 1796 | if(i386_limit_check(SS,offset) == 0) |
1781 | 1797 | PUSH16(REG16(BX) ); |
1782 | 1798 | else |
1783 | 1799 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1786 | 1802 | |
1787 | 1803 | void i386_device::i386_push_sp() // Opcode 0x54 |
1788 | 1804 | { |
1789 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1790 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1805 | UINT32 offset; |
| 1806 | if(STACK_32BIT) |
| 1807 | offset = REG32(ESP) - 2; |
| 1808 | else |
| 1809 | offset = (REG16(SP) - 2) & 0xffff; |
| 1810 | if(i386_limit_check(SS,offset) == 0) |
1791 | 1811 | PUSH16(REG16(SP) ); |
1792 | 1812 | else |
1793 | 1813 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1796 | 1816 | |
1797 | 1817 | void i386_device::i386_push_bp() // Opcode 0x55 |
1798 | 1818 | { |
1799 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1800 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1819 | UINT32 offset; |
| 1820 | if(STACK_32BIT) |
| 1821 | offset = REG32(ESP) - 2; |
| 1822 | else |
| 1823 | offset = (REG16(SP) - 2) & 0xffff; |
| 1824 | if(i386_limit_check(SS,offset) == 0) |
1801 | 1825 | PUSH16(REG16(BP) ); |
1802 | 1826 | else |
1803 | 1827 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1806 | 1830 | |
1807 | 1831 | void i386_device::i386_push_si() // Opcode 0x56 |
1808 | 1832 | { |
1809 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1810 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1833 | UINT32 offset; |
| 1834 | if(STACK_32BIT) |
| 1835 | offset = REG32(ESP) - 2; |
| 1836 | else |
| 1837 | offset = (REG16(SP) - 2) & 0xffff; |
| 1838 | if(i386_limit_check(SS,offset) == 0) |
1811 | 1839 | PUSH16(REG16(SI) ); |
1812 | 1840 | else |
1813 | 1841 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1816 | 1844 | |
1817 | 1845 | void i386_device::i386_push_di() // Opcode 0x57 |
1818 | 1846 | { |
1819 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1820 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1847 | UINT32 offset; |
| 1848 | if(STACK_32BIT) |
| 1849 | offset = REG32(ESP) - 2; |
| 1850 | else |
| 1851 | offset = (REG16(SP) - 2) & 0xffff; |
| 1852 | if(i386_limit_check(SS,offset) == 0) |
1821 | 1853 | PUSH16(REG16(DI) ); |
1822 | 1854 | else |
1823 | 1855 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1826 | 1858 | |
1827 | 1859 | void i386_device::i386_push_cs16() // Opcode 0x0e |
1828 | 1860 | { |
1829 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1830 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1861 | UINT32 offset; |
| 1862 | if(STACK_32BIT) |
| 1863 | offset = REG32(ESP) - 2; |
| 1864 | else |
| 1865 | offset = (REG16(SP) - 2) & 0xffff; |
| 1866 | if(i386_limit_check(SS,offset) == 0) |
1831 | 1867 | PUSH16(m_sreg[CS].selector ); |
1832 | 1868 | else |
1833 | 1869 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1836 | 1872 | |
1837 | 1873 | void i386_device::i386_push_ds16() // Opcode 0x1e |
1838 | 1874 | { |
1839 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1840 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1875 | UINT32 offset; |
| 1876 | if(STACK_32BIT) |
| 1877 | offset = REG32(ESP) - 2; |
| 1878 | else |
| 1879 | offset = (REG16(SP) - 2) & 0xffff; |
| 1880 | if(i386_limit_check(SS,offset) == 0) |
1841 | 1881 | PUSH16(m_sreg[DS].selector ); |
1842 | 1882 | else |
1843 | 1883 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1846 | 1886 | |
1847 | 1887 | void i386_device::i386_push_es16() // Opcode 0x06 |
1848 | 1888 | { |
1849 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1850 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1889 | UINT32 offset; |
| 1890 | if(STACK_32BIT) |
| 1891 | offset = REG32(ESP) - 2; |
| 1892 | else |
| 1893 | offset = (REG16(SP) - 2) & 0xffff; |
| 1894 | if(i386_limit_check(SS,offset) == 0) |
1851 | 1895 | PUSH16(m_sreg[ES].selector ); |
1852 | 1896 | else |
1853 | 1897 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1856 | 1900 | |
1857 | 1901 | void i386_device::i386_push_fs16() // Opcode 0x0f a0 |
1858 | 1902 | { |
1859 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1860 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1903 | UINT32 offset; |
| 1904 | if(STACK_32BIT) |
| 1905 | offset = REG32(ESP) - 2; |
| 1906 | else |
| 1907 | offset = (REG16(SP) - 2) & 0xffff; |
| 1908 | if(i386_limit_check(SS,offset) == 0) |
1861 | 1909 | PUSH16(m_sreg[FS].selector ); |
1862 | 1910 | else |
1863 | 1911 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1866 | 1914 | |
1867 | 1915 | void i386_device::i386_push_gs16() // Opcode 0x0f a8 |
1868 | 1916 | { |
1869 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1870 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1917 | UINT32 offset; |
| 1918 | if(STACK_32BIT) |
| 1919 | offset = REG32(ESP) - 2; |
| 1920 | else |
| 1921 | offset = (REG16(SP) - 2) & 0xffff; |
| 1922 | if(i386_limit_check(SS,offset) == 0) |
1871 | 1923 | PUSH16(m_sreg[GS].selector ); |
1872 | 1924 | else |
1873 | 1925 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1876 | 1928 | |
1877 | 1929 | void i386_device::i386_push_ss16() // Opcode 0x16 |
1878 | 1930 | { |
1879 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1880 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1931 | UINT32 offset; |
| 1932 | if(STACK_32BIT) |
| 1933 | offset = REG32(ESP) - 2; |
| 1934 | else |
| 1935 | offset = (REG16(SP) - 2) & 0xffff; |
| 1936 | if(i386_limit_check(SS,offset) == 0) |
1881 | 1937 | PUSH16(m_sreg[SS].selector ); |
1882 | 1938 | else |
1883 | 1939 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1887 | 1943 | void i386_device::i386_push_i16() // Opcode 0x68 |
1888 | 1944 | { |
1889 | 1945 | UINT16 value = FETCH16(); |
1890 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1891 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1946 | UINT32 offset; |
| 1947 | if(STACK_32BIT) |
| 1948 | offset = REG32(ESP) - 2; |
| 1949 | else |
| 1950 | offset = (REG16(SP) - 2) & 0xffff; |
| 1951 | if(i386_limit_check(SS,offset) == 0) |
1892 | 1952 | PUSH16(value); |
1893 | 1953 | else |
1894 | 1954 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1898 | 1958 | void i386_device::i386_pusha() // Opcode 0x60 |
1899 | 1959 | { |
1900 | 1960 | UINT16 temp = REG16(SP); |
1901 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1902 | | if(i386_limit_check(SS,offset-16) == 0) |
| 1961 | UINT32 offset; |
| 1962 | if(STACK_32BIT) |
| 1963 | offset = REG32(ESP) - 16; |
| 1964 | else |
| 1965 | offset = (REG16(SP) - 16) & 0xffff; |
| 1966 | if(i386_limit_check(SS,offset) == 0) |
1903 | 1967 | { |
1904 | 1968 | PUSH16(REG16(AX) ); |
1905 | 1969 | PUSH16(REG16(CX) ); |
r241533 | r241534 | |
1917 | 1981 | |
1918 | 1982 | void i386_device::i386_pushf() // Opcode 0x9c |
1919 | 1983 | { |
1920 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1921 | | if(i386_limit_check(SS,offset-2) == 0) |
| 1984 | UINT32 offset; |
| 1985 | if(STACK_32BIT) |
| 1986 | offset = REG32(ESP) - 2; |
| 1987 | else |
| 1988 | offset = (REG16(SP) - 2) & 0xffff; |
| 1989 | if(i386_limit_check(SS,offset) == 0) |
1922 | 1990 | PUSH16(get_flags() & 0xffff ); |
1923 | 1991 | else |
1924 | 1992 | FAULT(FAULT_SS,0) |
trunk/src/emu/cpu/i386/i386op32.inc
r241533 | r241534 | |
1599 | 1599 | |
1600 | 1600 | void i386_device::i386_push_eax() // Opcode 0x50 |
1601 | 1601 | { |
1602 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1603 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1602 | UINT32 offset; |
| 1603 | if(STACK_32BIT) |
| 1604 | offset = REG32(ESP) - 4; |
| 1605 | else |
| 1606 | offset = (REG16(SP) - 4) & 0xffff; |
| 1607 | if(i386_limit_check(SS,offset) == 0) |
1604 | 1608 | PUSH32(REG32(EAX) ); |
1605 | 1609 | else |
1606 | 1610 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1609 | 1613 | |
1610 | 1614 | void i386_device::i386_push_ecx() // Opcode 0x51 |
1611 | 1615 | { |
1612 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1613 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1616 | UINT32 offset; |
| 1617 | if(STACK_32BIT) |
| 1618 | offset = REG32(ESP) - 4; |
| 1619 | else |
| 1620 | offset = (REG16(SP) - 4) & 0xffff; |
| 1621 | if(i386_limit_check(SS,offset) == 0) |
1614 | 1622 | PUSH32(REG32(ECX) ); |
1615 | 1623 | else |
1616 | 1624 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1619 | 1627 | |
1620 | 1628 | void i386_device::i386_push_edx() // Opcode 0x52 |
1621 | 1629 | { |
1622 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1623 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1630 | UINT32 offset; |
| 1631 | if(STACK_32BIT) |
| 1632 | offset = REG32(ESP) - 4; |
| 1633 | else |
| 1634 | offset = (REG16(SP) - 4) & 0xffff; |
| 1635 | if(i386_limit_check(SS,offset) == 0) |
1624 | 1636 | PUSH32(REG32(EDX) ); |
1625 | 1637 | else |
1626 | 1638 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1629 | 1641 | |
1630 | 1642 | void i386_device::i386_push_ebx() // Opcode 0x53 |
1631 | 1643 | { |
1632 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1633 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1644 | UINT32 offset; |
| 1645 | if(STACK_32BIT) |
| 1646 | offset = REG32(ESP) - 4; |
| 1647 | else |
| 1648 | offset = (REG16(SP) - 4) & 0xffff; |
| 1649 | if(i386_limit_check(SS,offset) == 0) |
1634 | 1650 | PUSH32(REG32(EBX) ); |
1635 | 1651 | else |
1636 | 1652 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1639 | 1655 | |
1640 | 1656 | void i386_device::i386_push_esp() // Opcode 0x54 |
1641 | 1657 | { |
1642 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1643 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1658 | UINT32 offset; |
| 1659 | if(STACK_32BIT) |
| 1660 | offset = REG32(ESP) - 4; |
| 1661 | else |
| 1662 | offset = (REG16(SP) - 4) & 0xffff; |
| 1663 | if(i386_limit_check(SS,offset) == 0) |
1644 | 1664 | PUSH32(REG32(ESP) ); |
1645 | 1665 | else |
1646 | 1666 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1649 | 1669 | |
1650 | 1670 | void i386_device::i386_push_ebp() // Opcode 0x55 |
1651 | 1671 | { |
1652 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1653 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1672 | UINT32 offset; |
| 1673 | if(STACK_32BIT) |
| 1674 | offset = REG32(ESP) - 4; |
| 1675 | else |
| 1676 | offset = (REG16(SP) - 4) & 0xffff; |
| 1677 | if(i386_limit_check(SS,offset) == 0) |
1654 | 1678 | PUSH32(REG32(EBP) ); |
1655 | 1679 | else |
1656 | 1680 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1659 | 1683 | |
1660 | 1684 | void i386_device::i386_push_esi() // Opcode 0x56 |
1661 | 1685 | { |
1662 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1663 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1686 | UINT32 offset; |
| 1687 | if(STACK_32BIT) |
| 1688 | offset = REG32(ESP) - 4; |
| 1689 | else |
| 1690 | offset = (REG16(SP) - 4) & 0xffff; |
| 1691 | if(i386_limit_check(SS,offset) == 0) |
1664 | 1692 | PUSH32(REG32(ESI) ); |
1665 | 1693 | else |
1666 | 1694 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1669 | 1697 | |
1670 | 1698 | void i386_device::i386_push_edi() // Opcode 0x57 |
1671 | 1699 | { |
1672 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1673 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1700 | UINT32 offset; |
| 1701 | if(STACK_32BIT) |
| 1702 | offset = REG32(ESP) - 4; |
| 1703 | else |
| 1704 | offset = (REG16(SP) - 4) & 0xffff; |
| 1705 | if(i386_limit_check(SS,offset) == 0) |
1674 | 1706 | PUSH32(REG32(EDI) ); |
1675 | 1707 | else |
1676 | 1708 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1679 | 1711 | |
1680 | 1712 | void i386_device::i386_push_cs32() // Opcode 0x0e |
1681 | 1713 | { |
1682 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1683 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1714 | UINT32 offset; |
| 1715 | if(STACK_32BIT) |
| 1716 | offset = REG32(ESP) - 4; |
| 1717 | else |
| 1718 | offset = (REG16(SP) - 4) & 0xffff; |
| 1719 | if(i386_limit_check(SS,offset) == 0) |
1684 | 1720 | PUSH32(m_sreg[CS].selector ); |
1685 | 1721 | else |
1686 | 1722 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1689 | 1725 | |
1690 | 1726 | void i386_device::i386_push_ds32() // Opcode 0x1e |
1691 | 1727 | { |
1692 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1693 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1728 | UINT32 offset; |
| 1729 | if(STACK_32BIT) |
| 1730 | offset = REG32(ESP) - 4; |
| 1731 | else |
| 1732 | offset = (REG16(SP) - 4) & 0xffff; |
| 1733 | if(i386_limit_check(SS,offset) == 0) |
1694 | 1734 | PUSH32(m_sreg[DS].selector ); |
1695 | 1735 | else |
1696 | 1736 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1699 | 1739 | |
1700 | 1740 | void i386_device::i386_push_es32() // Opcode 0x06 |
1701 | 1741 | { |
1702 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1703 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1742 | UINT32 offset; |
| 1743 | if(STACK_32BIT) |
| 1744 | offset = REG32(ESP) - 4; |
| 1745 | else |
| 1746 | offset = (REG16(SP) - 4) & 0xffff; |
| 1747 | if(i386_limit_check(SS,offset) == 0) |
1704 | 1748 | PUSH32(m_sreg[ES].selector ); |
1705 | 1749 | else |
1706 | 1750 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1709 | 1753 | |
1710 | 1754 | void i386_device::i386_push_fs32() // Opcode 0x0f a0 |
1711 | 1755 | { |
1712 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1713 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1756 | UINT32 offset; |
| 1757 | if(STACK_32BIT) |
| 1758 | offset = REG32(ESP) - 4; |
| 1759 | else |
| 1760 | offset = (REG16(SP) - 4) & 0xffff; |
| 1761 | if(i386_limit_check(SS,offset) == 0) |
1714 | 1762 | PUSH32(m_sreg[FS].selector ); |
1715 | 1763 | else |
1716 | 1764 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1719 | 1767 | |
1720 | 1768 | void i386_device::i386_push_gs32() // Opcode 0x0f a8 |
1721 | 1769 | { |
1722 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1723 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1770 | UINT32 offset; |
| 1771 | if(STACK_32BIT) |
| 1772 | offset = REG32(ESP) - 4; |
| 1773 | else |
| 1774 | offset = (REG16(SP) - 4) & 0xffff; |
| 1775 | if(i386_limit_check(SS,offset) == 0) |
1724 | 1776 | PUSH32(m_sreg[GS].selector ); |
1725 | 1777 | else |
1726 | 1778 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1729 | 1781 | |
1730 | 1782 | void i386_device::i386_push_ss32() // Opcode 0x16 |
1731 | 1783 | { |
1732 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1733 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1784 | UINT32 offset; |
| 1785 | if(STACK_32BIT) |
| 1786 | offset = REG32(ESP) - 4; |
| 1787 | else |
| 1788 | offset = (REG16(SP) - 4) & 0xffff; |
| 1789 | if(i386_limit_check(SS,offset) == 0) |
1734 | 1790 | PUSH32(m_sreg[SS].selector ); |
1735 | 1791 | else |
1736 | 1792 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1740 | 1796 | void i386_device::i386_push_i32() // Opcode 0x68 |
1741 | 1797 | { |
1742 | 1798 | UINT32 value = FETCH32(); |
1743 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1744 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1799 | UINT32 offset; |
| 1800 | if(STACK_32BIT) |
| 1801 | offset = REG32(ESP) - 4; |
| 1802 | else |
| 1803 | offset = (REG16(SP) - 4) & 0xffff; |
| 1804 | if(i386_limit_check(SS,offset) == 0) |
1745 | 1805 | PUSH32(value); |
1746 | 1806 | else |
1747 | 1807 | FAULT(FAULT_SS,0) |
r241533 | r241534 | |
1751 | 1811 | void i386_device::i386_pushad() // Opcode 0x60 |
1752 | 1812 | { |
1753 | 1813 | UINT32 temp = REG32(ESP); |
1754 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1755 | | if(i386_limit_check(SS,offset-32) == 0) |
| 1814 | UINT32 offset; |
| 1815 | if(STACK_32BIT) |
| 1816 | offset = REG32(ESP) - 32; |
| 1817 | else |
| 1818 | offset = (REG16(SP) - 32) & 0xffff; |
| 1819 | if(i386_limit_check(SS,offset) == 0) |
1756 | 1820 | { |
1757 | 1821 | PUSH32(REG32(EAX) ); |
1758 | 1822 | PUSH32(REG32(ECX) ); |
r241533 | r241534 | |
1772 | 1836 | { |
1773 | 1837 | if(!m_IOP1 && !m_IOP2 && V8086_MODE) |
1774 | 1838 | FAULT(FAULT_GP,0) |
1775 | | UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP)); |
1776 | | if(i386_limit_check(SS,offset-4) == 0) |
| 1839 | UINT32 offset; |
| 1840 | if(STACK_32BIT) |
| 1841 | offset = REG32(ESP) - 4; |
| 1842 | else |
| 1843 | offset = (REG16(SP) - 4) & 0xffff; |
| 1844 | if(i386_limit_check(SS,offset) == 0) |
1777 | 1845 | PUSH32(get_flags() & 0x00fcffff ); |
1778 | 1846 | else |
1779 | 1847 | FAULT(FAULT_SS,0) |