summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-06-29 15:16:20 +0000
committerjhb <jhb@FreeBSD.org>2005-06-29 15:16:20 +0000
commit62d0fed7ecd50977971467ed1288cad1e358a7c3 (patch)
treebaf25e51834c29888c751b5e4032cca417ff49fa /sys/compat
parentcf418ce0f29135fb0c720b62e820828b6a89c380 (diff)
downloadFreeBSD-src-62d0fed7ecd50977971467ed1288cad1e358a7c3.zip
FreeBSD-src-62d0fed7ecd50977971467ed1288cad1e358a7c3.tar.gz
- 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)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c20
-rw-r--r--sys/compat/freebsd32/freebsd32_util.h24
2 files changed, 5 insertions, 39 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 940da4e..d21ced6 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -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));
}
diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h
index 1b05e99..fadbeb4 100644
--- a/sys/compat/freebsd32/freebsd32_util.h
+++ b/sys/compat/freebsd32/freebsd32_util.h
@@ -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;
-}
OpenPOWER on IntegriCloud