[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200609130003.12789.arnd@arndb.de>
Date: Wed, 13 Sep 2006 00:03:12 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Phillip Susi <psusi@....rr.com>
Cc: David Woodhouse <dwmw2@...radead.org>, guest01 <guest01@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: OT: calling kernel syscall manually
On Tuesday 12 September 2006 22:25, Phillip Susi wrote:
>
> What do you mean you have removed the ability to make system calls
> directly? That makes no sense. Glibc has to be able to make system
> calls so you can write your own code that does the same thing if you want.
the header file <asm/unistd.h> that used to provide the necessary _syscallX()
macros doesn't do that any more. You can still use your own copy of the
macros though, like every libc does internally.
> For the OP: you might want to study the glibc sources to see how it
> implements syscall, and mimic that. IIRC it involves making an int 80
> call on i386.
>
char *pathname = "/tmp/dir";
int mode = 0644;
int result;
__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
: "=a" (result)
: "0" (__NR_mkdir),"ri" (pathname),"c" (mode)
: "memory");
Understanding that inline assembly in detail is beyond what most people
do at university, but interesting nonetheless.
Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists