On Jul 22, 2012, at 5:07 PM, Steve Reinhardt wrote:
> 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?
I don't know. I know that at some point I committed this:
http://repo.m5sim.org/gem5/annotate/be2acdfb8bdc/src/arch/arm/process.cc#l374
Which must have fixed something. Part of the problem is also that there are two
ways to get an argument, don't mention the width and mention it. This is
certainly confusing.
>
> 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.
I'd have to go look at the prototype. I think part of the issue is that there
is some lack of consistancy as far at the kernel is considered. Sometimes on
32bit systems the prototypes are:
foo(uint32_t arg1, uint32_t arg2_high, uint32_t arg2_low, …)
while in other places there
foo(uint32_t arg1, uint64_t arg2)
which makes them different.
>
> 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 ;-).
+1
Ali
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev