RE: using function names of syscalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can not access the system call functions directly as any other
function.
System calls are accessed thru interrupt 0x80 so we need to write the
assembly code for generating the TRAP for 0x80. The macros defined in
asm/unistd.h actually place that assembly code. If you don't want to
__syscall1 macros you can write your own assembly code in that place.
Assembly code should perform following:

- Place system call number (defined in asm/unistd.h) in %eax register.
- Place the system call arguments in following registers:
	- 1st argument in %ebx register
	- 2nd argument in %ecx register
	- 3rd argument in %edx register
	- 4th argument in %esi register
	- 5th argument in %edi register
- Generate TRAP: int 0x80

Regards,
Gaurav.


-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Ed L Cashin
Sent: Tuesday, July 27, 2004 6:42 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Re: using function names of syscalls

so usp <so_usp@xxxxxxxxxxxx> writes:

> Hi,
>
> I would like to know what should I do to use function
> names into my programs. I'm able only to use the
> function syscall(<syscall number>) in my programs.

You mean userland programs?

If you can understand how the macros like __syscall2 in asm/unistd.h
work to create functions that do system calls, then you can do the
same.

-- 
  Ed L Cashin <ecashin@xxxxxxxxxx>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux