【UEFI基础】System Table(二)

参考WWW.LAB-Z.COM大神的操作来寻找一下System Table.

以OVMF 代码为例, 在 \MdeModulePkg\Core\Dxe\DxeMain\DxeMain.c 中可以查到。为了验证,我修改代码,在整个 Table 的最后面加上一个标记。

 MemoryProfileInit (HobStart);

  //
  // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
  // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
  //
  //Alix_debug_start
  //gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
  gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE) + 4, &mEfiSystemTableTemplate);
    p=(UINT8 *)gDxeCoreST;
  *(p+sizeof (EFI_SYSTEM_TABLE))='A';
  *(p+sizeof (EFI_SYSTEM_TABLE)+1)='L';
  *(p+sizeof (EFI_SYSTEM_TABLE)+2)='I';
  *(p+sizeof (EFI_SYSTEM_TABLE)+3)='X';
   
   DEBUG ((DEBUG_INFO | DEBUG_LOAD, "AlixMark\n"));
   DEBUG ((DEBUG_INFO | DEBUG_LOAD, "0x%x\n", p));
   DEBUG ((DEBUG_INFO | DEBUG_LOAD, "0x%x\n", p+sizeof (EFI_SYSTEM_TABLE)));	
  //Ailx_debug_End
  ASSERT (gDxeCoreST != NULL);

  gDxeCoreRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
  ASSERT (gDxeCoreRT != NULL);

编译BIOS 然后在 QEMU 上运行,先是查看串口输出
在这里插入图片描述
可以看到给出来的 System Table的内存地址是 0x7BEE018。我们启动到 Shell 使用 mem 命令可以看到内存的信息,其中包括当前的 SystemTable 的地址
在这里插入图片描述
*mem最后会输出efi系统表,参考shell下命令相关文章。

附上大神的连接
http://www.lab-z.com/stu22/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值