0

For learning purpose I started this series of tutorials about writing an operating system from scratch: os-tutorial

The tutorial aims at x86_64 systems using NASM assembler. My goal is to translate the code in order to execute it on ARM systems using arm-none-eabi-as as the assembler. I understand the x86_64 code provided in the tutorial but I am struggling in the translation step.

Are there any resources that could help me with the task?

For example, how can I translate the following x86_64 code in ARM?

mov ah, 0x0e ;tty mode
mov al, 'H'
int 0x10
mov al, 'e'
int 0x10
mov al, 'l'
int 0x10
int 0x10
mov al, 'o'
int 0x10

loop:
    jmp loop ;infinite loop

times 510-($-$$) db 0 ;write 510 minus previous code size 0

dw 0xAA55 ;write an half word -- boot magic number
Umberto
  • 31
  • 4
  • 3
    Note that the code you have there is 16 bit x86 code, not 64 bit code. Translating it to ARM will not be straightforward since ARM lacks the BIOS which provides the `int 0x10` calls on a PC. Also, the peripherals are quite different and depend on the specific ARM board you are programming for. So there isn't really a good answer to your question. – fuz Jan 28 '22 at 12:03
  • 1
    Are there any resources? Yes, Linux and u-boot. Every CPU type has a different boot sequence. [Why bootloader for embedded?](https://stackoverflow.com/questions/15548004/why-do-we-need-a-bootloader-in-an-embedded-device). The code you are trying to 'port' does not exist on an ARM cpu. So the correct answer is you **DONT** port this code. You need to author/find an alternate. – artless noise Jan 28 '22 at 13:33
  • Indeed. At this low a level, "port" means "rewrite from scratch". – Nate Eldredge Jan 28 '22 at 16:07
  • Thank you, now I see why I was struggling. – Umberto Jan 28 '22 at 16:18

0 Answers0