|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);) K. O# V3 h8 m# ]1 {
- //3 B; j4 v. _* p4 R) q, T2 u4 l5 d* h
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed+ H t2 F4 v- e) S" J: f
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump) |! N! H+ L1 |( s: ~
- // All other return values for SetJump are undefined.' ]# b! \ K# \4 @8 z+ f C; v
- //. R2 ]9 C+ S& l+ s8 i* K# N/ k( o
- if (Status == EFI_SUCCESS) {6 {9 p( y" g5 C* [0 j" w
- 2 n3 c8 d" D7 l3 k% m
- //0 e% E& g: G( ~1 ]. Z( L
- // Call the image's entry point7 u0 V \7 }. V
- //6 @; |+ k" v; s- k X6 }
- Image->Started = TRUE;
8 Y/ m! X* ]: N; |, ?) o - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
5 l' Z+ k. J& X* K4 f4 B
3 k) F5 j* X3 Z4 t# [" J- //2 A- A# N* g4 z8 H
- // Add some debug information if the image returned with error. & ]) A- c$ m. U' T* K/ k2 Y
- // This make the user aware and check if the driver image have already released
# F- w. q- h3 [' ^4 ^ - // all the resource in this situation. 2 |% t+ U# F# x! h5 g
- //, z/ |0 g6 C+ p$ X# ~9 S
- DEBUG_CODE (1 S; s+ M7 D# U( t# @% B4 o" D
- if (EFI_ERROR (Image->Status)) {3 z$ t& }$ s8 \' D0 h' F& \
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));/ {2 P1 @6 O) P" S2 j2 c+ b0 ^" Z
- }; _' d$ |$ s; r! p |
- )! C2 y2 S+ g) g" R1 k- m0 C' q+ P
-
; @- G+ n6 e. }3 P% j& t - //
v( T8 C- o3 X - // If the image returns, exit it through Exit()" ~* Q, X& k+ R: `2 n& O
- //
- X- f Z: S/ \9 D. M, n+ A _ - CoreExit (ImageHandle, Image->Status, 0, NULL);
/ N) ^) e- M2 [& O& @" Y; {9 b+ ~) t2 D - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
2 S2 g- m$ c/ G6 u1 \* D既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?* b1 I/ s3 h+ s! g4 x+ _7 J
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
) s) \0 Q9 E2 F0 K I; j7 i' a! ^' J( Y0 N& X" A. |7 a. r$ _" D
我感觉有点多此一举了...不解 |
|