From: Philipp Rumpf <prumpf@inwestnet.de>
To: John Marvin <jsm@udlkern.fc.hp.com>
Cc: parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] Linux syscall ABI
Date: Tue, 15 Feb 2000 13:50:45 +0100 [thread overview]
Message-ID: <20000215135043.N765@abacus.local> (raw)
In-Reply-To: <200002150536.WAA04580@udlkern.fc.hp.com>; from jsm@udlkern.fc.hp.com on Mon, Feb 14, 2000 at 10:36:39PM -0700
> > kernel memcpy() shouldn't ever be called with either an IO or a user address
>
> I was referring to user space memcpy, not kernel memcpy. The HP-UX user
> space memcpy supports use with IO mapped addresses, however it has to
> differentiate those addresses in order to not do optimizations that won't
> work with IO mapped addresses. Having a dedicated range allows for an
> easy test. But perhaps if this is not desirable we can just say that
> Linux glibc memcpy is not supported for IO mapped addresses (assuming it
> is optimized).
This sounds to me like a typical case of doing a static optimization (is
this a memcpy() to I/O space, from I/O space, to and from I/O space) at
runtime.
> > > One disadvantage of this proposal is that we could not support the
> > > System V personality null pointer dereference behaviour. This maps
> > > a page of zero's at location 0 so that null pointer dereferences will
> > > return 0 for buggy software. Do we really still need to maintain this
> > > ancient hack?
> >
> > No, we don't. We're talking about PER_LINUX binaries here, and those
> > never expected to be able to dereference NULL pointers.
>
> I don't know much about PER_SVR4, and why it exists. Willy pointed it
> out to me. I can see from the kernel source that perhaps it is only there
> for sparc. If it is not necessary for parisc-linux to support then
> there is no issue. If it is necessary then I guess I assumed that PER_SVR4
> binaries would use the same gateway page as PER_LINUX binaries.
>
> > Of course every page in the region 0xfffc0000 - 0x3f fffc (it's a 17-bit
> > signed immediate shifted left 2 bits, so that should be -2^18 - 2^18-4)
> > can be used, so we just need a page within the first 256 KB.
>
> This is true for user space. For kernel space, I don't think we can
> use anything in F space, unless we map the real IO addresses somewhere
> else in virtual space.
That's what I meant by "within the first 256 KB". ble <offset>(srX, r0)
gives us the range 0xfffc0000 - 0x3 fffc, we can't use 0xfffc0000 - 0xfffffff,
so we're limited to the first 256 KB.
> I'm not sure what assumptions are being made
> right now regarding that mapping in the drivers.
Mapping the I/O space to 0xf000 0000 - 0xffff ffff would make sense, IMO, and
shouldn't be a problem with our drivers.
> I was also thinking that we may want to eventually map physical addresses
> directly (with no offset) to virtual addresses, in order to support the
> maximum amount of physical memory.
We agreed upon doing this eventually, didn't we ?
> But Perhaps we can have a 16 Mb offset instead.
I think not mapping the first 64 KB and making a copy of page 0 somewhere
else would make sense. Then we could use the first 64 KB of the virtual
address space to implement gateway pages.
> > a variety of reasons why it might not be available long term) the
> > > sequence could be shortened to:
> > >
> > > mtsp %r0,%sr0
> > > ble <gateway offset>(%sr0,%r0)
> > > ldi <syscall #>,%r20
> >
> > In fact, what's wrong with shortening _this_ sequence to
> >
> > ble <gateway offset)(%sr2, %r0)
> > ldi <syscall #>,%r20
> >
> > and teaching userspace to not modify sr2 ?
>
> I like this idea. The only disadvantage is that if the user modifies sr2
> by mistake, all of a sudden all of the syscalls stop working (for that
> process only).
I don't see a real problem with that. Modifying SR2 requires either direct
modification (the only code I could see doing that is HP/UX code, which isn't
supposed to execute with PER_LINUX anytime soon) or executing random bytes,
which will always break in unexpected ways.
> It might be hard to debug. But, as long as we make sure that gcc never
> touches sr2, there should be almost no legitimate reason to
> play with space registers in the user address space for Linux processes,
> since we are going to have sr4=sr5=sr6=sr7. In fact, gcc should be
> modified to stop using $$dyncall for indirect function pointer calls. So,
There is an option for that. Something along the lines of "fast function
calls" (I'll have a look lateron).
> Now, I am assuming we would set sr2 to 0 and locate the gateway page in
> the kernel address space if we chose this proposal. But this idea has the
> flexibility of allowing us to move the gateway page into another space
> completely if we ever need to (would require modifications to the tlb miss
> handler). It also has the interesting feature that a programmer could set
> sr2 to point into the user address space, and if we choose an offset for
> the gateway page in the kernel address space and make that offset also
> available for mmap in the user address space, the user could place there
> own page at the gateway offset in user space and intercept all syscalls
> (there are other ways of doing this, but I just thought it was
> interesting).
I agree this would be another point in favour of using 0:0 or 0:0x1000 as
default gateway page.
Philipp
next prev parent reply other threads:[~2000-02-15 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-15 5:36 [parisc-linux] Linux syscall ABI John Marvin
2000-02-15 6:15 ` willy
2000-02-15 12:50 ` Philipp Rumpf [this message]
2000-02-16 14:04 ` [parisc-linux] Location of HIL protocol docs? Brian S. Julin
2000-02-16 18:42 ` Grant Grundler
2000-02-15 17:25 ` [parisc-linux] Linux syscall ABI Grant Grundler
2000-02-15 18:18 ` Philipp Rumpf
2000-02-15 19:15 ` Frank Rowand
2000-02-16 2:34 ` Grant Grundler
2000-02-16 9:33 ` Kirk Bresniker
-- strict thread matches above, loose matches on Subject: below --
2000-02-17 14:17 John Marvin
2000-02-16 13:57 John Marvin
2000-02-16 17:41 ` Philipp Rumpf
2000-02-14 9:30 John Marvin
2000-02-14 13:34 ` Philipp Rumpf
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=20000215135043.N765@abacus.local \
--to=prumpf@inwestnet.de \
--cc=jsm@udlkern.fc.hp.com \
--cc=parisc-linux@thepuffingroup.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.