sh: Make getopts memory-safe if with changing arguments.

POSIX does not permit to continuing a getopts loop with different
arguments. For parsing the positional parameters, we handle this case by
resetting the getopts state when the positional parameters are changed in
any way (and the getopts state is local to a function). However, in the
syntax getopts <optstring> <var> <arg...>, changes could lead to invalid
memory access.

In the syntax getopts <optstring> <var> <arg...>, store a copy of the
arguments and continue to use them until getopts is reset.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@273700 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
By the time that pmap_init() runs, vm_phys_segs[] has been initialized.  Obtaining
the end of memory address from vm_phys_segs[] is a little easier than obtaining it
from phys_avail[].

Discussed with:	Svatopluk Kraus


git-svn-id: svn+ssh://svn.freebsd.org/base/head@273701 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove incorrect semicolon.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@273702 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f