On Sun, Jul 22, 2012 at 8:28 AM, Ali Saidi <[email protected]> wrote:

>
> On Jul 21, 2012, at 11:51 AM, Steve Reinhardt wrote:
>
> > The big question here is whether anyone knows of any other syscalls or
> > architectures that might need this more powerful stack handling scheme;
> if
> > so, we should probably go with the first approach.  If not, I'm open to
> the
> > second approach.  If someone feels like the current scheme is good
> enough,
> > or there's a third approach I haven't considered, please speak up.  I'd
> > like to get some initial consensus here before I go ripping things up.
>
> For ARM we certainly need to be able to do the 64 bit alignment (64 bit
> args are passed starting in even registers only). So a prototype (badly
> constructed imho) foo(uint32_t a1, uint64 a2) needs to get arg1 from r0 and
> a2 from r2:r3. There seem to be a couple of these case in ARM.
>

(Sorry for the premature send... my fingers thought I was in emacs and I
hit some control key sequence, I think.)

Thanks for info, Ali.  Are these syscalls that are currently unsupported,
or did I miss them somewhere?

It's still not clear to me whether we want to beef up the current "magic"
approach to make it cleaner magic, or fall back to the original dirt simple
method and handle these things manually.  In fact I just noticed that we
already handle llseek in a manual fashion, with an _llseekFunc that does
this:

SyscallReturn
_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
    int index = 0;
    int fd = p->sim_fd(p->getSyscallArg(tc, index));
    uint64_t offset_high = p->getSyscallArg(tc, index);
    uint32_t offset_low = p->getSyscallArg(tc, index);
    Addr result_ptr = p->getSyscallArg(tc, index);
    int whence = p->getSyscallArg(tc, index);

    uint64_t offset = (offset_high << 32) | offset_low;

    uint64_t result = lseek(fd, offset, whence);
    [...]
}

It appears that this is probably broken on ARM, since I expect it gets the
two parts of offset from r1:r2 and not r2:r3, so we probably need a third
version (in addition to this one and the native 64-bit one).  Nevertheless,
we could do this kind of thing for all the syscalls with 64-bit args, and
factor out common code to make it a little cleaner.

Of course, all of this would be easier if we had a nice comprehensive test
suite so we knew if we were getting things right or breaking them as we
made these changes ;-).

Steve
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to