|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
6 u* \3 y& z9 j" }. V - //
V1 E+ N3 y7 i% P. E* o - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed; k% [& W4 P" ?6 ?( b: A
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
! L% n. y, } I9 ~ k - // All other return values for SetJump are undefined.
, _: J) Y ? `9 a - //$ y7 C7 s+ \) l6 E0 H' [3 s
- if (Status == EFI_SUCCESS) {+ I9 }& s4 T; x2 [2 n! q
- . l0 i- W/ ?5 z5 b# g4 w" |
- //
8 _" E: T- F" Z' O# Z - // Call the image's entry point$ D) q+ u, k, M% c9 ? l6 n) s( o
- //: b+ K |0 H L2 c; E$ v
- Image->Started = TRUE;
+ Y5 q$ |- I( o" E/ ?( m ^- X: | - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
8 M5 G; k5 b+ z! W& E - 8 {5 u& H6 ^' ~6 q
- //8 U* z" T" ^& Q
- // Add some debug information if the image returned with error.
* B! F7 Q& B3 y( H - // This make the user aware and check if the driver image have already released
0 S, V' n1 J' H - // all the resource in this situation.
0 E" L# D5 C, M; z5 y - //* n6 ]" P- n, Q- u; I% H* M
- DEBUG_CODE (: i( `" r* w- l5 s$ {3 P
- if (EFI_ERROR (Image->Status)) {$ t4 _& T0 G0 |2 E& ?
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
+ e6 W! d6 V& Y; c4 I - }
2 L/ H6 o7 \4 o# x+ {# A - )6 ~3 l# p7 a6 V! c: t5 F
- 3 ^& r# L' e6 D3 ? L/ |% n
- //
; \# G, P @" ~# s% m" \, j) I - // If the image returns, exit it through Exit()
2 a: A9 J! [8 x# i# z$ a - //+ Q% Q/ U* o6 q! ]& t
- CoreExit (ImageHandle, Image->Status, 0, NULL);& Q* C: u! o4 Z; W( J1 |+ {
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
, ~2 o% o* ]# I6 L: @5 [' t s0 E既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
9 W0 w" e G2 N- ^" b3 P; B4 i而且目前来看driver只会返回Status而已,根据这个就可以做处理了.5 U9 W3 J' L* Q
7 `7 J( }2 S+ e) N- f/ L% _
我感觉有点多此一举了...不解 |
|