|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);) K& P6 P( w' y# Z. }. M% |; `
- //
- J/ P V0 q" D. U I/ S4 s( s - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed. Y; F3 T V7 m) q+ A' Q
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump8 P+ Q' @6 q% S' g1 [: n
- // All other return values for SetJump are undefined.
, \; G: @' A" y) o+ _* H2 \/ E - //
8 D' R( F3 o- G* W: D q9 w7 j - if (Status == EFI_SUCCESS) {" R3 h. ~/ D6 Y$ _8 `
5 E) r% u8 ^* @. y) m/ _6 v- //
' a5 r( |& _6 E' t1 V - // Call the image's entry point9 ~' ]& ~5 A8 B! X: X. J
- //
- w4 G, d1 O1 E' G" I - Image->Started = TRUE;
$ K" ^2 Z9 O+ J/ }. h8 x! c - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);/ F7 h& u- z! |$ L! J) q
- $ p' c2 x* Z j" `7 I! L
- //
w. I/ F D. i - // Add some debug information if the image returned with error. / V4 b1 g0 F! j% x3 N% Y* P
- // This make the user aware and check if the driver image have already released 2 W1 l" [8 j! F9 ^! G+ q/ [4 Y
- // all the resource in this situation.
& C5 H% x0 S5 H9 L" S! I/ {, q" O - //8 D$ a( r- N# V1 m- n- T2 {
- DEBUG_CODE (: q' l! g; F L3 g1 S9 {
- if (EFI_ERROR (Image->Status)) {2 X+ g# j- x \9 T; B9 X
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
( W. X% n; s: ~( M, h, `0 H - }) K, W9 l6 v- G: K5 `) S
- )
; V6 A( D! E" z- T2 Q - 9 z2 M: n( K* g+ c7 ~
- //
$ [( A; [7 @& {/ z; d- h. R7 y - // If the image returns, exit it through Exit()
. t/ b( m, m! _0 o$ T - //" o3 A) I% W, @; t+ O' z
- CoreExit (ImageHandle, Image->Status, 0, NULL);, Z; G% _- k" @! P0 E; B7 b
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
/ j6 I* M+ C' g; _6 S既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
. `( p J! Z p3 X/ a" d" ~而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
- s2 e# O) @) f9 y
7 Q5 R: ^, a1 E4 |0 c4 g我感觉有点多此一举了...不解 |
|