summaryrefslogtreecommitdiffstats
path: root/private/ntos/rtl/i386/ntcurteb.asm
blob: 1e59478adfcbaf840b26b6038e19778ceeb8d8d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        title  "NtCurTeb.asm"
;++
;
; Copyright (c) 1989  Microsoft Corporation
;
; Module Name:
;
;    NtCurTeb.asm
;
; Abstract:
;
;    Efficient NtCurrentTeb code.
;
; Author:
;
;    Bryan Willman (bryanwi) 28 feb 90
;
; Environment:
;
; Revision History:
;
;--

.386p
        .xlist
include ks386.inc
include callconv.inc            ; calling convention macros
        .list

        page ,132
        subttl  "NtCurrentTeb"

IFDEF NTOS_KERNEL_RUNTIME
.PAGE   SEGMENT DWORD PUBLIC 'CODE'
ELSE
_TEXT   SEGMENT DWORD PUBLIC 'CODE'
ENDIF
        ASSUME  DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING

;++
;
; PTEB
; NtCurrentTeb();
;
; Routine Description:
;
;    This routine returns the address of the current TEB.
;
; Arguments:
;
;    None
;
; Return Value:
;
;    Address of TEB.
;
;--
cPublicProc _NtCurrentTeb   ,0
cPublicFpo 0,0

;
;   How this works in both user and kernel mode.
;
;   In user mode, TEB.TIB.Self is flat address of containing structure.
;   In kernel mode, PCR.TIB.Self is flat address of the TEB.
;   Same offset both places, so fs:PcTeb is always the flat address
;   of the TEB.
;

        mov     eax,fs:[PcTeb]
        stdRET    _NtCurrentTeb

stdENDP _NtCurrentTeb
IFDEF NTOS_KERNEL_RUNTIME
.PAGE           ENDS
ELSE
_TEXT           ENDS
ENDIF
                end