On Fri Jul 18 22:05:32 EDT 2014, quans...@quanstro.net wrote:
> On Fri Jul 18 21:58:37 EDT 2014, cinap_len...@felloff.net wrote:
> > the amd64 compiler reserves R14 and R15 for extern register
> > declarations. these are used by the kernel for the mach
> > and up pointers, but currently are not preserved during
> > system calls.
> > 
> > would it make sense to save and restore the two registers
> > on syscall entry/exit, so userspace programs could make use
> > of them for per process data?
> 
> i think after some experience (i.e. mistakes) the answer is probablly, no.
> 
> the compiler needs to know for the kernel that r14 and r15 are special and
> not allocate them for the kernel, but what about userland?  what about 
> libraries
> that are shared between them? ....
> 
> one can work around these problems by compiling all libraries twice, etc.
> but these are painful compromises.
> 
> in reality, there is only one place in the code that i know of that chews
> through 15 or more registers, and that's the alpha drawing code in
> libmemdraw.  so the solution of just limiting the compiler to r0-r13
> seems to be pretty effective for what we're doing.

i realize i didn't quite answer the question as asked.  restoring
the registers is independent of the compiler.  so yes, you're right!  the 
registers
should be restored.  but at least you know why it's not a disaster that
they are not.

- erik

Reply via email to