|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);/ T0 U2 [1 M" x( Q4 h A
- //
: g2 O# i0 P: _ - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed4 ^2 Y: |* `- j% E: B
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
. A3 ?0 e: w- C - // All other return values for SetJump are undefined.1 y/ X! \% v/ p
- //* I/ ]7 @( ?. `1 ~* @& G
- if (Status == EFI_SUCCESS) {( [( N' ^. x- W9 g L, c3 }$ I. _
2 @9 |% x+ s1 S- //8 a& m5 K/ m' e
- // Call the image's entry point% T- W& X8 G: M) j2 A1 F
- //
& o0 |; R. u# \& V' m' k/ t" ? - Image->Started = TRUE;! j" M* N$ B0 s7 l' H3 Z
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);) l+ V2 ]& w* C! W7 X) r6 C6 F
- ' ~6 \0 n1 N- E8 K) I5 y) y0 ~
- //, q8 c+ h4 {9 c+ T- g0 V
- // Add some debug information if the image returned with error.
' I4 S7 ?: U( g/ J" R; i - // This make the user aware and check if the driver image have already released
: C) w: I5 Q! o - // all the resource in this situation. : m# D5 ?0 b1 ~; U/ F( V
- //
2 ]# [: r+ _1 k - DEBUG_CODE (" c/ L8 l. i) v# G, O! W
- if (EFI_ERROR (Image->Status)) {2 D5 [+ O7 }# c0 v! I% n
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
6 S" z' t7 p! }3 ]% _4 W! J1 ? - }6 B3 L1 j. h" e9 S! K
- )
% p5 _3 j! w6 M$ a: P( m - : o9 M- v b# F
- //
0 ^2 q% `! O( I' h# C" Z# {8 @1 U - // If the image returns, exit it through Exit()
+ @5 V U- ]' a, \! r - //, e% b/ v* B7 Z% p
- CoreExit (ImageHandle, Image->Status, 0, NULL);
2 X+ o7 o5 ^) K3 T - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
' f: g) K6 b* N8 a* \既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?; I) i" a3 _, Y
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
; F. s) b% L6 T
2 n1 W4 `& f3 `8 x9 H我感觉有点多此一举了...不解 |
|