--- np2/i386c/ia32/ctrlxfer.c 2008/03/22 04:03:07 1.20 +++ np2/i386c/ia32/ctrlxfer.c 2011/12/21 18:07:57 1.23 @@ -1,5 +1,3 @@ -/* $Id: ctrlxfer.c,v 1.20 2008/03/22 04:03:07 monaka Exp $ */ - /* * Copyright (c) 2003 NONAKA Kimihiro * All rights reserved. @@ -112,7 +110,7 @@ JMPfar_pm_code_segment(const selector_t /* check privilege level */ if (!SEG_IS_CONFORMING_CODE(&cs_sel->desc)) { VERBOSE(("JMPfar_pm: NON-CONFORMING-CODE-SEGMENT")); - /* イシエャ p.119 4.8.1.1. */ + /* 荳句キサ p.119 4.8.1.1. */ if (cs_sel->rpl > CPU_STAT_CPL) { VERBOSE(("JMPfar_pm: RPL(%d) > CPL(%d)", cs_sel->rpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel->idx); @@ -123,7 +121,7 @@ JMPfar_pm_code_segment(const selector_t } } else { VERBOSE(("JMPfar_pm: CONFORMING-CODE-SEGMENT")); - /* イシエャ p.120 4.8.1.2. */ + /* 荳句キサ p.120 4.8.1.2. */ if (cs_sel->desc.dpl > CPU_STAT_CPL) { VERBOSE(("JMPfar_pm: DPL(%d) > CPL(%d)", cs_sel->desc.dpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel->idx); @@ -192,7 +190,7 @@ JMPfar_pm_call_gate(const selector_t *ca /* check privilege level */ if (!SEG_IS_CONFORMING_CODE(&cs_sel.desc)) { - /* イシエャ p.119 4.8.1.1. */ + /* 荳句キサ p.119 4.8.1.1. */ if (cs_sel.rpl > CPU_STAT_CPL) { VERBOSE(("JMPfar_pm: RPL(%d) > CPL(%d)", cs_sel.rpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel.idx); @@ -202,7 +200,7 @@ JMPfar_pm_call_gate(const selector_t *ca EXCEPTION(GP_EXCEPTION, cs_sel.idx); } } else { - /* イシエャ p.120 4.8.1.2. */ + /* 荳句キサ p.120 4.8.1.2. */ if (cs_sel.desc.dpl > CPU_STAT_CPL) { VERBOSE(("JMPfar_pm: DPL(%d) > CPL(%d)", cs_sel.desc.dpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel.idx); @@ -282,6 +280,12 @@ JMPfar_pm_task_gate(selector_t *taskgate } task_switch(&tss_sel, TASK_SWITCH_JMP); + + /* out of range */ + if (CPU_EIP > CPU_STAT_CS_LIMIT) { + VERBOSE(("JMPfar_pm: new_ip is out of range. new_ip = %08x, limit = %08x", CPU_EIP, CPU_STAT_CS_LIMIT)); + EXCEPTION(GP_EXCEPTION, 0); + } } /*--- @@ -310,6 +314,12 @@ JMPfar_pm_tss(selector_t *tss_sel) } task_switch(tss_sel, TASK_SWITCH_JMP); + + /* out of range */ + if (CPU_EIP > CPU_STAT_CS_LIMIT) { + VERBOSE(("JMPfar_pm: new_ip is out of range. new_ip = %08x, limit = %08x", CPU_EIP, CPU_STAT_CS_LIMIT)); + EXCEPTION(GP_EXCEPTION, 0); + } } @@ -394,7 +404,7 @@ CALLfar_pm_code_segment(const selector_t /* check privilege level */ if (!SEG_IS_CONFORMING_CODE(&cs_sel->desc)) { VERBOSE(("CALLfar_pm: NON-CONFORMING-CODE-SEGMENT")); - /* イシエャ p.119 4.8.1.1. */ + /* 荳句キサ p.119 4.8.1.1. */ if (cs_sel->rpl > CPU_STAT_CPL) { VERBOSE(("CALLfar_pm: RPL(%d) > CPL(%d)", cs_sel->rpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel->idx); @@ -405,7 +415,7 @@ CALLfar_pm_code_segment(const selector_t } } else { VERBOSE(("CALLfar_pm: CONFORMING-CODE-SEGMENT")); - /* イシエャ p.120 4.8.1.2. */ + /* 荳句キサ p.120 4.8.1.2. */ if (cs_sel->desc.dpl > CPU_STAT_CPL) { VERBOSE(("CALLfar_pm: DPL(%d) > CPL(%d)", cs_sel->desc.dpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, cs_sel->idx); @@ -754,6 +764,12 @@ CALLfar_pm_task_gate(selector_t *taskgat } task_switch(&tss_sel, TASK_SWITCH_CALL); + + /* out of range */ + if (CPU_EIP > CPU_STAT_CS_LIMIT) { + VERBOSE(("JMPfar_pm: new_ip is out of range. new_ip = %08x, limit = %08x", CPU_EIP, CPU_STAT_CS_LIMIT)); + EXCEPTION(GP_EXCEPTION, 0); + } } /*--- @@ -782,6 +798,12 @@ CALLfar_pm_tss(selector_t *tss_sel) } task_switch(tss_sel, TASK_SWITCH_CALL); + + /* out of range */ + if (CPU_EIP > CPU_STAT_CS_LIMIT) { + VERBOSE(("JMPfar_pm: new_ip is out of range. new_ip = %08x, limit = %08x", CPU_EIP, CPU_STAT_CS_LIMIT)); + EXCEPTION(GP_EXCEPTION, 0); + } } @@ -819,7 +841,7 @@ RETfar_pm(UINT nbytes) rv = parse_selector(&cs_sel, new_cs); if (rv < 0) { - VERBOSE(("RETfar_pm: parse_selector (selector = %04x, rv = %d, %s)", cs_sel.selector, rv)); + VERBOSE(("RETfar_pm: parse_selector (selector = %04x, rv = %d)", cs_sel.selector, rv)); EXCEPTION(GP_EXCEPTION, cs_sel.idx); } @@ -1091,6 +1113,12 @@ IRET_pm_nested_task(void) } task_switch(&tss_sel, TASK_SWITCH_IRET); + + /* out of range */ + if (CPU_EIP > CPU_STAT_CS_LIMIT) { + VERBOSE(("JMPfar_pm: new_ip is out of range. new_ip = %08x, limit = %08x", CPU_EIP, CPU_STAT_CS_LIMIT)); + EXCEPTION(GP_EXCEPTION, 0); + } } /*---