|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
! u7 v& g! u( S5 }) i, R8 }/ L8 M; U' g - //
2 @; h. M/ S0 l7 K- i7 S# V* J5 v - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed1 R% O2 P1 h' C _( E
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
7 k1 P d0 E6 M" R, b# B+ b - // All other return values for SetJump are undefined.
( \2 R7 K& F* }3 Y$ `8 n [ T - //# H; j/ S7 q- j
- if (Status == EFI_SUCCESS) {" d, n3 G2 p! {
/ w; ` l& q- l4 z- //# ~: o, O7 f$ u7 Y5 B# i/ s
- // Call the image's entry point' Y* A- z8 e1 o, @
- //
/ J. j% L- {5 S# }2 H - Image->Started = TRUE;. k) H {1 b! L- c- t& X# `
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);2 d y( i0 ?/ G% @% N
% a' c8 G p) L7 x' ~1 B- //. l G) q: H T
- // Add some debug information if the image returned with error. # p: c, o( i# n. F1 `
- // This make the user aware and check if the driver image have already released
" m N/ o) L2 k, w0 R - // all the resource in this situation. 5 [4 p: N8 f8 C) t1 e, U
- //
) D% X) k( T; B; @. P' n - DEBUG_CODE (
2 m( N E0 t- z H t; r - if (EFI_ERROR (Image->Status)) {
/ O) b6 I- ^# F7 y - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
2 {: p/ w+ w8 Q0 S1 m, D - }
3 z6 K7 b0 I9 I9 l. P - )! b$ ?2 ~9 M9 N8 x% E
- 3 K' d+ d& a/ u1 e9 x0 u; Q9 j) p9 B
- //
5 w8 ]' M6 \3 S- z - // If the image returns, exit it through Exit()+ G, p- D, q) p& p, p( s
- //
5 ?! J( z# H9 ?! y% j; z - CoreExit (ImageHandle, Image->Status, 0, NULL);- _4 ]/ G! B, N
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态5 G2 C* E' }* L) `+ X. U
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?& Z: J3 i/ c `- Y5 l5 }9 a
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.2 S# n j9 M& d. m" U
0 F. j) L; G1 N
我感觉有点多此一举了...不解 |
|