You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
36: convert stage_4 of bootloader to rust r=phil-opp a=acheronfail
I've been playing around trying to convert some assembly to Rust in this repository, and I've (almost) managed to convert `stage_4` to a Rust function.
The only thing that I can't figure out, is how to calculate the `memory_map_entry_count` argument? I've tried various things and maybe I don't understand something here. 🤔
IIUC `memory_map_entry_count` is defined here in `stage_4.s`:
```asm
movzx rcx, word ptr mmap_ent
; If I understand correctly, the `movzx` instruction above is equivalent to:
; xor rcx, rcx
; mov cx, word ptr mmap_ent
```
But, I've even tried changing that completely (to things like `mov rcx, 0x0`) and the result is always `6` when `load_elf` is called, so I'm really quite confused.
In any case, I'm putting this PR up to see if you can help me understand that part above, and to try and remove more assembly in favour of more Rust. 😄
Co-authored-by: acheronfail <[email protected]>
0 commit comments