将精灵条目添加到gnu efi中的功能中
如何将ELF64_EHDR.E_ENTRY施加到功能中?
例如:void(*kernel_function)()=(void(*)())*kernel_entry_point;
当前代码: (标题是ELF64_EHDR) |所包含的Elf.h的版本与/usr/include/elf.h
EFI_PHYSICAL_ADDRESS* kernel_entry_point;
// get entry
*kernel_entry_point = (&header)->e_entry;
//cast into a usable function
void (*kernel_function)() = (void (*)())*kernel_entry_point;
//call the casted function
kernel_function();
我尝试过,但是在内核可以编写字符串之前,EFI应用程序退出。 (在这种情况下是“ Hello World!”)
如果有人可以帮助我,我会很感激。
edit :
忘记包括内核代码,所以这里是
#include <stdint.h>
void write_string( int colour, const char *string )
{
volatile char *video = (volatile char*)0xB8000;
while( *string != 0 )
{
*video++ = *string++;
*video++ = colour;
}
}
extern "C" void _start()
{
write_string(15, "Hello world! \n");
return;
}
How would I cast a Elf64_Ehdr.e_entry into a function?
eg: void (*kernel_function)() = (void (*)())*kernel_entry_point;
Current code:
(header is a Elf64_Ehdr)
| The version of elf.h included is identical to /usr/include/elf.h
EFI_PHYSICAL_ADDRESS* kernel_entry_point;
// get entry
*kernel_entry_point = (&header)->e_entry;
//cast into a usable function
void (*kernel_function)() = (void (*)())*kernel_entry_point;
//call the casted function
kernel_function();
I've tried this but the EFI application exits before the kernel can write a string. (which in this case is "Hello World!")
If anyone can help me with this I'd appreciate it.
EDIT:
Forgot to include kernel code, so here it is
#include <stdint.h>
void write_string( int colour, const char *string )
{
volatile char *video = (volatile char*)0xB8000;
while( *string != 0 )
{
*video++ = *string++;
*video++ = colour;
}
}
extern "C" void _start()
{
write_string(15, "Hello world! \n");
return;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论