|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
7 @: {1 p2 J; t( H6 t ?) [/ ^- p - //# A( q- S5 c3 u E% P- @$ M6 O% U* _
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
9 b& M4 w2 [$ g - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
3 I# E' R1 M1 g3 p# A& o2 b' @ - // All other return values for SetJump are undefined.
! o! d. A" I% Z B# O - //9 `# o3 c; j3 J( r
- if (Status == EFI_SUCCESS) {
2 h7 q1 {2 T' K
" k7 ~- |+ X- {: X& \% u$ U7 ^ ^- //
1 } ^# q$ G0 F8 s5 c/ S - // Call the image's entry point8 G$ P' z5 \) h) K/ F
- //
* }- B! J& y9 `' P5 a* m* _ - Image->Started = TRUE;
- q( G/ ^1 b# A0 s - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);7 ]5 b. _# n/ k5 c# _* g o
- 7 V! m% ]* \/ H7 G% x
- //
* P2 N0 } W" I, m* @. r) }# Q4 ~8 G - // Add some debug information if the image returned with error. 7 |5 T" K( p. h5 K ]9 P1 J8 ]# B
- // This make the user aware and check if the driver image have already released
/ C/ S- Q1 a! V3 M+ P! d - // all the resource in this situation. 3 K0 m( u5 D9 E1 S% l9 C# U4 s
- //
! I6 V" m& y. [. H) G - DEBUG_CODE (6 R$ o& f0 N0 R
- if (EFI_ERROR (Image->Status)) {
& a" J) W$ ` j, E5 v8 w$ M - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
& F# H3 I- \! j - }% ]0 Q2 }: Z- Q9 z7 H
- )! W( V7 L% x! h; }& m/ g
- 0 a0 L0 K2 p1 S
- //7 I7 k: L* N1 }% s5 \+ D
- // If the image returns, exit it through Exit() g" i" r' p3 d( K: H7 F6 x
- //( k0 C- m% Z' G* ?; y) t4 U1 \0 m: T
- CoreExit (ImageHandle, Image->Status, 0, NULL);
& r5 \" K* b; |/ m! V; } - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态. ]7 `1 G0 y3 C1 ^; O9 X
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
* w* | C% s k5 y; x$ K而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
, I% G, ?/ m$ }- g4 |8 x/ {: m; ^- g5 O: q0 x: y' [2 n
我感觉有点多此一举了...不解 |
|