summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halcbus/i386/cbusprof.asm
blob: 4b445df95e8b7d9784159202e98021b6568472f2 (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
	title "profile interrupt handler for the Corollary MP machines"
;++
;
;Copyright (c) 1992, 1993, 1994  Corollary Inc
;
;Module Name:
;
;    cbusprof.asm
;
;Abstract:
;
;   This module contains the profile interrupt handler for the
;   non-boot processors in the Corollary MP machines.  This is
;   only needed because only one processor should ack the CMOS
;   for each profile interrupt.
;
;Author:
;
;   Landy Wang (landy@corollary.com) 26-Mar-1992
;
;Revision History:
;
;--



.386p
        .xlist
include hal386.inc
include callconv.inc                    ; calling convention macros
include i386\kimacro.inc
include cbus.inc

        EXTRNP  _HalBeginSystemInterrupt,3
        EXTRNP  _HalEndSystemInterrupt,2
ifdef CBC_REV1
        EXTRNP  _Cbus2RequestSoftwareInterrupt,1
endif

        .list


_TEXT	SEGMENT DWORD PUBLIC 'CODE'	; Start 32 bit code
        ASSUME  DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING


        page ,132
        subttl  "System Profile Interrupt for Additional Processors"
;++
;
; Routine Description:
;
;    This routine is entered as the result of a profile interrupt.
;    This routine is only entered by the non-boot processors.
;
;    The CMOS will be acked by the boot processor (only one CPU can
;    do this - which one is arbitrary, but it must only be ONE!).
;
;    This function thus, just raises system Irql to PROFILE_LEVEL
;    and transfers control to the standard system routine to process
;    any active profiles.
;
; Arguments:
;
;    None
;    Interrupt is disabled
;
; Return Value:
;
;    Does not return, jumps directly to KeProfileInterrupt, which returns
;
;    Sets Irql = PROFILE_LEVEL
;
;--
        ENTER_DR_ASSIST Hpx_a, Hpx_t

cPublicProc _HalpProfileInterruptPx     ,0

	;
	; Save machine state in trap frame
	;

        ENTER_INTERRUPT Hpx_a, Hpx_t

	;
	; (esp) - base of trap frame
	;

        push    _ProfileVector
        sub     esp, 4                  ; allocate space to save OldIrql
        stdCall   _HalBeginSystemInterrupt, <PROFILE_LEVEL,_ProfileVector,esp>

        ;
        ; if this is C-bus II, modify the vector so the interrupt
        ; will not be EOI'd.
        ;
        cmp     _Cbus2BridgesFound, 0
        je      short cbus1
        mov     eax, [_CbusClockVector]
        mov     [esp+4], eax
cbus1:

	;
	; The boot processor has already cleared (or is about to clear)
	; the interrupt flag on the RTC, so we don't do that here.
	;

        jmp     _HalpProfileInterrupt2ndEntry@0

stdENDP _HalpProfileInterruptPx


        page ,132
        subttl  "System Clock Interrupt for Additional Processors"
;++
;
; Routine Description:
;
;    This routine is entered as the result of an interrupt generated by CLOCK.
;    This routine is entered only by additional (non-boot) processors, so it
;    must NOT update the performance counter or update the system time.
;
;    instead, it just dismisses the interrupt, raises system Irql to
;    CLOCK2_LEVEL and transfers control to the standard system routine
;    to update the execution time of the current thread and process.
;
; Arguments:
;
;    None
;    Interrupt is disabled
;
; Return Value:
;
;    Does not return, jumps directly to KeUpdateRunTime, which returns
;
;    Sets Irql = CLOCK2_LEVEL and dismisses the interrupt
;
;--
        ENTER_DR_ASSIST Hcix_a, Hcix_t

cPublicProc _CbusClockInterruptPx   ,0

	;
	; Save machine state in trap frame
	; (esp) - base of trap frame
	;

        ENTER_INTERRUPT Hcix_a, Hcix_t

ifdef CBC_REV1
	;
	; because we can miss an interrupt due to a hardware bug in the
	; CBC rev 1 silicon, send ourselves an IPI on every clock.
	; since we don't know when we've missed one, this will ensure
	; we don't cause lock timeouts if nothing else!
	;

        stdCall _Cbus2RequestSoftwareInterrupt, <IPI_LEVEL>
endif

	;
	; Dismiss interrupt and raise irq level to clock2 level
	;

        push    _CbusClockVector
        sub     esp, 4                  ; allocate space to save OldIrql
        stdCall   _HalBeginSystemInterrupt, <CLOCK2_LEVEL, _CbusClockVector, esp>

	; Spurious interrupts on Corollary hardware are
	; directed to a different interrupt gate, so no need
	; to check return value above.

        POKE_LEDS eax, edx

        mov     eax, dword ptr [_CbusTimeStamp]
        mov     dword ptr [eax], 0

	;
	; (esp)   = OldIrql
	; (esp+4) = Vector
	; (esp+8) = base of trap frame
	;
	; (ebp)	  = base of trap frame for KeUpdateRunTime, this was set
	;		up by the ENTER_INTERRUPT macro above

        stdCall _KeUpdateRunTime,<dword ptr [esp]>

	INTERRUPT_EXIT

stdENDP _CbusClockInterruptPx

_TEXT	ends					; end 32 bit code
	end