Subject: Re: v1.2 Questions
To: Wolfgang Solfrank <ws@kurt.tools.de>
From: Mark Brinicombe <amb@physig4.ph.kcl.ac.uk>
List: port-arm32
Date: 08/29/1996 19:04:26
>Hmm, I don't know whether I get this. Are you saying that the FPE core has an
>entry point to be called on context switch that saves/restores registers, but
>doesn't do so for the FPCR? This would be very strange, I think.

I need to wade through the source again to 100% verify this for all cases
(Unless Neil know the answer already) but :

core functions like fpe_core_savecontext() and fpe_core_loadcontext()
do not save and load FPCR only f0-f7 and FPSR.

Now I do also use fpe_core_changecontext and this, rather than copying an
entire context just switches context pointers I believe. However it is not
clear to be yet whether this context includes the the FPCR. If it does then
this means that the FPCR may be in the cores internal context but not in the
external context.

Note: the core does require a chunk of global workspace fore data so there are
places it could store a global FPCR...

To copy a context the you use fpe_core_savecontext() and then
fpe_core_loadcontext(). This will (no matter what the core does internally)
mean that the FPCR is not copied on a context copy i.e. during fork()

Part of the problem is that there are two contexts that are used.
The internal context in core specific. The kernel sees this as just a pointer
to the internal context. The structure of the internal context is not know and
will vary depending on the configuration of the FPE core. Basically I know that
a internal context is X bytes long. Within that context pointers may be stored
so this context cannot just be copied etc. by code out side the core.

The external context is much simpler and has a defined struture that is
consistant between CORE versions. i.e F0-F7 and FPSR. The proceedure for
copying contexts and extracting values directly from a context is to save it
in this external form, modify it and reload it.

For example this is what GDB does via the ptrace(PT_[SG]ETFPREGS,...) but
is also the only known way to copy a context.

As a matter of interest what did RISCiX do ? The obvious thought is that it
would have had the same problem. However the FPE that was used then has changed
considerably since then.

I suspect that there may be ways round the problem if I did not treat the FPE
core as a black box but rather as a grey one ..
The idea was not to touch anything in the core or assume anything about the
core
other that the standardly defined entry points. This allows us to slot in new
versions of the FPE without having to make any changes.

Cheers,
				Mark



-- 
Mark Brinicombe				amb@physig.ph.kcl.ac.uk
Research Associate			http://www.ph.kcl.ac.uk/~amb/
Department of Physics			tel: 0171 873 2894
King's College London			fax: 0171 873 2716