|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
- ] b8 ?6 N4 m0 N, s1 E. x - //
' m( q3 b) _2 u - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed# i* s' B9 g( c7 F+ G! r
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
c% F% k" ]! m5 W3 P, N$ r - // All other return values for SetJump are undefined.% }+ f; p# H+ l- o% R- P
- //
1 ~% @7 e/ `5 _4 i! D4 V( o7 M - if (Status == EFI_SUCCESS) {# U7 u/ q! H" ^4 M0 d* P5 T0 @
- 0 G. t) N8 ]7 G7 T
- //+ z( N7 D/ j9 `& T
- // Call the image's entry point9 |% q% C- l* Y. `
- //
) M- L$ e9 Y) F - Image->Started = TRUE;6 @; q. ^5 z1 ?% Y2 y& W: u0 i
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);0 `% X& W1 G! n ]5 k4 L1 H# B* n$ l" n$ v
- 1 W6 H7 p4 \ k+ c& _
- //
2 M3 n8 a# o4 l6 x. ? - // Add some debug information if the image returned with error. & ^- r2 |. |4 j7 f+ C) ^
- // This make the user aware and check if the driver image have already released 5 |; q" q7 [/ ]) J
- // all the resource in this situation.
( ]& S) T3 E% f! F5 }1 U - //
' ~" A7 b/ \0 w- C - DEBUG_CODE (; p- I+ L \. S# y2 P, m$ |1 R, b, i
- if (EFI_ERROR (Image->Status)) {* O! I8 @, U; ^+ d+ B
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
4 K* T8 P$ t, I- H' C1 b" S' n - }# P9 b9 L2 J' |: p0 ~
- )
( C! R2 O3 j, L+ L7 _7 V9 q -
C a$ G. t4 t" Y - //8 J! f) o |$ M
- // If the image returns, exit it through Exit()# P! F8 V9 }) H
- //0 Z7 e! W4 q! I* W: z4 A4 l
- CoreExit (ImageHandle, Image->Status, 0, NULL);
7 N, Y) H$ M+ J& @) R- ? - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态1 Q" [0 ~) H* k& |, c- q
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
% H8 E3 G2 i$ y' @9 Y/ [. i$ V+ \而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
% Q% b& ^; i3 [- V& }. I- }: F
: `. V U8 \0 }) p我感觉有点多此一举了...不解 |
|