bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point


From: Sergey Bugaev
Subject: Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point
Date: Sun, 5 Mar 2023 23:46:40 +0300

Speaking of wrapping the syscall and INTR_MSG_TRAP, I might need a
little help — is there a proper way to tell GCC that my inline
assembly needs a specific register as input _and_ clobbers it? In
Rust, this would be, for instance,

asm!("whatever", inout("rdi") msg => _)

but GCC doesn't like

asm volatile ("whatever" : : "D"(msg) : "rdi");

and it's explicitly documented to not work. I guess I could try either

void *clobber;
asm volatile ("whatever" : "=D"(clobber) : "D"(msg));
// Never use clobber again

or

void *tmp = msg;
asm volatile ("whatever" : "+D"(tmp));
// Never use tmp again

but I'm wondering if there's a proper way to do this. Any tips? If
not, any preference among the two above options?

Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]