我想將變量「userstack」的值移到ESP寄存器中,然後絕對跳轉到變量「location」中包含的內存地址。 這是我的本錢: // These are the two variables that contains memory addresses
uint32_t location = current_running->LOCATION;
uint32_t userstack = cur
我很難理解在GCC內聯彙編(x86)中扮演的角色約束。我有read the manual,這正好解釋了每個約束的作用。問題是,即使我理解每個約束所做的事情,但我很少理解爲什麼你會使用一個約束而不是另一個約束,或者可能會產生什麼影響。 我意識到這是一個非常廣泛的話題,所以一個小例子應該有助於縮小焦點。以下是一個簡單的asm例程,它只是增加了兩個數字。如果發生整數溢出,它會將值1寫入輸出C變量。 in
例子: int main(void)
{
int x = 10, y;
asm ("movl %1, %%eax;"
"movl %%eax, %0;"
:"=r"(y) /* y is output operand */
:"r"(x) /* x is input operand */
:"%eax"); /* %eax