|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);. t. H( v! ?4 i$ S: K
- //" v& f& y1 d8 }
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed2 X N/ T1 r( V+ b
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump- j5 r( V. z6 I; ?0 Q
- // All other return values for SetJump are undefined.! | q- g& X4 a8 h7 Y" s# b
- //
5 L4 g2 }5 I/ T0 g8 A6 R - if (Status == EFI_SUCCESS) {
0 h& @- }* t( p1 l- `" j2 v1 U# o
& O) H) w; z) h$ I. a- /// N- ^1 H# V( c; ?2 l5 u
- // Call the image's entry point( r) C/ h2 t6 ~0 I$ R
- //) r/ S' L! u( J( c& b1 o
- Image->Started = TRUE;! |# d& ?% k. X. w. a$ Q9 ?
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);0 o$ ?# w$ n4 P0 i1 i" A- F; N
- : X( l* W! e3 m1 D
- //' R5 C% f1 |! B3 W; U& p) E
- // Add some debug information if the image returned with error. 7 j9 z" d. F7 @& p1 h% T+ T- x
- // This make the user aware and check if the driver image have already released / q! E: P6 |/ j6 f8 i) ^
- // all the resource in this situation.
& t) u3 b& k! c, |8 ~/ R6 S - //
- H+ J3 K3 x! F) p: m9 \7 A0 { - DEBUG_CODE (
5 \9 p/ a4 l8 ]; W5 S3 ?7 {1 I - if (EFI_ERROR (Image->Status)) {
0 B! P# M# i6 U$ t6 Q - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));5 o& I( f6 y) G7 n9 e+ Y. {
- }
5 V" _$ J0 J- D0 R6 o - )
$ [/ h5 E" S, @$ ?2 \* c -
, W" b4 E0 m% R8 L( X. i - //
0 z1 d6 b9 ?% |; [% t, S - // If the image returns, exit it through Exit()
) g$ q+ S$ S6 x - //8 c& b- b+ x- j5 ~8 V7 Z' r$ r
- CoreExit (ImageHandle, Image->Status, 0, NULL);
' V9 d" D) E$ q9 H9 G0 a - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
$ Y( h- i8 b4 d$ [5 z' N$ {1 [7 J既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗? Y: K6 ]7 X- b, Z% K
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
. T( [" U! H3 W. q a5 p
d* ?, }9 r# o8 |; Q; ^我感觉有点多此一举了...不解 |
|