summaryrefslogtreecommitdiff
path: root/zap/source/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'zap/source/amd64')
-rw-r--r--zap/source/amd64/bs/trap.s10
-rw-r--r--zap/source/amd64/math/abs.s34
-rw-r--r--zap/source/amd64/mem/cp.s66
-rw-r--r--zap/source/amd64/mem/fill.s35
-rw-r--r--zap/source/amd64/sys/syscall.s27
5 files changed, 0 insertions, 172 deletions
diff --git a/zap/source/amd64/bs/trap.s b/zap/source/amd64/bs/trap.s
deleted file mode 100644
index 19c52a8..0000000
--- a/zap/source/amd64/bs/trap.s
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-
-.intel_syntax noprefix
-
-.globl zap_trap
-
-zap_trap:
- ud2
diff --git a/zap/source/amd64/math/abs.s b/zap/source/amd64/math/abs.s
deleted file mode 100644
index 178b5a7..0000000
--- a/zap/source/amd64/math/abs.s
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-
-.intel_syntax noprefix
-
-.globl zap_abs8
-.globl zap_abs01
-.globl zap_abs02
-.globl zap_abs04
-
-zap_abs8:
- mov al,dil
- neg al # zap_i8 ret = -inv; // Invert the copy of the input value. This also tests the sign of the value.
- cmovs ax,di # if (val < 0x0) ret = val; // If it was positive, just return the unmodified input.
- ret # return ret;
-
-zap_abs01:
- mov ax,di
- neg ax
- cmovs ax,di
- ret
-
-zap_abs02:
- mov eax,edi
- neg eax
- cmovs eax,edi
- ret
-
-zap_abs04:
- mov rax,rdi
- neg rax
- cmovs rax,rdi
- ret
diff --git a/zap/source/amd64/mem/cp.s b/zap/source/amd64/mem/cp.s
deleted file mode 100644
index b0b91e5..0000000
--- a/zap/source/amd64/mem/cp.s
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-
-.intel_syntax noprefix
-
-.globl zap_cp
-
-zap_cp:
- # zap_i8 val1;
- # zap_i04 val8;
- # unsigned int128_t val01;
- # unsigned int256_t val02;
-
-.big02cp: # big02cp:; // We assume AVX.
- cmp rdx,0x20
- jl short .big01cp # if (rem < 0x20u) goto big01cp;
-
- vmovdqu ymm0,[rsi] # val02 = *(unsigned int256_t *)src;
- vmovdqu [rdi],ymm0 # *(unsigned int256_t *)dest = val02;
-
- add rdi,0x20 # dest += 0x20u;
- add rsi,0x20 # src += 0x20u;
- sub rdx,0x20 # rem -= 0x20u;
- jmp short .big02cp # goto big02cp;
-
-.big01cp: # big01cp:;
- cmp rdx,0x10
- jl short .wrdcp # if (rem < 0x10u) goto wrdcp;
-
- movdqu xmm0,[rsi] # val01 = *(unsigned int128_t *)src;
- movdqu [rdi],xmm0 # *(unsigned int128_t *)dest = val01;
-
- add rdi,0x10 # dest += 0x10u;
- add rsi,0x10 # src += 0x10u;
- sub rdx,0x10 # rem -= 0x10u;
- jmp short .big01cp # goto big01cp;
-
-.wrdcp: # wrdcp:;
- cmp rdx,0x8
- jl short .bytecp # if (rem < 0x8u) goto bytecp;
-
- mov rcx,[rsi] # val8 = *(zap_i04 *)src;
- mov [rdi],rcx # *(zap_i04 *)dest = val8;
-
- add rsi,0x8 # dest += 0x8u;
- add rdi,0x8 # src += 0x8u;
- sub rdx,0x8 # rem -= 0x8u;
- jmp short .wrdcp # goto wrdcp
-
-.bytecp: # bytecp:;
- test rdx,rdx # if (rem == 0x0)
- jz short .done # goto done
-
- mov cl,[rsi] # val1 = *(zap_i8 *)src;
- mov [rdi],cl # *(zap_i8 *)dest = val1;
-
- inc rdi # ++dest;
- inc rsi # ++src;
- dec rdx # --rem;
- jmp short .bytecp # goto bytecp;
-
-.done:
- mov rax,rdi
- mov rdx,rsi
- ret # return (zap_cpret) {.dest = dest,.src = src};
diff --git a/zap/source/amd64/mem/fill.s b/zap/source/amd64/mem/fill.s
deleted file mode 100644
index 8e3f5fd..0000000
--- a/zap/source/amd64/mem/fill.s
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-
-.intel_syntax noprefix
-
-.globl zap_fill
-
-zap_fill:
- movzx rsi,sil # zap_i04 extval = val;
- mov rax,0x0101010101010101 # zap_i04 val = 0x0101010101010101u;
- imul rax,rsi # val *= extval;
-
-.wrdfill: # wrdfill:;
- cmp rdx,0x8
- jl short .bytefill # if (num < 0x8u) goto bytefill;
-
- mov [rdi],rax # *(zap_i04 *)dest = val8;
-
- add rdi,0x8 # dest += 0x8u;
- sub rdx,0x8 # num -= 0x8u;
- jmp short .wrdfill # goto wrdfill
-
-.bytefill: # bytefill:;
- test rdx,rdx # if (rem == 0x0)
- jz short .done # goto done
-
- mov [rdi],al # *(zap_i8 *)dest = val1;
-
- inc rdi # ++dest;
- dec rdx # --rem;
- jmp short .bytefill # goto bytefill;
-
-.done:
- ret # return
diff --git a/zap/source/amd64/sys/syscall.s b/zap/source/amd64/sys/syscall.s
deleted file mode 100644
index f6a615a..0000000
--- a/zap/source/amd64/sys/syscall.s
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
-
-.globl zap_syscall
-
-zap_syscall:
- # System calls on AMD64 use the following registers:
- # rax : System call identifier
- # rdi : First parameter
- # rsi : Second parameter
- # rdx : Third parameter
- # r10 : Fourth parameter
- # r8 : Fifth parameter
- # r9 : Sixth parameter
- # eax : Return value
- # No registers to save.
- movq %rdi,%rax # Move the first parameter (the identifier) to rax.
- movq %rsi,%rdi # Move parameters into their designated registers.
- movq %rdx,%rsi
- movq %rcx,%rdx
- movq %r8,%r10 # System calls use r10 instead of rcx.
- movq %r9,%r8
- movq 0x8(%rsp),%r9 # Extract the sixth argument from the stack.
- syscall # Slime incident
- # No need to move the return value.
- ret