GNU Info

Info Node: (nasm.info)Section B.4.314

(nasm.info)Section B.4.314


Next: Section B.4.315 Prev: Section B.4.313 Up: Section B.4
Enter node , (file) or (file)node

B.4.314. `SYSENTER': Fast System Call
-------------------------------------

     SYSENTER                      ; 0F 34                [P6]

   `SYSENTER' executes a fast call to a level 0 system procedure or
routine. Before using this instruction, various MSRs need to be set up:

   * `SYSENTER_CS_MSR' contains the 32-bit segment selector for the
     privilege level 0 code segment. (This value is also used to
     compute the segment selector of the privilege level 0 stack
     segment.)

   * `SYSENTER_EIP_MSR' contains the 32-bit offset into the privilege
     level 0 code segment to the first instruction of the selected
     operating procedure or routine.

   * `SYSENTER_ESP_MSR' contains the 32-bit stack pointer for the
     privilege level 0 stack.

   `SYSENTER' performs the following sequence of operations:

   * Loads the segment selector from the `SYSENTER_CS_MSR' into the
     `CS' register.

   * Loads the instruction pointer from the `SYSENTER_EIP_MSR' into the
     `EIP' register.

   * Adds 8 to the value in `SYSENTER_CS_MSR' and loads it into the
     `SS' register.

   * Loads the stack pointer from the `SYSENTER_ESP_MSR' into the `ESP'
     register.

   * Switches to privilege level 0.

   * Clears the `VM' flag in the `EFLAGS' register, if the flag is set.

   * Begins executing the selected system procedure.

   In particular, note that this instruction des not save the values of
`CS' or `(E)IP'. If you need to return to the calling code, you need to
write your code to cater for this.

   For more information, see the Intel Architecture Software Developer's
Manual, Volume 2.


automatically generated by info2www version 1.2.2.9