|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);: {0 \+ k; s2 l
- //2 O Z/ \# U: p+ ~1 `4 \" O, ?" j
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
9 h; p5 U; ?3 k* Q. o; q - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump9 O" ~. x2 w3 T7 v, e
- // All other return values for SetJump are undefined.% i3 c. T! z% p# Z
- //) Y {+ q2 l! X
- if (Status == EFI_SUCCESS) {
2 @+ l9 z" n: U6 Z9 y/ S | - & J+ @* P7 B5 g4 Z2 [
- //6 @0 Z3 t3 K- X3 j- w
- // Call the image's entry point+ ]5 [' t3 [- J+ V5 T/ N
- //
+ m" y/ d# }6 X - Image->Started = TRUE;$ ^6 T9 c: {; N/ k p d$ p( N& E7 m
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
5 I$ X, I1 Y" c - ) H; u" {0 _4 X# w5 G" A# D
- //& B& I+ m" e6 O/ N0 k9 l" j
- // Add some debug information if the image returned with error.
9 o: l! G8 `0 Q# o - // This make the user aware and check if the driver image have already released - s" A* F) Z5 d! v" g
- // all the resource in this situation.
" G) a( N+ Q6 t* I6 \- t6 l - //
7 P( {6 W' k- T t- R" I/ ~# A& C - DEBUG_CODE (0 ~8 D' w3 d: o' U6 b
- if (EFI_ERROR (Image->Status)) {9 Q6 Y" N" W3 `4 q8 M/ Q4 |$ M! c
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
; D! m! t, A9 V2 y; d8 c0 [ - }
# R* d3 z6 E$ {) U' M - )
0 M" Q: N6 d) j# [* n -
. J% h" T8 R- F* S0 o8 J- _ - //
$ G; j) |/ P: Z* T/ B - // If the image returns, exit it through Exit()
. O8 b9 ^3 f3 Q$ J) b - //
9 w( k( y* O6 C6 U# G k2 t' | - CoreExit (ImageHandle, Image->Status, 0, NULL);. {& @1 X9 p. c: b2 P
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态4 x' s+ `' N, m4 R' |, @6 v
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
) w1 e5 a j; M而且目前来看driver只会返回Status而已,根据这个就可以做处理了.8 c# `! G9 c \6 y0 o
( D& e/ ~2 v4 G0 l9 V
我感觉有点多此一举了...不解 |
|