From e64f71f812324d098bed12ed68c2bc1d6e780c90 Mon Sep 17 00:00:00 2001 From: samuel Date: Sat, 24 Nov 2018 11:35:29 +0000 Subject: Change Makefile rule for assembly to use .S rather than .s It is more conventional to use compiler to pre-process and assemble the `.S` file rather than forcing Makefile to use `.s`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- coroutine/amd64/Context.S | 42 ++++++++++++++++++++++++++ coroutine/amd64/Context.s | 42 -------------------------- coroutine/arm32/Context.S | 14 +++++++++ coroutine/arm32/Context.s | 14 --------- coroutine/arm64/Context.S | 59 ++++++++++++++++++++++++++++++++++++ coroutine/arm64/Context.s | 59 ------------------------------------ coroutine/win64/Context.S | 77 +++++++++++++++++++++++++++++++++++++++++++++++ coroutine/win64/Context.s | 77 ----------------------------------------------- coroutine/x86/Context.S | 39 ++++++++++++++++++++++++ coroutine/x86/Context.s | 39 ------------------------ 10 files changed, 231 insertions(+), 231 deletions(-) create mode 100644 coroutine/amd64/Context.S delete mode 100644 coroutine/amd64/Context.s create mode 100644 coroutine/arm32/Context.S delete mode 100644 coroutine/arm32/Context.s create mode 100644 coroutine/arm64/Context.S delete mode 100644 coroutine/arm64/Context.s create mode 100644 coroutine/win64/Context.S delete mode 100644 coroutine/win64/Context.s create mode 100644 coroutine/x86/Context.S delete mode 100644 coroutine/x86/Context.s (limited to 'coroutine') diff --git a/coroutine/amd64/Context.S b/coroutine/amd64/Context.S new file mode 100644 index 0000000000..641bd016ab --- /dev/null +++ b/coroutine/amd64/Context.S @@ -0,0 +1,42 @@ +## +## This file is part of the "Coroutine" project and released under the MIT License. +## +## Created by Samuel Williams on 10/5/2018. +## Copyright, 2018, by Samuel Williams. All rights reserved. +## + +.text + +# For older linkers +.globl _coroutine_transfer +_coroutine_transfer: + +.globl coroutine_transfer +coroutine_transfer: + # Save caller state + pushq %rbp + pushq %rbx + pushq %r12 + pushq %r13 + pushq %r14 + pushq %r15 + + # Save caller stack pointer + movq %rsp, (%rdi) + + # Restore callee stack pointer + movq (%rsi), %rsp + + # Restore callee stack + popq %r15 + popq %r14 + popq %r13 + popq %r12 + popq %rbx + popq %rbp + + # Put the first argument into the return value + movq %rdi, %rax + + # We pop the return address and jump to it + ret diff --git a/coroutine/amd64/Context.s b/coroutine/amd64/Context.s deleted file mode 100644 index 641bd016ab..0000000000 --- a/coroutine/amd64/Context.s +++ /dev/null @@ -1,42 +0,0 @@ -## -## This file is part of the "Coroutine" project and released under the MIT License. -## -## Created by Samuel Williams on 10/5/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. -## - -.text - -# For older linkers -.globl _coroutine_transfer -_coroutine_transfer: - -.globl coroutine_transfer -coroutine_transfer: - # Save caller state - pushq %rbp - pushq %rbx - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - - # Save caller stack pointer - movq %rsp, (%rdi) - - # Restore callee stack pointer - movq (%rsi), %rsp - - # Restore callee stack - popq %r15 - popq %r14 - popq %r13 - popq %r12 - popq %rbx - popq %rbp - - # Put the first argument into the return value - movq %rdi, %rax - - # We pop the return address and jump to it - ret diff --git a/coroutine/arm32/Context.S b/coroutine/arm32/Context.S new file mode 100644 index 0000000000..c2b93d0a34 --- /dev/null +++ b/coroutine/arm32/Context.S @@ -0,0 +1,14 @@ +## +## This file is part of the "Coroutine" project and released under the MIT License. +## +## Created by Samuel Williams on 10/5/2018. +## Copyright, 2018, by Samuel Williams. All rights reserved. +## + +.text + +.globl coroutine_transfer +coroutine_transfer: + stmia r1!, {r4-r11,sp,lr} + ldmia r0!, {r4-r11,sp,pc} + bx lr diff --git a/coroutine/arm32/Context.s b/coroutine/arm32/Context.s deleted file mode 100644 index c2b93d0a34..0000000000 --- a/coroutine/arm32/Context.s +++ /dev/null @@ -1,14 +0,0 @@ -## -## This file is part of the "Coroutine" project and released under the MIT License. -## -## Created by Samuel Williams on 10/5/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. -## - -.text - -.globl coroutine_transfer -coroutine_transfer: - stmia r1!, {r4-r11,sp,lr} - ldmia r0!, {r4-r11,sp,pc} - bx lr diff --git a/coroutine/arm64/Context.S b/coroutine/arm64/Context.S new file mode 100644 index 0000000000..f6e5f0a6bc --- /dev/null +++ b/coroutine/arm64/Context.S @@ -0,0 +1,59 @@ +## +## This file is part of the "Coroutine" project and released under the MIT License. +## +## Created by Samuel Williams on 10/5/2018. +## Copyright, 2018, by Samuel Williams. All rights reserved. +## + +.text +.align 2 + +.global coroutine_transfer +coroutine_transfer: + + # Make space on the stack for caller registers + sub sp, sp, 0xb0 + + # Save caller registers + stp d8, d9, [sp, 0x00] + stp d10, d11, [sp, 0x10] + stp d12, d13, [sp, 0x20] + stp d14, d15, [sp, 0x30] + stp x19, x20, [sp, 0x40] + stp x21, x22, [sp, 0x50] + stp x23, x24, [sp, 0x60] + stp x25, x26, [sp, 0x70] + stp x27, x28, [sp, 0x80] + stp x29, x30, [sp, 0x90] + + # Save return address + str x30, [sp, 0xa0] + + # Save stack pointer to x0 (first argument) + mov x2, sp + str x2, [x0, 0] + + # Load stack pointer from x1 (second argument) + ldr x3, [x1, 0] + mov sp, x3 + + # Restore caller registers + ldp d8, d9, [sp, 0x00] + ldp d10, d11, [sp, 0x10] + ldp d12, d13, [sp, 0x20] + ldp d14, d15, [sp, 0x30] + ldp x19, x20, [sp, 0x40] + ldp x21, x22, [sp, 0x50] + ldp x23, x24, [sp, 0x60] + ldp x25, x26, [sp, 0x70] + ldp x27, x28, [sp, 0x80] + ldp x29, x30, [sp, 0x90] + + # Load return address into x4 + ldr x4, [sp, 0xa0] + + # Pop stack frame + add sp, sp, 0xb0 + + # Jump to return address (in x4) + ret x4 diff --git a/coroutine/arm64/Context.s b/coroutine/arm64/Context.s deleted file mode 100644 index f6e5f0a6bc..0000000000 --- a/coroutine/arm64/Context.s +++ /dev/null @@ -1,59 +0,0 @@ -## -## This file is part of the "Coroutine" project and released under the MIT License. -## -## Created by Samuel Williams on 10/5/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. -## - -.text -.align 2 - -.global coroutine_transfer -coroutine_transfer: - - # Make space on the stack for caller registers - sub sp, sp, 0xb0 - - # Save caller registers - stp d8, d9, [sp, 0x00] - stp d10, d11, [sp, 0x10] - stp d12, d13, [sp, 0x20] - stp d14, d15, [sp, 0x30] - stp x19, x20, [sp, 0x40] - stp x21, x22, [sp, 0x50] - stp x23, x24, [sp, 0x60] - stp x25, x26, [sp, 0x70] - stp x27, x28, [sp, 0x80] - stp x29, x30, [sp, 0x90] - - # Save return address - str x30, [sp, 0xa0] - - # Save stack pointer to x0 (first argument) - mov x2, sp - str x2, [x0, 0] - - # Load stack pointer from x1 (second argument) - ldr x3, [x1, 0] - mov sp, x3 - - # Restore caller registers - ldp d8, d9, [sp, 0x00] - ldp d10, d11, [sp, 0x10] - ldp d12, d13, [sp, 0x20] - ldp d14, d15, [sp, 0x30] - ldp x19, x20, [sp, 0x40] - ldp x21, x22, [sp, 0x50] - ldp x23, x24, [sp, 0x60] - ldp x25, x26, [sp, 0x70] - ldp x27, x28, [sp, 0x80] - ldp x29, x30, [sp, 0x90] - - # Load return address into x4 - ldr x4, [sp, 0xa0] - - # Pop stack frame - add sp, sp, 0xb0 - - # Jump to return address (in x4) - ret x4 diff --git a/coroutine/win64/Context.S b/coroutine/win64/Context.S new file mode 100644 index 0000000000..4b16e0ce8c --- /dev/null +++ b/coroutine/win64/Context.S @@ -0,0 +1,77 @@ +## +## This file is part of the "Coroutine" project and released under the MIT License. +## +## Created by Samuel Williams on 4/11/2018. +## Copyright, 2018, by Samuel Williams. All rights reserved. +## + +.text + +.globl coroutine_transfer +coroutine_transfer: + # Save the thread information block: + pushq %gs:8 + pushq %gs:16 + + # Save caller registers: + pushq %rbp + pushq %rbx + pushq %rdi + pushq %rsi + pushq %r12 + pushq %r13 + pushq %r14 + pushq %r15 + + movaps %xmm15, -168(%rsp) + movaps %xmm14, -152(%rsp) + movaps %xmm13, -136(%rsp) + movaps %xmm12, -120(%rsp) + movaps %xmm11, -104(%rsp) + movaps %xmm10, -88(%rsp) + movaps %xmm9, -72(%rsp) + movaps %xmm8, -56(%rsp) + movaps %xmm7, -40(%rsp) + movaps %xmm6, -24(%rsp) + + # Save caller stack pointer: + mov %rsp, (%rcx) + + # Restore callee stack pointer: + mov (%rdx), %rsp + + movaps -24(%rsp), %xmm6 + movaps -40(%rsp), %xmm7 + movaps -56(%rsp), %xmm8 + movaps -72(%rsp), %xmm9 + movaps -88(%rsp), %xmm10 + movaps -104(%rsp), %xmm11 + movaps -120(%rsp), %xmm12 + movaps -136(%rsp), %xmm13 + movaps -152(%rsp), %xmm14 + movaps -168(%rsp), %xmm15 + + # Restore callee stack: + popq %r15 + popq %r14 + popq %r13 + popq %r12 + popq %rsi + popq %rdi + popq %rbx + popq %rbp + + # Restore the thread information block: + popq %gs:16 + popq %gs:8 + + # Put the first argument into the return value: + mov %rcx, %rax + + # We pop the return address and jump to it: + ret + +.globl coroutine_trampoline +coroutine_trampoline: + # Do not remove this. This forces 16-byte alignment when entering the coroutine. + ret diff --git a/coroutine/win64/Context.s b/coroutine/win64/Context.s deleted file mode 100644 index 4b16e0ce8c..0000000000 --- a/coroutine/win64/Context.s +++ /dev/null @@ -1,77 +0,0 @@ -## -## This file is part of the "Coroutine" project and released under the MIT License. -## -## Created by Samuel Williams on 4/11/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. -## - -.text - -.globl coroutine_transfer -coroutine_transfer: - # Save the thread information block: - pushq %gs:8 - pushq %gs:16 - - # Save caller registers: - pushq %rbp - pushq %rbx - pushq %rdi - pushq %rsi - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - - movaps %xmm15, -168(%rsp) - movaps %xmm14, -152(%rsp) - movaps %xmm13, -136(%rsp) - movaps %xmm12, -120(%rsp) - movaps %xmm11, -104(%rsp) - movaps %xmm10, -88(%rsp) - movaps %xmm9, -72(%rsp) - movaps %xmm8, -56(%rsp) - movaps %xmm7, -40(%rsp) - movaps %xmm6, -24(%rsp) - - # Save caller stack pointer: - mov %rsp, (%rcx) - - # Restore callee stack pointer: - mov (%rdx), %rsp - - movaps -24(%rsp), %xmm6 - movaps -40(%rsp), %xmm7 - movaps -56(%rsp), %xmm8 - movaps -72(%rsp), %xmm9 - movaps -88(%rsp), %xmm10 - movaps -104(%rsp), %xmm11 - movaps -120(%rsp), %xmm12 - movaps -136(%rsp), %xmm13 - movaps -152(%rsp), %xmm14 - movaps -168(%rsp), %xmm15 - - # Restore callee stack: - popq %r15 - popq %r14 - popq %r13 - popq %r12 - popq %rsi - popq %rdi - popq %rbx - popq %rbp - - # Restore the thread information block: - popq %gs:16 - popq %gs:8 - - # Put the first argument into the return value: - mov %rcx, %rax - - # We pop the return address and jump to it: - ret - -.globl coroutine_trampoline -coroutine_trampoline: - # Do not remove this. This forces 16-byte alignment when entering the coroutine. - ret diff --git a/coroutine/x86/Context.S b/coroutine/x86/Context.S new file mode 100644 index 0000000000..5fc0cccc24 --- /dev/null +++ b/coroutine/x86/Context.S @@ -0,0 +1,39 @@ +## +## This file is part of the "Coroutine" project and released under the MIT License. +## +## Created by Samuel Williams on 3/11/2018. +## Copyright, 2018, by Samuel Williams. All rights reserved. +## + +.text + +.globl coroutine_transfer +coroutine_transfer: + +# For older linkers +.globl _coroutine_transfer +_coroutine_transfer: + + # Save caller registers + pushl %ebp + pushl %ebx + pushl %edi + pushl %esi + + # Save caller stack pointer + movl %esp, (%ecx) + + # Restore callee stack pointer + movl (%edx), %esp + + # Restore callee stack + popl %esi + popl %edi + popl %ebx + popl %ebp + + # Save the first argument as the return value + movl %ecx, %eax + + # Jump to the address on the stack + ret diff --git a/coroutine/x86/Context.s b/coroutine/x86/Context.s deleted file mode 100644 index 5fc0cccc24..0000000000 --- a/coroutine/x86/Context.s +++ /dev/null @@ -1,39 +0,0 @@ -## -## This file is part of the "Coroutine" project and released under the MIT License. -## -## Created by Samuel Williams on 3/11/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. -## - -.text - -.globl coroutine_transfer -coroutine_transfer: - -# For older linkers -.globl _coroutine_transfer -_coroutine_transfer: - - # Save caller registers - pushl %ebp - pushl %ebx - pushl %edi - pushl %esi - - # Save caller stack pointer - movl %esp, (%ecx) - - # Restore callee stack pointer - movl (%edx), %esp - - # Restore callee stack - popl %esi - popl %edi - popl %ebx - popl %ebp - - # Save the first argument as the return value - movl %ecx, %eax - - # Jump to the address on the stack - ret -- cgit v1.2.3