From c639ca93f4bd7ea4c0d091e0a56d3c3c753f679b Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Fri, 22 Aug 2003 23:19:02 +0000 Subject: [PATCH] Initial sweep at dividing up the generic 32bit-on-64bit kernel support from the ia32 specific stuff. Some of this still needs to move to the MI freebsd32 area, and some needs to move to the MD area. This is still work-in-progress. --- sys/amd64/ia32/ia32_sigtramp.S | 1 + sys/compat/ia32/ia32_genassym.c | 2 +- sys/compat/ia32/ia32_sigtramp.S | 1 + sys/compat/ia32/ia32_sysvec.c | 9 +++--- sys/compat/ia32/ia32_util.h | 51 +-------------------------------- 5 files changed, 9 insertions(+), 55 deletions(-) diff --git a/sys/amd64/ia32/ia32_sigtramp.S b/sys/amd64/ia32/ia32_sigtramp.S index 2e9f73d41bce..0387cb7f34f7 100644 --- a/sys/amd64/ia32/ia32_sigtramp.S +++ b/sys/amd64/ia32/ia32_sigtramp.S @@ -37,6 +37,7 @@ .code32 /* * Signal trampoline, copied to top of user stack + * XXX may need to be MD to match backend sendsig handoff protocol */ ALIGN_TEXT .globl ia32_sigcode diff --git a/sys/compat/ia32/ia32_genassym.c b/sys/compat/ia32/ia32_genassym.c index d356714007fc..ef49c3aadae4 100644 --- a/sys/compat/ia32/ia32_genassym.c +++ b/sys/compat/ia32/ia32_genassym.c @@ -8,7 +8,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include ASSYM(IA32_SIGF_HANDLER, offsetof(struct ia32_sigframe, sf_ah)); ASSYM(IA32_SIGF_UC, offsetof(struct ia32_sigframe, sf_uc)); diff --git a/sys/compat/ia32/ia32_sigtramp.S b/sys/compat/ia32/ia32_sigtramp.S index 2e9f73d41bce..0387cb7f34f7 100644 --- a/sys/compat/ia32/ia32_sigtramp.S +++ b/sys/compat/ia32/ia32_sigtramp.S @@ -37,6 +37,7 @@ .code32 /* * Signal trampoline, copied to top of user stack + * XXX may need to be MD to match backend sendsig handoff protocol */ ALIGN_TEXT .globl ia32_sigcode diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index cfd7d3522ffb..a8426c94417c 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -79,11 +79,11 @@ static register_t *ia32_copyout_strings(struct image_params *imgp); static void ia32_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); -extern struct sysent ia32_sysent[]; +extern struct sysent freebsd32_sysent[]; struct sysentvec ia32_freebsd_sysvec = { SYS_MAXSYSCALL, - ia32_sysent, + freebsd32_sysent, 0, 0, NULL, @@ -124,8 +124,7 @@ SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t) elf32_insert_brand_entry, &ia32_brand_info); -extern int _ucode32sel, _udatasel; - +/* XXX may be freebsd32 MI */ static register_t * ia32_copyout_strings(struct image_params *imgp) { @@ -232,7 +231,9 @@ ia32_copyout_strings(struct image_params *imgp) /* * Clear registers on exec + * XXX backend MD */ +extern int _ucode32sel, _udatasel; void ia32_setregs(td, entry, stack, ps_strings) struct thread *td; diff --git a/sys/compat/ia32/ia32_util.h b/sys/compat/ia32/ia32_util.h index 64fa29320ca8..06f78cf00619 100644 --- a/sys/compat/ia32/ia32_util.h +++ b/sys/compat/ia32/ia32_util.h @@ -37,53 +37,4 @@ #include #include -struct ia32_ps_strings { - u_int32_t ps_argvstr; /* first of 0 or more argument strings */ - int ps_nargvstr; /* the number of argument strings */ - u_int32_t ps_envstr; /* first of 0 or more environment strings */ - int ps_nenvstr; /* the number of environment strings */ -}; - -#define IA32_USRSTACK ((1ul << 32) - PAGE_SIZE) -#define IA32_PS_STRINGS (IA32_USRSTACK - sizeof(struct ia32_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)IA32_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; -} - - -extern const char ia32_emul_path[]; -int ia32_emul_find(struct thread *, caddr_t *, const char *, char *, - char **, int); - -#define CHECKALT(p, sgp, path, i) \ - do { \ - int _error; \ - \ - _error = ia32_emul_find(p, sgp, ia32_emul_path, path, \ - &path, i); \ - if (_error == EFAULT) \ - return (_error); \ - } while (0) - -#define CHECKALTEXIST(p, sgp, path) CHECKALT((p), (sgp), (path), 0) -#define CHECKALTCREAT(p, sgp, path) CHECKALT((p), (sgp), (path), 1) +#define FREEBSD32_USRSTACK ((1ul << 32) - PAGE_SIZE)