From: "Petr Vandrovec" <VANDROVE@vc.cvut.cz>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: dvorak <dvorak@xs4all.nl>, linux-kernel@vger.kernel.org
Subject: Re: Syscall changes registers beyond %eax, on linux-i386
Date: Thu, 19 Sep 2002 19:44:27 +0200 [thread overview]
Message-ID: <24181C771D3@vcnet.vc.cvut.cz> (raw)
On 19 Sep 02 at 13:22, Richard B. Johnson wrote:
> > >>A short snippet of sys_poll, with irrelavant data removed.
> > >>
> > >>sys_poll(struct pollfd *ufds, .. , ..) {
> > >> ...
> > >> ufds++;
> > >> ...
>
> Well which one? Here is an ioctl(). It certainly modifies one
> of its parameter values.
poll(), as was already noted. Program below should
print same value for B= and F=, but it reports f + 8*c instead
(where c = number of filedescriptors passed to poll).
And you must call it from assembly, as your calls to getpid() or
ioctl() (or poll()) are wrapped in libc - and glibc's code begins with
push %ebx because of %ebx is used by -fPIC code.
It is questinable whether we should try to not modify parameters
passed into functions. It is definitely nice behavior, but I think
that we should only guarantee that syscalls do not modify unused
registers.
Petr Vandrovec
vandrove@vc.cvut.cz
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/poll.h>
struct pollfd f[5];
int main(int argc, char* argv[]) {
unsigned int i;
void * reg;
for (i = 0; i < 5; i++) {
f[i].fd = 0;
f[i].events = POLLIN;
}
__asm__ __volatile__("int $0x80\n" : "=b"(reg) : "a"(168), "0"(f), "c"(5), "d"(1));
printf("B=%p F=%p\n", reg, f);
return 0;
}
next reply other threads:[~2002-09-19 17:39 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-19 17:44 Petr Vandrovec [this message]
2002-09-19 18:04 ` Syscall changes registers beyond %eax, on linux-i386 Brian Gerst
2002-09-19 18:30 ` Richard Henderson
2002-09-19 18:51 ` Brian Gerst
2002-09-19 18:57 ` Richard Henderson
2002-09-19 19:40 ` Richard B. Johnson
2002-09-19 19:41 ` Richard Henderson
2002-09-19 19:53 ` Richard B. Johnson
2002-09-19 22:46 ` J.A. Magallon
2002-09-20 12:27 ` Richard B. Johnson
2002-09-20 17:16 ` Richard Henderson
2002-09-22 1:33 ` Pavel Machek
2002-09-23 13:11 ` Richard B. Johnson
2002-09-23 18:31 ` Pavel Machek
2002-09-19 19:18 ` Richard B. Johnson
2002-09-19 19:24 ` Daniel Jacobowitz
2002-09-19 20:25 ` Mikael Pettersson
2002-09-20 8:32 ` george anzinger
2002-09-21 6:19 ` Richard Henderson
2002-09-21 8:09 ` george anzinger
2002-09-21 15:08 ` Richard Henderson
2002-09-24 18:02 ` CHECKER bate: " george anzinger
-- strict thread matches above, loose matches on Subject: below --
2002-09-19 14:45 dvorak
2002-09-19 16:11 ` Richard B. Johnson
2002-09-19 17:09 ` Brian Gerst
2002-09-19 17:22 ` Richard B. Johnson
2002-09-19 17:51 ` Brian Gerst
2002-09-19 18:30 ` Richard B. Johnson
2002-09-19 17:59 ` dvorak
2002-09-19 18:32 ` Richard B. Johnson
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=24181C771D3@vcnet.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=dvorak@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.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