pointers - c inline assembly loading a register value to esp register -


in code, have following declaration

#if gcc == 1 #define set_stack(s)    asm("movl temp,%esp"); ... #endif 

in code, @ 1 place, macro used, on line compiler indicates of undefined reference 'temp'.

temp = (int*)some_pointer; set_stack(temp); 

the temp variable declared global volatile void pointer

volatile void* temp; 

is there syntax problem inline assembly ? of understanding, inline assembly tries load value of temp (not dereferenced value , pointer itself)

you have use extended assembler pass c operands assembler: read manual. (note: did not specify version using, picked one).

do not forget add registers used in assembler clobber list. should make assembler asm volatile.

depending on execution environment, might bad idea manually manipulate stack pointer! @ least should put __attribute__((naked)) function, not macro. trailing ; in macro definitively wrong, have right after macro (2 semicolons might break conditional statements!


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -