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.

24594 Rev. 3.10 February 2005 AMD64 Technology// CS,DS,ES,FS,GS check for segment limit or canonicalIF ((!64BIT_MODE) && (offset is outside seg’s limit))EXCEPTION [#GP(0)]// #GP fault for segment limit violation in non-64-bit modeIF ((64BIT_MODE) && (offset is non-canonical))EXCEPTION [#GP(0)]// #GP fault for non-canonical address in 64-bit modeELSIF (seg=SS) // SS checks for segment limit or canonicalIF ((!64BIT_MODE) && (offset is outside seg’s limit))EXCEPTION [#SS(0)]// stack fault for segment limit violation in non-64-bit modeIF ((64BIT_MODE) && (offset is non-canonical))EXCEPTION [#SS(0)]// stack fault for non-canonical address in 64-bit modeELSE // ((seg=GDT) || (seg=LDT) || (seg=IDT) || (seg=TSS))// GDT,LDT,IDT,TSS check for segment limit <strong>and</strong> canonicalIF (offset > seg.limit)EXCEPTION [#GP(0)] // #GP fault for segment limit violation// in all modesIF ((LONG_MODE) && (offset is non-canonical))EXCEPTION [#GP(0)] // #GP fault for non-canonical address in long modeIF ((ALIGNMENT_CHECK_ENABLED) && (offset misaligned, considering itssize <strong>and</strong> alignment))EXCEPTION [#AC(0)]IF ((64_bit_mode) && ((seg=CS) || (seg=DS) || (seg=ES) || (seg=SS))temp_linear = offsetELSEtemp_linear = seg.base + offsetIF ((PAGING_ENABLED) && (virtual-to-physical translation for temp_linearresults in a page-protection violation))EXCEPTION [#PF(error_code)] // page fault for page-protection violation// (U/S violation, Reserved bit violation)IF ((PAGING_ENABLED) && (temp_linear is on a not-present page))EXCEPTION [#PF(error_code)] // page fault for not-present pagetemp_data = memory [temp_linear].x // zero-extends the data to 64// bits, <strong>and</strong> saves it in temp_dataRETURN (temp_data)// return the zero-extended data/////////////////////////////////////////////////////////////////////////////////// WRITE_MEM // <strong>General</strong> memory write/////////////////////////////////////////////////////////////////////////////////usage:WRITE_MEM.x [seg:offset] = temp.x// where is one of these:Chapter 2: Instruction Overview 53

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

Saved successfully!

Ooh no, something went wrong!