I have a question where we need to implement internal working of open system call in gemOS.The question is as follows in the main function following
int create_fd = open(filename, O_CREAT|O_RDWR, O_READ|O_WRITE);
In Visual Studio Code when I checked definition of open using ctrl + enter, it lead me to following function. Lets suppose that Open system call has O_CREAT flag present, then accordingly _syscall3 will be called.
int open(char * filename, int flags, ...){
va_list ap;
long mode;
va_start(ap, flags);
mode = va_arg(ap, long);
va_end(ap);
if((flags & O_CREAT) == O_CREAT){
    return _syscall3(SYSCALL_OPEN, (u64)filename, flags, mode);
}
else{
    return _syscall2(SYSCALL_OPEN, (u64)filename, flags);
 }
}
When I checked definition of _syscall3 it gave me following code.I was not able to understand what is written inside asm volatile command. So can anyone explain me what is happening.
static long _syscall3(int syscall_num, u64 arg1, u64 arg2, u64 arg3){
asm volatile (
    "int $0x80;"
    "leaveq;"
    "retq;"
    :::"memory"
  );
  return 0;   /*gcc shutup!*/
}
Also when I tried printing something before asm volatile line, the function kinda stop executing. By the way the function that we need to implement for this call is following.
  extern int do_regular_file_open(struct exec_context *ctx, char* filename, u64 flags, u64 mode){
/**  
*  TODO Implementation of file open, 
*  You should be creating file(use the alloc_file function to creat file), 
*  To create or Get inode use File system function calls, 
*  Handle mode and flags 
*  Validate file existence, Max File count is 16, Max Size is 4KB, etc
*  Incase of Error return valid Error code 
* */
return 100;
}
I was trying to map Open function written in main file to this do_regular_file_open, but due to asm volatile I wasn't able to understand whats happening.
