Fast Trap Mechanism

Hi,

What is meant by “Fast Trap Mechanism” w.r.t. NT 4.0 or W2K?
Is this a feature provided by Intel x86 architecture?
How do I achieve this?

Thanks,
Niraj

>What is meant by “Fast Trap Mechanism” w.r.t. NT 4.0 or W2K?

Is this a feature provided by Intel x86 architecture?
How do I achieve this?

I believe this refers to a some new instructions in newer x86 processors
for transitioning from user mode to kernel mode and back. The benefit is
faster system calls from user mode. NT 4 used a software interrupt.

  • Jan

Jan,

Do you have any idea how this could be implemented in NT 4.0?

I believe, on Intel x86 architecture, a fast trap is initiated
by the INT n instruction.

Thanks,
Niraj

Jan Bottorff wrote:

>What is meant by “Fast Trap Mechanism” w.r.t. NT 4.0 or W2K?
>Is this a feature provided by Intel x86 architecture?
>How do I achieve this?

I believe this refers to a some new instructions in newer x86 processors
for transitioning from user mode to kernel mode and back. The benefit is
faster system calls from user mode. NT 4 used a software interrupt.

  • Jan

>Do you have any idea how this could be implemented in NT 4.0?

I believe, on Intel x86 architecture, a fast trap is initiated
by the INT n instruction.

I believe the instructions SYSENTER and SYSEXIT are used. Only Microsoft
could change this, as all the “INT n” instructions for a system call would
be replaced by SYSENTER, along with all the correct context setup.

A fragemnt of the Intel docs say:

**************
The SYSENTER instruction is part of the “Fast System Call” facility
introduced on the
Pentium II processor. The SYSENTER instruction is optimized to provide the
maximum
performance for transitions to protection ring 0 (CPL = 0).

The SYSENTER instruction sets the following registers according to values
specified by the
operating system in certain model-specific registers.

CS register set to the value of (SYSENTER_CS_MSR)
EIP register set to the value of (SYSENTER_EIP_MSR)
SS register set to the sum of (8 plus the value in SYSENTER_CS_MSR)
ESP register set to the value of (SYSENTER_ESP_MSR)

The processor does not save user stack or return address information, and
does not save any
registers.

The SYSENTER and SYSEXIT instructions do not constitute a call/return pair;
therefore, the
system call “stub” routines executed by user code (typically in shared
libraries or DLLs) must
perform the required register state save to create a system call/return pair.
**************

  • Jan