From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 18 Jul 2014 22:19:11 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: <3e0dba73883c8b291a66366c9ebe150d@ladd.quanstro.net> References: <3e0dba73883c8b291a66366c9ebe150d@ladd.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] extern register Topicbox-Message-UUID: 0628c048-ead9-11e9-9d60-3106f5b1d025 On Fri Jul 18 22:05:32 EDT 2014, quanstro@quanstro.net wrote: > On Fri Jul 18 21:58:37 EDT 2014, cinap_lenrek@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