|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
: a3 D: Y3 t! h# D7 { - //0 Z$ _+ |; _9 \: R- g) P3 h2 g
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed% {" m( D: `* M+ @0 |1 D4 D L" v9 ^% k
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
! O2 A9 t+ d+ i' ] - // All other return values for SetJump are undefined.
' ?9 D0 b7 f0 l; S3 |4 X - //
5 A/ ], Z) A9 ~ - if (Status == EFI_SUCCESS) {
& [" F b. [) u$ s
' O; }9 m/ U( ?6 k- //8 Z; M" f! o2 B+ y9 Q9 y
- // Call the image's entry point/ l9 L5 s t8 h
- //
$ e% o3 I8 m" _9 {" Z( r - Image->Started = TRUE;- S: h L9 n8 u0 w+ c: n
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
# K/ d' J3 A8 z - 1 B9 ~+ Q$ r s1 x
- //+ Z7 i+ w* `( c; Y0 m
- // Add some debug information if the image returned with error.
7 T/ C; m/ |$ H8 u* i7 y: F - // This make the user aware and check if the driver image have already released # b; `* b+ ~9 U3 \ S5 m' t
- // all the resource in this situation. & T+ N! j. d. q9 C! Z- n1 V2 C
- //) Y o; G8 y) p$ W
- DEBUG_CODE (! F* V! W9 \$ z4 c% }
- if (EFI_ERROR (Image->Status)) {
. m& [2 k; M6 z h b - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));* H# n: Z) U: Y* H) v
- }
% s7 q: H* e: r+ t a; e6 I- | - ). x$ L. L5 y; s1 g/ N, ?& z
- + ~+ A# q; e/ g$ O0 _
- //
5 O! h" q/ o* K - // If the image returns, exit it through Exit(): R7 v( `+ n4 }; x3 A
- //
T/ @0 g) Y% s4 ?+ X - CoreExit (ImageHandle, Image->Status, 0, NULL);+ P! e$ I" B" [) w, t
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态9 t% f" U- [# U* \: Q8 L% e
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
- V' y! W& O) O/ M而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
7 _2 e6 k* G; o. B$ I( b6 B* u* g" E7 y% o; Y9 G+ i1 s
我感觉有点多此一举了...不解 |
|