Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
have you setup the IDT? and what is the specific line you use for the asm? if you use your method, gcc will probably complain, but mine, last time I checked, worked..
int_call( int i )
{
asm(".intel_syntax noprefix\n"
"int [i] \n"
".att_syntax");
}
code? I have tried this and gcc complains about improper syntax.
Thanks,
--t0xic
I said IDT not GDT..(though you have to have GDT also)
GCC doesn't recognize local variable symbols..though it does recognize global symbols(also, you'd have to have a leading underscore to make it _i)
gcc (in contrast to many other compilers) actually has a useful, elegant way to merge inline asm with C code
i suggest you check the relevant manual entry, its a long read and may not be the easiest thing to understand, but you'll need it if you want to produce safe, working, semi-portable (as in, doesn't break if some inner working of the compiler changes) inline asm
Not sure about what happens if you put it in intel syntax, but in gcc's default (at&t) you need to prefix all immediate operands by a '$'. The above calls int 0x80 with eax set to 0, ecx to 1 and edx to 0.