Results 1 to 8 of 8
What is the meaning of the struct pt_regs argument to sys_fork? (This seems like a trivial question, but I've had no luck finding the answer, in the source code or ...
- 03-19-2006 #1Just Joined!
- Join Date
- Mar 2006
- Posts
- 34
sys_fork arguments
What is the meaning of the struct pt_regs argument to sys_fork? (This seems like a trivial question, but I've had no luck finding the answer, in the source code or otherwise.)
- 03-19-2006 #2
From '/usr/include/asm/ptrace.h':
Code:/* this struct defines the way the registers are stored on the stack during a system call. */ struct pt_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; int xds; int xes; long orig_eax; long eip; int xcs; long eflags; long esp; int xss; };
- 03-19-2006 #3Just Joined!
- Join Date
- Mar 2006
- Posts
- 34
I'm familiar with the definition of the structure; it contains a set of registers. My question is what it means to sys_fork.
- 03-19-2006 #4
- 03-27-2006 #5
With pt_regs you have the __NR_number (the sys_call_table index) and the parameters passed to the syscall (eax, ebx, ecx... in order).
As previously said, it is useful for tracing and debugging.
Best regards!
- 12-06-2006 #6Just Joined!
- Join Date
- Dec 2006
- Posts
- 2
I am wondering how could I call sys_fork() with appropriate parameters..as in how do i contruct the parameter to be passed?
Thanks,
Neelam
- 12-06-2006 #7
You can't or better, you should not.
It is a syscall that means that it is an interface between user space and kernel space. The compiler put the proper values into the registers, so when you make a fork() in user space, it calls to system_call assembler routine by means of the int 0x80 (and in modern processors and kernels with the SYSENTER instruction provided by Intel)
So there is not need to put any values by hand.
Best Regards
- 12-07-2006 #8Just Joined!
- Join Date
- Dec 2006
- Posts
- 2
Thanks a lot..I decided not to call it inside the kernel...
Regards..



