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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 Technology}ELSE // (OPCODE = jmpf direct){IF (64BIT_MODE)EXCEPTION [#UD]// ’jmpf direct’ is illegal in 64-bit mode}temp_offset = z-sized offset specified in the instruction,zero-extended to 64 bitstemp_sel = selector specified in the instructiontemp_desc = READ_DESCRIPTOR (temp_sel, cs_chk)// read descriptor, perform protection <strong>and</strong> type checksIF (temp_desc.attr.type = ’available_tss’)TASK_SWITCH // using temp_sel as the target tss selectorELSIF (temp_desc.attr.type = ’taskgate’)TASK_SWITCH // using the tss selector in the task gate as the// target tssELSIF (temp_desc.attr.type = ’code’)// if the selector refers to a code descriptor, then// the offset we read is the target RIP{temp_RIP = temp_offsetCS = temp_descIF ((!64BIT_MODE) && (temp_RIP > CS.limit))// temp_RIP can’t be non-canonical because// it’s a 16- or 32-bit offset, zero-extended to 64 bits{EXCEPTION [#GP(0)]}RIP = temp_RIPEXIT}ELSE{// (temp_desc.attr.type = ’callgate’)// if the selector refers to a call gate, then// the target CS <strong>and</strong> RIP both come from the call gatetemp_RIP = temp_desc.offsetIF (LONG_MODE){// in long mode, we need to read the 2nd half of a 16-byte call-gate// from the gdt/ldt to get the upper 32 bits of the target RIPtemp_upper = READ_MEM.q [temp_sel+8]IF (temp_upper’s extended attribute bits != 0)EXCEPTION [#GP(temp_sel)] // Make sure the extended// attribute bits are all zero.temp_RIP = tempRIP + (temp_upper SHL 32)JMP (Far) 175

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

Saved successfully!

Ooh no, something went wrong!