From: Arnd Bergmann <arnd@arndb.de>
To: Phillip Susi <psusi@cfl.rr.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
guest01 <guest01@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: OT: calling kernel syscall manually
Date: Wed, 13 Sep 2006 00:03:12 +0200 [thread overview]
Message-ID: <200609130003.12789.arnd@arndb.de> (raw)
In-Reply-To: <450717A5.90509@cfl.rr.com>
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 <><
next prev parent reply other threads:[~2006-09-12 22:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-12 12:05 guest01
2006-09-12 13:34 ` David Woodhouse
2006-09-12 14:31 ` guest01
2006-09-12 14:37 ` David Woodhouse
2006-09-12 20:25 ` Phillip Susi
2006-09-12 20:46 ` Miguel Ojeda
2006-09-12 22:03 ` Arnd Bergmann [this message]
2006-09-12 22:43 ` David Woodhouse
2006-09-13 16:52 ` guest01
2006-09-13 17:52 ` David Woodhouse
2006-09-13 5:35 Albert Cahalan
2006-09-13 6:55 ` David Woodhouse
2006-09-13 15:52 ` Albert Cahalan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200609130003.12789.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=dwmw2@infradead.org \
--cc=guest01@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=psusi@cfl.rr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®