|
|
| version 1.1, 2003/12/08 00:55:31 | version 1.4, 2004/01/13 16:36:00 |
|---|---|
| Line 38 load_segreg(int idx, WORD selector, int | Line 38 load_segreg(int idx, WORD selector, int |
| selector_t sel; | selector_t sel; |
| int rv; | int rv; |
| __ASSERT((unsigned int)idx < CPU_SEGREG_NUM); | |
| if ((unsigned int)idx >= CPU_SEGREG_NUM) { | |
| ia32_panic("load_segreg: sreg(%d)", idx); | |
| } | |
| if (!CPU_STAT_PM || CPU_STAT_VM86) { | if (!CPU_STAT_PM || CPU_STAT_VM86) { |
| descriptor_t sd; | descriptor_t sd; |
| Line 145 void | Line 142 void |
| load_cs(WORD selector, descriptor_t* sdp, BYTE cpl) | load_cs(WORD selector, descriptor_t* sdp, BYTE cpl) |
| { | { |
| cpu_inst_default.op_32 = cpu_inst_default.as_32 = sdp->d; | CPU_STATSAVE.cpu_inst_default.op_32 |
| = CPU_STATSAVE.cpu_inst_default.as_32 = sdp->d; | |
| CPU_REGS_SREG(CPU_CS_INDEX) = (selector & ~3) | (cpl & 3); | CPU_REGS_SREG(CPU_CS_INDEX) = (selector & ~3) | (cpl & 3); |
| CPU_STAT_SREG(CPU_CS_INDEX) = *sdp; | CPU_STAT_SREG(CPU_CS_INDEX) = *sdp; |
| CPU_STAT_CPL = cpl & 3; | CPU_STAT_CPL = cpl & 3; |
| Line 172 load_ldtr(WORD selector, int exc) | Line 170 load_ldtr(WORD selector, int exc) |
| } | } |
| /* check descriptor type */ | /* check descriptor type */ |
| if (!sel.desc.s || (sel.desc.type != CPU_SYSDESC_TYPE_LDT)) { | if (sel.desc.s || (sel.desc.type != CPU_SYSDESC_TYPE_LDT)) { |
| EXCEPTION(exc, sel.selector); | EXCEPTION(exc, sel.selector); |
| } | } |
| /* check limit */ | /* check limit */ |
| if (sel.desc.u.seg.limit < 7) { | if (sel.desc.u.seg.limit < 7) { |
| ia32_panic("load_ldtr: LDTR descriptor limit < 7"); | ia32_panic("load_ldtr: LDTR descriptor limit < 7 (limit = %d)", sel.desc.u.seg.limit); |
| } | } |
| /* not present */ | /* not present */ |
| Line 234 load_descriptor(descriptor_t *descp, DWO | Line 232 load_descriptor(descriptor_t *descp, DWO |
| switch (descp->type) { | switch (descp->type) { |
| case CPU_SYSDESC_TYPE_LDT: /* LDT */ | case CPU_SYSDESC_TYPE_LDT: /* LDT */ |
| descp->valid = 1; | descp->valid = 1; |
| descp->u.seg.segbase = descp->h & 0xff000000; | |
| descp->u.seg.segbase |= (descp->h & 0xff) << 16; | |
| descp->u.seg.segbase |= descp->l >> 16; | |
| descp->u.seg.limit = descp->h & 0xf0000; | |
| descp->u.seg.limit |= descp->l & 0xffff; | |
| VERBOSE(("load_descriptor: LDT descriptor")); | VERBOSE(("load_descriptor: LDT descriptor")); |
| break; | break; |