diff options
Diffstat (limited to 'arch/x64')
| -rw-r--r-- | arch/x64/linux/concurrency/thread.S | 8 | ||||
| -rw-r--r-- | arch/x64/linux/math/abs.S | 35 | ||||
| -rw-r--r-- | arch/x64/linux/math/log.S | 48 | ||||
| -rw-r--r-- | arch/x64/linux/memory/copy.S | 67 | ||||
| -rw-r--r-- | arch/x64/linux/memory/equal.S | 59 | ||||
| -rw-r--r-- | arch/x64/linux/memory/fill.S | 160 | ||||
| -rw-r--r-- | arch/x64/linux/syscall.S | 65 |
7 files changed, 0 insertions, 442 deletions
diff --git a/arch/x64/linux/concurrency/thread.S b/arch/x64/linux/concurrency/thread.S deleted file mode 100644 index c211d76..0000000 --- a/arch/x64/linux/concurrency/thread.S +++ /dev/null @@ -1,8 +0,0 @@ - .text - - .globl thrd_current - .type thrd_current, @function - -thrd_current: - mov %fs:0, %rax - ret diff --git a/arch/x64/linux/math/abs.S b/arch/x64/linux/math/abs.S deleted file mode 100644 index 6635273..0000000 --- a/arch/x64/linux/math/abs.S +++ /dev/null @@ -1,35 +0,0 @@ - .text - - -// fabsf. - .globl _D5tanya4math8nbtheory4fabsFNaNbNiNffZf - .type _D5tanya4math8nbtheory4fabsFNaNbNiNffZf, @function - -_D5tanya4math8nbtheory4fabsFNaNbNiNffZf: - mov $0x7fffffff, %eax - movq %rax, %xmm1 - andpd %xmm1, %xmm0 - ret - - -// fabs. - .globl _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd - .type _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd, @function - -_D5tanya4math8nbtheory4fabsFNaNbNiNfdZd: - mov $0x7fffffffffffffff, %rax - movq %rax, %xmm1 - andpd %xmm1, %xmm0 - ret - - -// fabsl. - .globl _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe - .type _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe, @function - -// Load the parameter from the stack onto FP stack, execute 'fabs' instruction -// The result is returned in ST0. -_D5tanya4math8nbtheory4fabsFNaNbNiNfeZe: - fldt 0x8(%rsp) - fabs - ret diff --git a/arch/x64/linux/math/log.S b/arch/x64/linux/math/log.S deleted file mode 100644 index 9c5ed35..0000000 --- a/arch/x64/linux/math/log.S +++ /dev/null @@ -1,48 +0,0 @@ - .text - - -// logf. - .globl _D5tanya4math8nbtheory4logfFNaNbNiNffZf - .type _D5tanya4math8nbtheory4logfFNaNbNiNffZf, @function - -_D5tanya4math8nbtheory4logfFNaNbNiNffZf: - movss %xmm0, -4(%rsp) // Put the argument onto the stack - - fldln2 // Put lb(e) onto the FPU stack - flds -4(%rsp) // Put a float onto the FPU stack - fyl2x // %st1 * lb(%st0) - - // The result is on the FPU stack, but returned in %xmm0 - fstps -4(%rsp) - movss -4(%rsp), %xmm0 - - ret - - -// log. - .globl _D5tanya4math8nbtheory3logFNaNbNiNfdZd - .type _D5tanya4math8nbtheory3logFNaNbNiNfdZd, @function - -_D5tanya4math8nbtheory3logFNaNbNiNfdZd: - movsd %xmm0, -8(%rsp) // Put the argument onto the stack - - fldln2 // Put lb(e) onto the FPU stack - fldl -8(%rsp) // Put a double onto the FPU stack - fyl2x // %st1 * lb(%st0) - - // The result is on the FPU stack, but returned in %xmm0 - fstpl -8(%rsp) - movsd -8(%rsp), %xmm0 - - ret - - -// logl. - .globl _D5tanya4math8nbtheory4loglFNaNbNiNfeZe - .type _D5tanya4math8nbtheory4loglFNaNbNiNfeZe, @function - -_D5tanya4math8nbtheory4loglFNaNbNiNfeZe: - fldln2 // Put lb(e) onto the FPU stack - fldt 8(%rsp) // Put the argument onto the FPU stack - fyl2x // %st1 * lb(%st0) - ret diff --git a/arch/x64/linux/memory/copy.S b/arch/x64/linux/memory/copy.S deleted file mode 100644 index bf74e0f..0000000 --- a/arch/x64/linux/memory/copy.S +++ /dev/null @@ -1,67 +0,0 @@ - .text - -/* - * copyMemory. - * - * rdi - source length - * rsi - source data. - * rdx - target length. - * rcx - target data. - */ - .globl _D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv - .type _D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv, @function - -_D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv: - mov %rdi, %rdx - mov %rcx, %rdi - - cmp $0x08, %rdx - jc aligned_1 - test $0x07, %edi - jz aligned_8 - - naligned: - movsb - dec %rdx - test $0x07, %edi - jnz naligned - - aligned_8: - mov %rdx, %rcx - shr $0x03, %rcx - rep movsq - and $0x07, %edx - jz end - - aligned_1: - // Write the remaining bytes - mov %rdx, %rcx - rep movsb - - end: - ret - -/* - * moveMemory. - * - * rdi - source length - * rsi - source data. - * rdx - target length. - * rcx - target data. - */ - .globl _D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv - .type _D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv, @function - -_D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv: - mov %rdi, %rdx - - lea -1(%rdx, %rsi), %rsi - lea -1(%rdx, %rcx), %rdi - mov %rdx, %rcx - - std // Set the direction flag - - rep movsb - - cld // Clear the direction flag - ret diff --git a/arch/x64/linux/memory/equal.S b/arch/x64/linux/memory/equal.S deleted file mode 100644 index 37a906a..0000000 --- a/arch/x64/linux/memory/equal.S +++ /dev/null @@ -1,59 +0,0 @@ - .text - -/* - * equalMemory. - * - * rdi - r1 length - * rsi - r1 data. - * rdx - r2 length. - * rcx - r2 data. - */ - .globl _D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb - .type _D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb, @function -_D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb: - // Compare the lengths - cmp %rdx, %rdi - jne not_equal - - mov %rcx, %rdi - - // Check if we're aligned - cmp $0x08, %rdx - jc aligned_1 - test $0x07, %edi - jz aligned_8 - - naligned: - cmpsb - jne not_equal - - dec %rdx - test $0x07, %edi - jnz naligned - - aligned_8: - mov %rdx, %rcx - shr $0x03, %rcx - - repe cmpsq - jne not_equal - - and $0x07, %edx - jz equal - - aligned_1: // Compare the remaining bytes - mov %rdx, %rcx - cmp $0x0, %rcx - - repe cmpsb - jne not_equal - - equal: - mov $0x01, %rax // Return 1 - jmp end - - not_equal: - xor %rax, %rax // Return 0 - - end: - ret diff --git a/arch/x64/linux/memory/fill.S b/arch/x64/linux/memory/fill.S deleted file mode 100644 index 2717aa1..0000000 --- a/arch/x64/linux/memory/fill.S +++ /dev/null @@ -1,160 +0,0 @@ - .text - -/* - * fillMemory. - * - * rdi - length. - * rsi - pointer. - * rdx - value filled with a byte. - */ - .globl _D5tanya6memory2op10fillMemoryFNaNbNiAvmZv - .type _D5tanya6memory2op10fillMemoryFNaNbNiAvmZv, @function - -_D5tanya6memory2op10fillMemoryFNaNbNiAvmZv: - // Check for zero length - test %rdi, %rdi - jz end - - mov %rdi, %rax - mov %rsi, %r8 - - movq %rdx, %xmm0 - movlhps %xmm0, %xmm0 - - // Check if the pointer is aligned to a 16-byte boundary - and $-0x10, %r8 - - // Compute the number of misaligned bytes - mov %rsi, %r9 - sub %r8, %r9 - - test %r9, %r9 - jz aligned - - // Get the number of bytes to be written until we are aligned - mov $0x10, %rcx - sub %r9, %rcx - - mov %rsi, %r8 - - // If the length is less than the number of misaligned bytes, - // write one byte at a time and exit - cmp %rax, %rcx - jg aligned_1 - - naligned: - mov %dl, (%r8) // Write a byte - - // Advance the pointer. Decrease the total number of bytes - // and the misaligned ones - inc %r8 - dec %rcx - dec %rax - - // Checks if we are aligned - test %rcx, %rcx - jnz naligned - - aligned: - // Checks if we're done writing bytes - test %rax, %rax - jz end - - // Write 1 byte at a time - cmp $8, %rax - jl aligned_1 - - // Write 8 bytes at a time - cmp $16, %rax - jl aligned_8 - - // Write 16 bytes at a time - cmp $32, %rax - jl aligned_16 - - // Write 32 bytes at a time - cmp $64, %rax - jl aligned_32 - - aligned_64: - movdqa %xmm0, (%r8) - movdqa %xmm0, 16(%r8) - movdqa %xmm0, 32(%r8) - movdqa %xmm0, 48(%r8) - - add $64, %r8 - sub $64, %rax - - cmp $64, %rax - jge aligned_64 - - // Checks if we're done writing bytes - test %rax, %rax - jz end - - // Write 1 byte at a time - cmp $8, %rax - jl aligned_1 - - // Write 8 bytes at a time - cmp $16, %rax - jl aligned_8 - - // Write 16 bytes at a time - cmp $32, %rax - jl aligned_16 - - aligned_32: - movdqa %xmm0, (%r8) - movdqa %xmm0, 16(%r8) - - add $32, %r8 - sub $32, %rax - - // Checks if we're done writing bytes - test %rax, %rax - jz end - - // Write 1 byte at a time - cmp $8, %rax - jl aligned_1 - - // Write 8 bytes at a time - cmp $16, %rax - jl aligned_8 - - aligned_16: - movdqa %xmm0, (%r8) - - add $16, %r8 - sub $16, %rax - - // Checks if we're done writing bytes - test %rax, %rax - jz end - - // Write 1 byte at a time - cmp $8, %rax - jl aligned_1 - - aligned_8: - mov %rdx, (%r8) - - add $8, %r8 - sub $8, %rax - - // Checks if we're done writing bytes - test %rax, %rax - jz end - - aligned_1: - mov %dl, (%r8) - - inc %r8 - dec %rax - - test %rax, %rax - jnz aligned_1 - - end: - ret diff --git a/arch/x64/linux/syscall.S b/arch/x64/linux/syscall.S deleted file mode 100644 index a9c5437..0000000 --- a/arch/x64/linux/syscall.S +++ /dev/null @@ -1,65 +0,0 @@ -/* -The kernel uses the following registers: -%rdi, %rsi, %rdx, %r8, %r9, %r10 - -The number of the syscall is passed in %rax. - -A syscall clobbers: -%rax, %rcx, %r11 - -The returned value is placed in %rax. -*/ - .text - -// 1 parameter. - .globl _D5tanya3sys5linux7syscallQiFNbNillZl - .type _D5tanya3sys5linux7syscallQiFNbNillZl, @function - -_D5tanya3sys5linux7syscallQiFNbNillZl: - movq %rsi, %rax // Syscall number. - - syscall - - ret - - -// 2 parameters. - .globl _D5tanya3sys5linux7syscallQiFNbNilllZl - .type _D5tanya3sys5linux7syscallQiFNbNilllZl, @function - -_D5tanya3sys5linux7syscallQiFNbNilllZl: - movq %rdx, %rax - - syscall - - ret - - -// 3 parameters. - .globl _D5tanya3sys5linux7syscallQiFNbNillllZl - .type _D5tanya3sys5linux7syscallQiFNbNillllZl, @function - -_D5tanya3sys5linux7syscallQiFNbNillllZl: - movq %rcx, %rax - - syscall - - ret - - -// 6 parameters. - .globl _D5tanya3sys5linux7syscallQiFNbNilllllllZl - .type _D5tanya3sys5linux7syscallQiFNbNilllllllZl, @function - -_D5tanya3sys5linux7syscallQiFNbNilllllllZl: - pushq %rbp - movq %rsp, %rbp - - movq 16(%rbp), %rax - - mov %rcx, %r10 - - syscall - - leave - ret |
