|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);! S4 Q7 d0 `" `# t- U2 }, B
- //
) G6 [9 V4 o7 N# c3 T. | - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
K4 L8 L) d5 D2 j( l - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
4 L4 j) D S9 a/ o* Y- x$ e - // All other return values for SetJump are undefined.; ^. X9 t) ?% e7 o! t: C
- //
8 y# ]; s; N5 b5 v( v$ D+ E - if (Status == EFI_SUCCESS) {! g. m2 U8 h# x5 q$ e: d4 f* [
+ s `( d" w$ G: t, t7 I' O0 s- //* f, t* z! T, L) l- u- V! T
- // Call the image's entry point
0 Z7 |* [% F) V% w - //: E4 ^! P8 i, x$ y& N# o. e
- Image->Started = TRUE;/ ?: a7 p6 L& |8 f$ k* Q8 P
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
h% @: K" d/ `5 q7 P4 d# h' ^; [! Y7 i
. [" Q6 @3 @7 _$ b8 e- //
0 l4 g, r9 g- A' m& W5 I- ?2 V* J - // Add some debug information if the image returned with error.
. w2 A8 F4 X- }% _! q+ Q) ^3 l - // This make the user aware and check if the driver image have already released ( c& b& _* m- B, p
- // all the resource in this situation. , \1 C1 u- W5 a# h, h, C
- //4 E6 D* t5 l1 J9 Y" c+ @ D
- DEBUG_CODE (
% J# C% H z) p3 g# H, C - if (EFI_ERROR (Image->Status)) {
3 S3 E5 v# | P, k1 O( I) Z s6 B+ h; l - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
l2 _/ \2 N2 o5 J5 e# u, h - }
+ Q. X3 {2 ]4 o- x) v( k/ z2 F; j - )8 {" E/ [# X; @+ C- G
-
! G8 _% O; Z. y2 Z1 U' M - //
% }: v$ R i' E x6 h" y - // If the image returns, exit it through Exit()
5 l4 \/ e; d9 y0 W0 G/ s0 Z5 T - //
G; y/ H" T. t$ V6 ^9 g D" [ - CoreExit (ImageHandle, Image->Status, 0, NULL);% x" G) m" D6 R) z
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
2 c( p" V; X/ a; F/ R" c6 J既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
2 U, i- s3 Y8 R0 x1 g/ S* v9 c而且目前来看driver只会返回Status而已,根据这个就可以做处理了.7 N* w# s! l* l% g5 I9 x+ \
9 V9 G; ]5 y2 d
我感觉有点多此一举了...不解 |
|