13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

AMD64 Technology 24594 Rev. 3.10 February 2005CS.sel = temp_CSCS.base = temp_CS SHL 4}RFLAGS.TF,RF clearedRIP = temp_RIP // RFLAGS.IF cleared if IOPL = 3// RFLAGS.VIF cleared if IOPL < 3EXITINT_N_VIRTUAL_TO_PROTECTED:temp_idt_desc = READ_IDT (temp_int_n_vector)IF (temp_idt_desc.attr.type = ’taskgate’)TASK_SWITCH // using tss selector in the task gate as the target tssIF ((temp_idt_desc.attr.type = ’intgate32’)|| (temp_idt_desc.attr.type = ’trapgate32’))// the size of the gate controls the size of the stack pushesV=4-byte // legacy mode, using a 32-bit gateELSE // gate is intgate16 or trapgate16V=2-byte// legacy mode, using a 16-bit gatetemp_RIP = temp_idt_desc.offsetCS = READ_DESCRIPTOR (temp_idt_desc.segment, intcs_chk)IF (CS.attr.dpl!=0) // H<strong>and</strong>ler must run at CPL 0.EXCEPTION [#GP(CS.sel)]CPL = 0temp_ist = 0// Legacy mode doesn’t use ist pointerstemp_SS_desc:temp_RSP = READ_INNER_LEVEL_STACK_POINTER (CPL, temp_ist)RSP.q = temp_RSPSS = temp_SS_descPUSH.v old_GS // #SS on the following pushes use SS.sel as error code.PUSH.v old_FSPUSH.v old_DSPUSH.v old_ESPUSH.v old_SSPUSH.v old_RSPPUSH.v old_RFLAGS // Pushed with RF clear.PUSH.v old_CSPUSH.v next_RIPIF (temp_RIP > CS.limit)EXCEPTION [#GP(0)]DS = NULL// can’t use virtual-mode selectors in protected mode160 INT

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!