We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I was trying to write one byte to an I/O port, but I am failing finding the correct instructions in the instruction set of arm64 aarch64 architecture. I failed to find the answer in previous posts of this forum too.
To be sure I posted the question correctly, please consider a NS16550 uart.
NS16550
I want, basically, to use `outb` (or `inb`) instructions, but I do not find the correct syntax. An equivalent example in i386 is:
void dbg_io_write_8(uint16_t port, uint8_t val) { asm volatile ( "outb %%al, %%dx;" /* Outputs */ : /* None */ /* Inputs */ : "a" (val), "d" (port) /* Clobbers */ : /* None */ ); }
And, the equivalent for reading:
uint8_t dbg_io_read_8(uint16_t port) { uint8_t val; asm volatile ( "inb %%dx, %%al;" /* Outputs */ : "=a" (val) /* Inputs */ : "d" (port) /* Clobbers */ : /* None */ ); return val; }Thanks for helping!
uint8_t dbg_io_read_8(uint16_t port) { uint8_t val; asm volatile ( "inb %%dx, %%al;" /* Outputs */ : "=a" (val) /* Inputs */ : "d" (port) /* Clobbers */ : /* None */ ); return val; }
Aarch64 is not x86. Maybe you first read about the architecture?