Subject: Re: Emulations as LKM (final)
To: =?X-UNKNOWN?Q?Jarom=EDr_Dolecek?= <dolecek@ics.muni.cz>
From: Matthew Orgass <darkstar@pgh.net>
List: tech-kern
Date: 12/02/2000 23:34:13
On Thu, 30 Nov 2000, Jarom=EDr Dolecek wrote:

> * foo_emul_path (emulation path, like "/emul/ibcs2") is now part of
> struct emul;
> =09CHECK_ALT_{EXIST|CREAT}
> =09changed to use that via p->p_emul->e_path, FOO_CHECK_ALT_{EXIST|CREATE=
}
> =09eliminated; where not applicable

  Note that this means that an extra struct proc lookup is used to access
constant data (although it looks like this is already done plenty in other
places so this is not really a complaint against your code).  If each
emulation's files defined THIS_EMUL to point to the appropriate struct
emul, a number of things could be made constant easily.  Ideally, pathname
lookup would be generalized so that emulations do not need to use stubs
just to do the extra lookup.

> * there is a pointer to syscall function in struct emul; MD code
>   needs to be changed to call the function if the pointer is not null;
>   the syscall() split is done for i386 as example

  Always separating syscall code (shared with inline functions) would
allow p->p_emul and any flags to be constant for each emulation
(EMUL_HAS_SYS___syscall would just be a function flag that would optimize
in or out for each caller).  The main syscall() would then always call the
emulation function.  This would also remove the need for e_nosys,
e_nsysent, e_sysent, e_syscallnames, and e_errno from struct emul.  With
always separate signal code (which may be the case already), e_sigcode and
e_esigcode would not be necessary.

  usrret() should be placed in a header instead of being copied into the
separate emulation syscall files.

  Emulation specific files should go under sys/compat/*/arch instead of
sys/arch.  If it is considered desireable to keep the MD compat code under
sys/arch, then sys/arch/*/compat/* should be created with all MD files.

Matthew Orgass
darkstar@pgh.net