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.
I prefer nasm's syntax than AT&T syntax, but however I have to use it in a GCC inline asm statement. I want to achieve a retf (not a simple ret). Currently, I'm using this :
i think AT&T uses "retl" or "lret" instead of retf ... to be sure, encode a retf with nasm and disassemble the code with objdump -d and see how it is called
Alternatively, you can use the .intel_syntax trick when writing your code ...
There are chances that your ".byte" just went to the data section ... Anyway, forcing a return instruction in a C function is dangerous because you might miss some pops the compiler could have placed in the function epilogue.
because it would be very inefficient to have a function call everytime you want to issue "out edx,al" or "ltr", and unpractical for "sti" and "cli". Though i think in any other case, asm "functions" or code blocks (like interrupt stubs) should be in separate asm files, for small operations, having them in inline functions or macros defined in some kind of CPU abstraction header (#include <cpu/io.h>, for instance) allows the compiler to include them softly in generated code without impact on the pipeline or branch predict table ...