簡體   English   中英

在gcc內聯匯編中調用函數

[英]Calling a function in gcc inline assembly

說,我想在gcc的內聯匯編中調用具有以下簽名的函數。 我怎樣才能做到這一點?

int some_function( void * arg );

一般來說,你會想要做類似的事情

void *x;
asm(".. code that writes to register %0" : "=r"(x) : ...
int r = some_function(x);
asm(".. code that uses the result..." : ... : "r"(r), ...

也就是說,您根本不想在內聯asm中執行函數調用。 這樣您就不必擔心調用約定或堆棧幀管理的細節。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM