|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);8 N( C- g* W. h
- //" x9 T" T b5 I" }$ _
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
$ X0 W6 u7 _: q8 b - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
8 c t. z' q2 w! M7 F - // All other return values for SetJump are undefined.
- U0 J7 J C3 j$ k0 ?. \, a1 @/ b; L - //
7 U# D( t+ F0 r& U2 W) q - if (Status == EFI_SUCCESS) {( G! T, p* u3 i* | z
$ u ? `( x- R- //3 D6 b4 j4 k' ^! o9 @0 @* }$ P+ y, C
- // Call the image's entry point! U j9 i) r1 C# O; Y! @
- //# l- _4 Y* p/ |7 S6 P
- Image->Started = TRUE;
3 ]: g2 t5 J' n9 Q - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
. ^. z; @# f! j5 E" N: h. y' W
3 I) ]2 A9 M! P* V0 h9 P- M: n- //
0 n: g D7 K' s; N7 a* G+ H Q - // Add some debug information if the image returned with error. 4 }. T) {8 B% G7 x; Y" g1 R
- // This make the user aware and check if the driver image have already released 0 s; H$ N$ b- z& R" Y# P& i
- // all the resource in this situation.
. q) M" d. h2 V0 n# `/ E; B8 P - //
: g) E, ?+ Z3 k - DEBUG_CODE (% o0 i' _0 T4 C$ l( f' `+ g
- if (EFI_ERROR (Image->Status)) {: [! |- _' ]$ B
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));" o8 I, h$ Z7 [2 s
- }
! `' l1 Y9 b9 n - )
: ?2 J0 Z! R$ ^9 o+ u - ' D8 g( j. B9 J3 V% @
- //0 ?7 n, p/ w; \5 ?5 o
- // If the image returns, exit it through Exit()
6 `6 p/ H# A2 M, s% D - //
: `7 p7 U) `- u: T - CoreExit (ImageHandle, Image->Status, 0, NULL);
/ P" l) F9 ]' d: y - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
0 Q8 O' f& x# y既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?' @3 y6 e' }9 B2 P. n' }
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.( l6 a4 V$ I/ n* E; x5 } @- L. x
9 J0 T ^$ H% Q, q0 {( t$ m0 T我感觉有点多此一举了...不解 |
|