- Change the commented out freebsd32_xxx() example to use kern_xxx() along
with a single copyin() + translate and translate + copyout() rather than using the stackgap. - Remove implementation of the stackgap for freebsd32 since it is no longer used for that compat ABI. Approved by: re (scottl)
This commit is contained in:
parent
cf418ce0f2
commit
62d0fed7ec
@ -1232,30 +1232,20 @@ int
|
||||
freebsd32_xxx(struct thread *td, struct freebsd32_xxx_args *uap)
|
||||
{
|
||||
int error;
|
||||
caddr_t sg;
|
||||
struct yyy32 *p32, s32;
|
||||
struct yyy *p = NULL, s;
|
||||
|
||||
p32 = uap->zzz;
|
||||
if (p32) {
|
||||
sg = stackgap_init();
|
||||
p = stackgap_alloc(&sg, sizeof(struct yyy));
|
||||
uap->zzz = (struct yyy32 *)p;
|
||||
error = copyin(p32, &s32, sizeof(s32));
|
||||
if (uap->zzz) {
|
||||
error = copyin(uap->zzz, &s32, sizeof(s32));
|
||||
if (error)
|
||||
return (error);
|
||||
/* translate in */
|
||||
error = copyout(&s, p, sizeof(s));
|
||||
if (error)
|
||||
return (error);
|
||||
p = &s;
|
||||
}
|
||||
error = xxx(td, (struct xxx_args *) uap);
|
||||
error = kern_xxx(td, p);
|
||||
if (error)
|
||||
return (error);
|
||||
if (p32) {
|
||||
error = copyin(p, &s, sizeof(s));
|
||||
if (error)
|
||||
return (error);
|
||||
if (uap->zzz) {
|
||||
/* translate out */
|
||||
error = copyout(&s32, p32, sizeof(s32));
|
||||
}
|
||||
|
@ -50,27 +50,3 @@ struct freebsd32_ps_strings {
|
||||
|
||||
#define FREEBSD32_PS_STRINGS \
|
||||
(FREEBSD32_USRSTACK - sizeof(struct freebsd32_ps_strings))
|
||||
|
||||
static __inline caddr_t stackgap_init(void);
|
||||
static __inline void *stackgap_alloc(caddr_t *, size_t);
|
||||
|
||||
static __inline caddr_t
|
||||
stackgap_init()
|
||||
{
|
||||
#define szsigcode (*(curproc->p_sysent->sv_szsigcode))
|
||||
return (caddr_t)(((caddr_t)FREEBSD32_PS_STRINGS) - szsigcode -
|
||||
SPARE_USRSPACE);
|
||||
#undef szsigcode
|
||||
}
|
||||
|
||||
static __inline void *
|
||||
stackgap_alloc(sgp, sz)
|
||||
caddr_t *sgp;
|
||||
size_t sz;
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = (void *) *sgp;
|
||||
*sgp += ALIGN(sz);
|
||||
return p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user