|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);- {, W0 l5 G. g8 F' f4 k
- //! J' ]7 k0 [: y4 N3 ~; j
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed) q# T3 o! d" w! m+ U
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
8 h% s, l: K2 y% \$ G4 F. f1 B5 A6 G - // All other return values for SetJump are undefined.% z. B3 M% L" T' G6 p
- //
( w9 i. M# ~5 M1 j1 F3 w - if (Status == EFI_SUCCESS) {
* b7 k0 B+ S* w+ y/ V
; J* `2 `: D8 e1 g. p& L- //9 \1 g: r+ p! J6 e& |1 |
- // Call the image's entry point L4 i, W# z; M( s
- //
/ b/ m% w2 H& O( V* [ - Image->Started = TRUE;
5 n: d3 x( t6 J9 Y5 {2 a6 Q7 |4 l - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
" x" j/ {$ Z, [$ l+ d2 ~% x - + Q) E0 C' @% J3 ~! ?
- //1 [; R+ D5 P9 D
- // Add some debug information if the image returned with error. 3 z. N: i+ V z- ?
- // This make the user aware and check if the driver image have already released
/ x! Q% ~( p1 P' m j - // all the resource in this situation. : D. A6 ]3 X# G) @
- //
+ I l% w. p2 F# b1 [3 v - DEBUG_CODE (
; R; t- [7 K) ` C - if (EFI_ERROR (Image->Status)) {( Q6 M& i; D( u4 K0 G
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));5 Q" W* j4 W( i1 ?& s/ P0 x9 h" D
- }2 C# v9 t3 S. d$ y7 b0 [ {
- )8 @- U3 K. S7 e' C! Y
-
* h4 V" {/ }& Q - //
& C& f4 T9 i( R5 \ - // If the image returns, exit it through Exit()
/ z- {" n" f; i( R3 V; [4 p* I5 L - //) S& e9 m. g* I0 N8 s, d/ V0 G' L
- CoreExit (ImageHandle, Image->Status, 0, NULL);
, ]8 o! o8 J x' Z/ ~ - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
' d/ N( N; V) o1 X# D- W$ K既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?- I7 Q5 W2 y8 Q2 h0 i* o% I
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
3 y3 l8 m0 L! W6 h0 M/ i
1 ]1 O! `# S5 [9 V我感觉有点多此一举了...不解 |
|