summaryrefslogtreecommitdiffstats
path: root/private/ntos/ex/i386/evpair.asm
blob: e06ab6f8773a650973c14a41f75856dfefd06d55 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
        title  "Event Pair Support"
;++
;
; Copyright (c) 1989  Microsoft Corporation
;
; Module Name:
;
;    evpair.asm
;
; Abstract:
;
;
;    This module contains the implementation for the fast event pair
;    system services that are used for client/server synchronization.
;    sethiwaitlo, setlowaithi.
;
;
; Author:
;
;    Mark Lucovsky (markl) 03-Feb-1992
;
; Environment:
;
;    Kernel mode.
;
; Revision History:
;
;
;--
.386p
;        .xlist
include ks386.inc
include callconv.inc                    ; calling convention macros
;        .list

EXTRNP  _KiSetServerWaitClientEvent,3
extrn   _KeTickCount:DWORD
extrn   _ExpTickCountMultiplier:DWORD

_TEXT   SEGMENT DWORD PUBLIC 'CODE'
        ASSUME  DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING

        page ,132
        subttl  "NtSetLowWaitHighThread"

;++
; Routine Description:
;
;     This function uses the prereferenced client/server event pair pointer
;     and sets the low event of the event pair and waits on the high event
;     of the event pair object.
;
;     N.B. This service assumes that it has been called from user mode.
;
; Arguments:
;
;     None.
;
; Return Value:
;
;     TBS
;
;--

cPublicProc _NtSetLowWaitHighThread, 0
cPublicFpo 0, 0

        mov     eax,fs:PcPrcbData+PbCurrentThread
        mov     eax,dword ptr [eax+EtEventPair]
        or      eax,eax
        jz      $BAIL
        mov     ecx,eax                     ; compute address of events
        add     eax,EpEventLow              ; server event
        add     ecx,EpEventHigh             ; client event
        stdCall _KiSetServerWaitClientEvent, <eax, ecx, 1>
        xor     eax,eax
        stdRET  _NtSetLowWaitHighThread
$BAIL:
        mov     eax,STATUS_NO_EVENT_PAIR
        stdRET  _NtSetLowWaitHighThread
stdENDP _NtSetLowWaitHighThread

        page ,132
        subttl  "NtSetHighWaitLowThread"

;++
; Routine Description:
;
;     This function uses the prereferenced client/server event pair pointer
;     and sets the low event of the event pair and waits on the high event
;     of the event pair object.
;
;     N.B. This service assumes that it has been called from user mode.
;
; Arguments:
;
;     None.
;
; Return Value:
;
;     TBS
;
;--
;PUBLIC _NtSetHighWaitLowThread, 0
cPublicProc _NtSetHighWaitLowThread, 0
cPublicFpo 0, 0

        mov     eax,fs:PcPrcbData+PbCurrentThread
        mov     eax,dword ptr [eax+EtEventPair]
        or      eax,eax
        jz      $BAIL1
        mov     ecx,eax                     ; compute address of events
        add     eax,EpEventHigh             ; server event
        add     ecx,EpEventLow              ; client event
        stdCall _KiSetServerWaitClientEvent, <eax, ecx, 1>
        xor     eax,eax
        stdRET  _NtSetHighWaitLowThread
$BAIL1:
        mov eax,STATUS_NO_EVENT_PAIR
        stdRET  _NtSetHighWaitLowThread
stdENDP _NtSetHighWaitLowThread

;++
;
; Routine Description:
;
;     This function returns number of milliseconds since the system
;     booted.  This function is designed to support the Win32 GetTicKCount
;     API.
;
; Arguments:
;
;     NONE
;
; Return Value:
;
;     Returns the number of milliseconds that have transpired since boot
;
;--

cPublicProc _NtGetTickCount, 0
cPublicFpo 0, 0

        mov     eax,dword ptr [_KeTickCount]
        mul     dword ptr [_ExpTickCountMultiplier]
        shrd    eax,edx,24                  ; compute resultant tick count

        stdRET  _NtGetTickCount
stdENDP _NtGetTickCount

_TEXT   ends
        end