--- np2/i386c/ia32/segments.c 2011/12/23 04:17:47 1.21 +++ np2/i386c/ia32/segments.c 2012/02/05 02:22:49 1.25 @@ -28,7 +28,7 @@ #include "ia32.mcr" -void +void CPUCALL load_segreg(int idx, UINT16 selector, UINT16 *sregp, descriptor_t *sdp, int exc) { selector_t sel; @@ -42,7 +42,6 @@ load_segreg(int idx, UINT16 selector, UI /* real-mode or vm86 mode */ *sregp = selector; segdesc_clear(&sel.desc); - sel.desc.u.seg.limit = CPU_STAT_SREGLIMIT(idx); segdesc_set_default(idx, selector, &sel.desc); *sdp = sel.desc; return; @@ -122,7 +121,7 @@ load_segreg(int idx, UINT16 selector, UI /* * load SS register */ -void +void CPUCALL load_ss(UINT16 selector, const descriptor_t *sdp, int cpl) { @@ -134,7 +133,7 @@ load_ss(UINT16 selector, const descripto /* * load CS register */ -void +void CPUCALL load_cs(UINT16 selector, const descriptor_t *sdp, int new_cpl) { int cpl = new_cpl & 3; @@ -150,7 +149,7 @@ load_cs(UINT16 selector, const descripto /* * load LDT register */ -void +void CPUCALL load_ldtr(UINT16 selector, int exc) { selector_t sel; @@ -162,6 +161,7 @@ load_ldtr(UINT16 selector, int exc) if (rv < 0 || sel.ldt) { if (rv == -2) { /* null segment */ + VERBOSE(("load_ldtr: null segment")); CPU_LDTR = 0; memset(&CPU_LDTR_DESC, 0, sizeof(CPU_LDTR_DESC)); return; @@ -189,7 +189,7 @@ load_ldtr(UINT16 selector, int exc) CPU_LDTR_DESC = sel.desc; } -void +void CPUCALL load_descriptor(descriptor_t *sdp, UINT32 addr) { UINT32 l, h; @@ -303,7 +303,7 @@ load_descriptor(descriptor_t *sdp, UINT3 #endif } -int +int CPUCALL parse_selector(selector_t *ssp, UINT16 selector) { UINT32 base; @@ -352,7 +352,7 @@ parse_selector(selector_t *ssp, UINT16 s return 0; } -int +int CPUCALL selector_is_not_present(const selector_t *ssp) { UINT32 h; @@ -375,7 +375,7 @@ selector_is_not_present(const selector_t return 0; } -void +void CPUCALL segdesc_init(int idx, UINT16 sreg, descriptor_t *sdp) { @@ -384,11 +384,10 @@ segdesc_init(int idx, UINT16 sreg, descr CPU_REGS_SREG(idx) = sreg; segdesc_clear(sdp); - sdp->u.seg.limit = 0xffff; segdesc_set_default(idx, sreg, sdp); } -void +void CPUCALL segdesc_set_default(int idx, UINT16 selector, descriptor_t *sdp) { @@ -396,7 +395,7 @@ segdesc_set_default(int idx, UINT16 sele __ASSERT((sdp != NULL)); sdp->u.seg.segbase = (UINT32)selector << 4; - /* sdp->u.seg.limit */ + sdp->u.seg.limit = 0xffff; sdp->u.seg.c = (idx == CPU_CS_INDEX) ? 1 : 0; /* code or data */ sdp->u.seg.g = 0; /* non 4k factor scale */ sdp->u.seg.wr = 1; /* execute/read(CS) or read/write(others) */