|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
5 C9 q5 r4 H" Y0 T - //
! V& q( S* a5 ^) [) a; I4 m# P: F - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
0 p% g$ p. A" ?) `" y; W) u - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump& V5 ~# K( o9 e
- // All other return values for SetJump are undefined.
6 w, Y8 j+ D. ~ F2 g) o - //
" |& @: s6 m t& k6 C9 O - if (Status == EFI_SUCCESS) {3 ]- t: v' V& w8 y
7 q4 Z9 a x; W7 H2 @# [- //
0 D& i+ j: q- \5 | - // Call the image's entry point
2 g; h0 d4 f3 r. S' F) z7 _ - //; T/ ?2 P8 ?* o! u
- Image->Started = TRUE;
! n. e B2 {3 f+ e - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);+ @. B' d, ]1 N" e6 w- T- N4 I# v
) O+ q* U0 I' N- //
- i4 b6 D; A5 p4 F - // Add some debug information if the image returned with error.
2 E8 I/ y) p5 \: K - // This make the user aware and check if the driver image have already released $ O( E# u+ S* D4 x6 U9 v
- // all the resource in this situation.
: Q+ w- ^9 h( x9 o! ] - //, S' i5 u+ \* Z# w5 }, G; D5 P
- DEBUG_CODE ( ]) B" { `3 F/ Y5 w
- if (EFI_ERROR (Image->Status)) {2 k+ R2 D2 H, x# p1 h' y# Z
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
9 F/ }' L" R7 D& A+ L# N - }
3 @7 n; |$ q0 ?$ ^" m# { - )
" S1 d; |, E% g - 8 k3 ~% Y" z' d; G4 A
- //* A6 o! a2 y$ f- V* [
- // If the image returns, exit it through Exit()
7 `: F% U- N2 Z4 G - //- N& s* N" H% [: V
- CoreExit (ImageHandle, Image->Status, 0, NULL);: u, Q2 c4 z5 p9 ?$ k
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
8 a0 Q( D4 s* J* W0 G" v1 [; \既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
, \5 J9 q0 a+ t( x8 i而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
8 ~3 @) Z* b$ F5 f5 K* ?* b/ z+ @4 i3 {4 n! n* U
我感觉有点多此一举了...不解 |
|