0

我尝试将三个参数从 fasm 代码传递给 c 函数:

push ebx
push eax
push esi
push edx
call _kernel_main

void kernel_main(uint8 boot_disk_id, void *memory_map, uint64 first_file_sector_number)

我的期望:

  • boot_disk_id获取edx数据,是低字节
  • memory_map获取esi数据,
  • first_file_sector_number获取 8 字节值,eax - 高 4 字节,ebx - 低 4 字节

在此处输入图像描述

假设ebx包含0x0并且eax包含0x2所以 first_file_sector_number 将获得值0x2

当我像这样改变位置 ebx 和 eax 时:

push eax
push ebx
push esi
push edx
call _kernel_main

我希望 first_file_sector_number 将包含 00000000 00000000 00000000 000000 1 0 00000000 00000000 00000000 00000000,即0x200000000 但它包含0x0

你能告诉我我错在哪里吗?

4

0 回答 0