Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
AMD64 Technology 24594 Rev. 3.10 February 2005ExceptionGeneral protection,#GPGeneral protection,#GP(selector)RealVirtual8086 Protected Cause of ExceptionX X X The target offset exceeded the code segment limit or was non-canonical.XXThe return code selector was a null selector.The return stack selector was a null selector and the return mode wasnon-64-bit mode or CPL was 3.XXXXXXXXThe return code or stack descriptor exceeded the descriptor tablelimit.The return code or stack selector’s TI bit was set but the LDT selectorwas a null selector.The segment descriptor for the return code was not a code segment.The RPL of the return code segment selector was less than the CPL.The return code segment was non-conforming and the segmentselector’s DPL was not equal to the RPL of the code segment’s segmentselector.The return code segment was conforming and the segment selector’sDPL was greater than the RPL of the code segment’s segment selectorThe segment descriptor for the return stack was not a writable datasegment.The stack segment descriptor DPL was not equal to the RPL of thereturn code segment selector.X The stack segment selector RPL was not equal to the RPL of the returncode segment selector.Page fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned-memory reference was performed while alignmentchecking was enabled.250 RET (Far)
24594 Rev. 3.10 February 2005 AMD64 TechnologyROLRotate LeftRotates the bits of a register or memory location (first operand) to the left (toward themore significant bit positions) by the number of bit positions in an unsignedimmediate value or the CL register (second operand). The bits rotated out left arerotated back in at the right end (lsb) of the first operand location.The processor masks the upper three bits of the count operand, thus restricting thecount to a number between 0 and 31. When the destination is 64 bits wide, it masksthe upper two bits of the count, providing a count in the range of 0 to 63.After completing the rotation, the instruction sets the CF flag to the last bit rotatedout (the lsb of the result). For 1-bit rotates, the instruction sets the OF flag to theexclusive OR of the CF bit (after the rotate) and the most significant bit of the result.When the rotate count is greater than 1, the OF flag is undefined. When the rotatecount is 0, no flags are affected.Mnemonic Opcode DescriptionROL reg/mem8, 1 D0 /0 Rotate an 8-bit register or memory operand left 1 bit.ROL reg/mem8, CL D2 /0ROL reg/mem8, imm8C0 /0 ibRotate an 8-bit register or memory operand left the number ofbits specified in the CL register.Rotate an 8-bit register or memory operand left the number ofbits specified by an 8-bit immediate value.ROL reg/mem16, 1 D1 /0 Rotate a 16-bit register or memory operand left 1 bit.ROL reg/mem16, CL D3 /0ROL reg/mem16, imm8C1 /0 ibRotate a 16-bit register or memory operand left the number ofbits specified in the CL register.Rotate a 16-bit register or memory operand left the number ofbits specified by an 8-bit immediate value.ROL reg/mem32, 1 D1 /0 Rotate a 32-bit register or memory operand left 1 bit.ROL reg/mem32, CL D3 /0ROL reg/mem32, imm8C1 /0 ibRotate a 32-bit register or memory operand left the number ofbits specified in the CL register.Rotate a 32-bit register or memory operand left the number ofbits specified by an 8-bit immediate value.ROL reg/mem64, 1 D1 /0 Rotate a 64-bit register or memory operand left 1 bit.ROL 251
- Page 230 and 231: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 232 and 233: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 234 and 235: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 236 and 237: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 238 and 239: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 240 and 241: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 242 and 243: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 244 and 245: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 246 and 247: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 248 and 249: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 250 and 251: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 252 and 253: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 254 and 255: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 256 and 257: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 258 and 259: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 260 and 261: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 262 and 263: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 264 and 265: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 266 and 267: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 268 and 269: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 270 and 271: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 272 and 273: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 274 and 275: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 276 and 277: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 278 and 279: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 282 and 283: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 284 and 285: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 286 and 287: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 288 and 289: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 290 and 291: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 292 and 293: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 294 and 295: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 296 and 297: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 298 and 299: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 300 and 301: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 302 and 303: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 304 and 305: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 306 and 307: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 308 and 309: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 310 and 311: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 312 and 313: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 314 and 315: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 316 and 317: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 318 and 319: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 320 and 321: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 322 and 323: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 324 and 325: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 326 and 327: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 328 and 329: AMD64 Technology 24594 Rev. 3.10 Fe
24594 Rev. 3.10 February 2005 AMD64 TechnologyROLRotate LeftRotates the bits of a register or memory location (first oper<strong>and</strong>) to the left (toward themore significant bit positions) by the number of bit positions in an unsignedimmediate value or the CL register (second oper<strong>and</strong>). The bits rotated out left arerotated back in at the right end (lsb) of the first oper<strong>and</strong> location.The processor masks the upper three bits of the count oper<strong>and</strong>, thus restricting thecount to a number between 0 <strong>and</strong> 31. When the destination is 64 bits wide, it masksthe upper two bits of the count, providing a count in the range of 0 to 63.After completing the rotation, the instruction sets the CF flag to the last bit rotatedout (the lsb of the result). For 1-bit rotates, the instruction sets the OF flag to theexclusive OR of the CF bit (after the rotate) <strong>and</strong> the most significant bit of the result.When the rotate count is greater than 1, the OF flag is undefined. When the rotatecount is 0, no flags are affected.Mnemonic Opcode DescriptionROL reg/mem8, 1 D0 /0 Rotate an 8-bit register or memory oper<strong>and</strong> left 1 bit.ROL reg/mem8, CL D2 /0ROL reg/mem8, imm8C0 /0 ibRotate an 8-bit register or memory oper<strong>and</strong> left the number ofbits specified in the CL register.Rotate an 8-bit register or memory oper<strong>and</strong> left the number ofbits specified by an 8-bit immediate value.ROL reg/mem16, 1 D1 /0 Rotate a 16-bit register or memory oper<strong>and</strong> left 1 bit.ROL reg/mem16, CL D3 /0ROL reg/mem16, imm8C1 /0 ibRotate a 16-bit register or memory oper<strong>and</strong> left the number ofbits specified in the CL register.Rotate a 16-bit register or memory oper<strong>and</strong> left the number ofbits specified by an 8-bit immediate value.ROL reg/mem32, 1 D1 /0 Rotate a 32-bit register or memory oper<strong>and</strong> left 1 bit.ROL reg/mem32, CL D3 /0ROL reg/mem32, imm8C1 /0 ibRotate a 32-bit register or memory oper<strong>and</strong> left the number ofbits specified in the CL register.Rotate a 32-bit register or memory oper<strong>and</strong> left the number ofbits specified by an 8-bit immediate value.ROL reg/mem64, 1 D1 /0 Rotate a 64-bit register or memory oper<strong>and</strong> left 1 bit.ROL 251