|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
2 H: x/ K, `$ K - //
8 I% e' u2 w% u - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
7 O1 _- F' [( Y& a8 \8 h' M - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump7 d( I8 N* m& O% [: y6 D$ n2 v
- // All other return values for SetJump are undefined.! C6 K) D' G& S* m! G* M
- //8 E: G3 h$ F( |9 }8 H/ ~9 }7 ]
- if (Status == EFI_SUCCESS) {* [6 v' D! R' K. R8 ~0 Q
! b8 P. w- c( F- //- P9 ?: j8 w* M0 e# `) @6 R
- // Call the image's entry point
) o% c8 X2 @4 T5 V - //
( m7 c- ~- z% A - Image->Started = TRUE;
9 G$ e1 m# V& z r6 U" ` - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);' p# N5 `* g2 p0 |) o
- " }& Y; a4 n! i. y6 E8 D
- //# \% E: l. S6 J% R: Z4 b" g' j- a
- // Add some debug information if the image returned with error. ! N6 V& g9 v3 }! Y+ ~9 ~" U3 e# j
- // This make the user aware and check if the driver image have already released & b) A$ A5 x, z
- // all the resource in this situation. + l0 Y' N2 w9 s0 g) T* p+ Z
- //' W) N' K; \( t1 V/ D
- DEBUG_CODE (
3 p a3 p+ b7 Y: H" P - if (EFI_ERROR (Image->Status)) {
& q# K8 ^* u; ?" P8 m - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
8 a2 M! o' z* R% _, b - }
) i1 @% R, k1 f: i' n - )1 |' d! v: g+ d% W" w9 |: ?4 Q
- # h& Q" {/ g# a# R9 T& H
- //
1 i; W, h' m, M. D, @ - // If the image returns, exit it through Exit()
C& Q" ?% S- Q2 q" F1 _ - //* m1 {- I7 F( p
- CoreExit (ImageHandle, Image->Status, 0, NULL);
/ | z/ I; r5 Q) Q' Q& U* q - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态: b; ^- S! O9 D+ t& w$ y
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
' C& I9 P! {8 B2 d) V8 H而且目前来看driver只会返回Status而已,根据这个就可以做处理了.* k) ^$ W4 Q) l9 b2 G" a* c
0 B8 H) r' d/ O) P" L/ B5 K& x5 H我感觉有点多此一举了...不解 |
|