|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);6 g% Z" I0 M1 @! v( g U* R
- //
+ u# z* C' W i, h9 l1 S; G - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed% L5 |0 b8 Y& n! y' |$ {
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
# @# A' S2 P) H5 ` - // All other return values for SetJump are undefined.9 c& P: f& Y! V
- //4 h, G/ L9 A/ ]
- if (Status == EFI_SUCCESS) {
, u6 y0 t$ k/ {( q5 [" q) [" Q1 p - 8 D& `' l0 b+ g: D3 T" v1 R
- //( \/ {& \& F. p7 Z$ h0 o+ H
- // Call the image's entry point
' Y# Y! F4 _- c' C; P - //
, h% U: g" B" t - Image->Started = TRUE;
$ `2 J4 ^. }: r" e( ?. z6 S6 |; i - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
) \2 U0 h; d7 }, M5 q. v* E$ v: G4 h
" K" {0 x- C: l* P% V- //
" o& q4 j5 Q3 f, n! y - // Add some debug information if the image returned with error.
0 w. U. S1 A: k4 E' o - // This make the user aware and check if the driver image have already released 8 m: y* q: Z, ^: s
- // all the resource in this situation. + H: P. K& [% W% ~+ @
- //
/ [1 J, b$ I$ w9 X) s - DEBUG_CODE (5 H5 l" }4 Q' K) [& x
- if (EFI_ERROR (Image->Status)) {
- j+ o3 ^+ X, o' K( w) n - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status)); [2 p6 Q2 l: `+ W* a
- }
C$ C5 X3 e7 i - )
) A7 f( q1 o- r2 p% i3 d2 i - 4 n" h9 z% o; e, H) z
- //
+ [1 e& c; ~+ {7 o. r - // If the image returns, exit it through Exit()& O' o( o5 {% ~/ x8 d8 o
- //) z2 a; E3 Z$ e
- CoreExit (ImageHandle, Image->Status, 0, NULL);
' ]! c! L3 ]' R3 g. C1 z - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
' P4 y8 b8 P; L& a% t既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?! H9 D. @: j9 s1 ^+ M- r
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
7 @5 \8 `. O; a8 ^5 d* W! N5 v5 M, M: Q E" J* o6 I. G
我感觉有点多此一举了...不解 |
|