This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: newlib on x86-64
Hello Neil,
The code looks fine to me. You can check it in if nobody objects to
it. I myself cannot check code in.
We use a different approach in our own OS. You can let the hardware
switch to an interrupt stack. In that way the red zones will remain
the same. You can read chapter 5.14 of this Intel 'Bible':
http://download.intel.com/design/processor/manuals/253668.pdf.
Regards,
Hans Kester
On Wed, Feb 4, 2009 at 5:15 AM, Neal H. Walfield <neal@walfield.org> wrote:
> Attached is a patch for memcpy.S. memset.S and setjmp.S don't use the
> red zone. I think that is actually all of the x86-64 assembly. Am I
> missing something?
>
> Neal
>
> 2009-02-04 Neal H. Walfield <neal@gnu.org>
>
> * libc/machine/x86_64/memcpy.S (memcpy): Don't use the red zone.
>
> diff -c newlib/libc/machine/x86_64/memcpy.S\~ newlib/libc/machine/x86_64/memcpy.S
> --- newlib/libc/machine/x86_64/memcpy.S~ 2007-08-28 23:56:49.000000000 +0200
> +++ newlib/libc/machine/x86_64/memcpy.S 2009-02-04 05:07:51.000000000 +0100
> @@ -30,10 +30,10 @@
> cmpq $256, rdx
> jb quadword_copy
>
> - movq rax, -8 (rsp)
> - movq r12, -16 (rsp)
> - movq r13, -24 (rsp)
> - movq r14, -32 (rsp)
> + pushq rax
> + pushq r12
> + pushq r13
> + pushq r14
>
> movq rdx, rcx /* Copy 128 bytes at a time with minimum cache polution */
> shrq $7, rcx
> @@ -89,10 +89,10 @@
> movq rdx, rcx
> andq $127, rcx
> rep movsb
> - movq -8 (rsp), rax
> - movq -16 (rsp), r12
> - movq -24 (rsp), r13
> - movq -32 (rsp), r14
> + popq r14
> + popq r13
> + popq r12
> + popq rax
> ret
>
>
>
>