How to use LLVM to insert inline assembly code in a C program -


a system call defined follows:

my_syscall(char *arg1, char *arg2); /*syscall number 316*/ 

the following asm code used invoke system call in c program

#define __syscall_clobber "r11","rcx","memory" #define __syscall "syscall"  char *buf1 = "1234"; char *buf2 = "5678"; __asm__ volatile (__syscall : "=a" (ret) : "0" (316), "m" (*buf2) ,"c"(*buf1)  __syscall_clobber ); 

now, instead of manually insert above assembly code, want llvm it. know llvm provides inlineasm class, not clear details. best if can provide me llvm source code achieve goal, or useful hint appreciated. thank you!

btw, in llvm, ir of above mentioned inline assembly follows

call i32 asm sideeffect "syscall", "={ax},0,*m,*m,~{r11},~{rcx},~{rdx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 316, i8* %10, i8* %11) #3, !srcloc !3 


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -