]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ia64: a little more documentation in fsys.txt
authorIan Wienand <ianw@gelato.unsw.edu.au>
Wed, 15 Oct 2003 08:49:00 +0000 (01:49 -0700)
committerDavid Mosberger <davidm@tiger.hpl.hp.com>
Wed, 15 Oct 2003 08:49:00 +0000 (01:49 -0700)
Attached is a suggestion for a small addition to fsys.txt about how
userspace can use fast system calls.

If people think this is totally wrong, or that something like this
might be more appropriate in our WiKi, that's fine.

Documentation/ia64/fsys.txt

index 33e1d31e58745b96f97452c9defc80604908834c..bbad02ee4f7ee8cbc9d6b123e9f2b2564975ab6f 100644 (file)
@@ -229,3 +229,52 @@ PSR.ed     Unchanged.  Note: This bit could only have an effect if an fsys-mode
 PSR.bn Unchanged.  Note: fsys-mode handlers may clear the bit, if needed.
        Doing so requires clearing PSR.i and PSR.ic as well.
 PSR.ia Unchanged.  Note: the ia64 linux kernel never sets this bit.
+
+* Using fast system calls
+
+To use fast system calls, userspace applications need simply call
+__kernel_syscall_via_epc().  For example
+
+-- example fgettimeofday() call --
+-- fgettimeofday.S --
+
+#include <asm/asmmacro.h>
+
+GLOBAL_ENTRY(fgettimeofday)
+.prologue
+.save ar.pfs, r11
+mov r11 = ar.pfs
+.body 
+
+mov r2 = 0xa000000000020660;;  // gate address 
+                              // found by inspection of System.map for the 
+                              // __kernel_syscall_via_epc() function.  See
+                              // below for how to do this for real.
+
+mov b7 = r2
+mov r15 = 1087                // gettimeofday syscall
+;;
+br.call.sptk.many b6 = b7
+;;
+
+.restore sp
+
+mov ar.pfs = r11
+br.ret.sptk.many rp;;        // return to caller
+END(fgettimeofday)
+
+-- end fgettimeofday.S --
+
+In reality, getting the gate address is accomplished by two extra
+values passed via the ELF auxiliary vector (include/asm-ia64/elf.h)
+
+ o AT_SYSINFO : is the address of __kernel_syscall_via_epc()
+ o AT_SYSINFO_EHDR : is the address of the kernel gate ELF DSO
+
+The ELF DSO is a pre-linked library that is mapped in by the kernel at
+the gate page.  It is a proper ELF shared object so, with a dynamic
+loader that recognises the library, you should be able to make calls to
+the exported functions within it as with any other shared library.
+AT_SYSINFO points into the kernel DSO at the
+__kernel_syscall_via_epc() function for historical reasons (it was
+used before the kernel DSO) and as a convenience.