|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
* N8 j- G, M; ]0 u; b - //
% k7 f% m+ p x' d I0 ~ D% g - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed' W/ T, a1 N, `( T
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump5 f- Z$ l# W; I# K2 f9 k
- // All other return values for SetJump are undefined.
, w: d. o3 c3 u0 H - //
S' F- e7 t* r( @/ M. S - if (Status == EFI_SUCCESS) {
6 _' N0 Q6 h9 K2 M
; C$ G' B( Z+ {- //# U( f( ^" _0 B2 X8 B1 a
- // Call the image's entry point
& [: l: o3 ^7 U* r% _7 X- ] - //
1 }0 n1 }* s) O1 b/ Z4 K7 q - Image->Started = TRUE;$ u5 n1 E; s0 u: t
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);2 X+ h6 ~, O+ `" O9 v
- 5 f& ^5 Q) |8 |! i' k4 V
- //
* g3 F, c4 [, Y/ } - // Add some debug information if the image returned with error. 0 j" `8 f9 o( y- P
- // This make the user aware and check if the driver image have already released 1 p3 _) \6 y! J' w* S; n
- // all the resource in this situation.
% c9 j1 x; g. B2 K - //
4 V7 M" L" p" E) Z - DEBUG_CODE (2 c$ ^5 f% Q% N p7 T) U
- if (EFI_ERROR (Image->Status)) {
5 R2 t6 I, q# J& [ - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));! u- `/ e' T* W$ F
- }, [, U* o0 z6 e/ D/ R2 x
- )
, Y. E9 p3 r% J: l! o - 0 ^; Y9 C6 F+ l. N6 r6 b% W5 M
- //3 t% `, k7 c, D
- // If the image returns, exit it through Exit()
+ `: j! R3 ?3 H W5 X/ f - //
, b* c5 p! U7 n7 |5 Z7 B - CoreExit (ImageHandle, Image->Status, 0, NULL);: p! ?4 x: r$ _7 e- r6 E
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
& M) B- I9 n. L9 N" T; }3 e G既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
$ I2 u5 ^& L. S2 g& L6 b; z. M9 Z而且目前来看driver只会返回Status而已,根据这个就可以做处理了. `0 G9 f+ m& F
. w+ y/ u" h q" C! {1 b+ m
我感觉有点多此一举了...不解 |
|