summaryrefslogtreecommitdiff
path: root/Core/EM/SMM/SmmBaseAsm.asm
blob: cdaa37b80dfd3c280ce531a49b2e9b86f7711711 (plain)
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
;*************************************************************************
;*************************************************************************
;**                                                                     **
;**        (C)Copyright 1985-2008, American Megatrends, Inc.            **
;**                                                                     **
;**                       All Rights Reserved.                          **
;**                                                                     **
;**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
;**                                                                     **
;**                       Phone: (770)-246-8600                         **
;**                                                                     **
;*************************************************************************
;*************************************************************************

;**********************************************************************
; $Header: /Alaska/SOURCE/Modules/SMM/SMMBase/SmmBaseAsm.asm 2     7/14/09 12:16p Markw $
;
; $Revision: 2 $
;
; $Date: 7/14/09 12:16p $
;**********************************************************************
; Revision History
; ----------------
; $Log: /Alaska/SOURCE/Modules/SMM/SMMBase/SmmBaseAsm.asm $
; 
; 2     7/14/09 12:16p Markw
; Update headers.
; 
; 1     9/26/08 4:48p Markw
; 
; 1     6/09/08 5:56p Markw
; Assembly functions for Dispatcher.
; 
;**********************************************************************

;<AMI_FHDR_START>
;----------------------------------------------------------------------------
;
; Name:		SmmDispatcher.asm
;
; Description:	File that contains assembly for Smm Dispatcher.
;
;----------------------------------------------------------------------------
;<AMI_FHDR_END>

IFDEF EFIx64
.code
include token.equ

public EfiSmmInSmm

public InSmmFuncOffset
public InSmmFuncLength

InSmmFuncOffset dd InSmmFixup - InSmmStart
InSmmFuncLength dd InSmmEnd - InSmmStart

;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure:	InSmm
;
; Description:	Updates if *InSmm if in SMM.
;
; Input:
;	IN EFI_SMM_BASE_PROTOCOL	*This,
;	OUT BOOLEAN					*InSmm
;
; Output:	EFI_STATUS
;
; Modified:	Nothing
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

EfiSmmInSmm proc
InSmmStart EQU $
    or      rdx, rdx
    jnz     @f
    mov     rax, 8000000000000002h
    ret
@@:
    ;mov     al, 0
    db      0b0h
InSmmFixup EQU $
    db      0
    mov     [rdx], al
    mov     rax, 0
    ret
InSmmEnd EQU $
EfiSmmInSmm endp

ELSE    ;32-bits
.586p
.model small
.code

public _InSmmFuncOffset
public _InSmmFuncLength

_InSmmFuncOffset dd InSmmFixup - InSmmStart
_InSmmFuncLength dd InSmmEnd - InSmmStart

_EfiSmmInSmm proc public
InSmmStart EQU $
    or      dword ptr [esp + 8], 0
    jnz     @f
    mov     eax, 80000002h
    ret
@@:
    ;mov     al, 0
    db      0b0h
InSmmFixup EQU $
    db      0
    push    ebx
    mov     ebx, [esp + 12]
    mov     [ebx], al
    pop     ebx
    xor     eax, eax
    ret
InSmmEnd EQU $
_EfiSmmInSmm endp
ENDIF

end

;*************************************************************************
;*************************************************************************
;**                                                                     **
;**        (C)Copyright 1985-2008, American Megatrends, Inc.            **
;**                                                                     **
;**                       All Rights Reserved.                          **
;**                                                                     **
;**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
;**                                                                     **
;**                       Phone: (770)-246-8600                         **
;**                                                                     **
;*************************************************************************
;*************************************************************************