Page MenuHomeFreeBSD

Make powerpc use MAXARGS instead of hardcoding '10'
ClosedPublic

Authored by trasz on Sep 30 2020, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 18 2024, 4:23 AM
Unknown Object (File)
Sep 5 2024, 10:58 PM
Unknown Object (File)
Sep 4 2024, 12:10 PM
Unknown Object (File)
Aug 22 2024, 1:59 AM
Unknown Object (File)
Aug 12 2024, 10:15 AM
Unknown Object (File)
Aug 6 2024, 8:20 AM
Unknown Object (File)
Aug 1 2024, 1:33 AM
Unknown Object (File)
Jun 30 2024, 8:49 PM

Details

Summary

Make powerpc use MAXARGS instead of hardcoding '10'. Note that
MAXARGS is 8; no idea where the 10 came from.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

It comes from the Book-E syscall. See the changes to sys/powerpc/booke/trap.c in rS208453 -- it uses two more args than AIM.

As to whether THAT was correct at the time, I am unsure.

It does look like it was intentionally done at the time, due to there being code that explicitly copies in more arguments from the user stack frame if sy_narg goes over 8.

and indeed, the code to do so still exists in cpu_fetch_syscall_args().

So, despite there only being 8 actual registers involved, the system still supports more parameters than that using the normal rules for storing overflow parameters in the stack frame.

I believe the necessity for this is for SYS___syscall. It burns *two* registers on 32-bit for alignment reasons.

In my understanding sy_narg cannot be more than MAXARGS, which is generally 8. I'd say it's highly unlikely we'll ever support more syscall arguments, even now there are at most 7. But to the point: SYS__syscall indeed looks like wasting two registers, but I don't see how it affects struct syscall_args: the array contents are the arguments to MI syscall functions (eg sys_open()). In other words, SYS__syscall affects how the arguments are passed from userspace, but not how they get passed from cpu_fetch_syscall_args() to the actual sys_whatever(). Right?

This comment was removed by trasz.

I think you might be right, at most args[6] and args[7] would be subject to being pulled from the argument overflow area of the stack frame rather than the registers, assuming an 8 parameter syscall going through SYS___syscall, and they are filled in to args at their final positions instead of their raw positions.

Seems fine to me. It's consistent with all other archs.

This revision is now accepted and ready to land.Nov 3 2020, 10:21 PM