diff options
| author | Andreas Kapp Lindquist <andkaplin05@gmail.com> | 2025-10-28 15:09:05 +0100 |
|---|---|---|
| committer | mithe24 <mithe24@student.sdu.dk> | 2025-10-29 13:49:57 +0100 |
| commit | 541874c7d91013cda51edf12334890305b3988d5 (patch) | |
| tree | a88ac545bd9986ba4380bf561156daee3eba31b2 | |
| parent | 6746b29daa5b26b53d0c3fa3da26a6d54dcc5a73 (diff) | |
| download | sorter-541874c7d91013cda51edf12334890305b3988d5.tar.gz sorter-541874c7d91013cda51edf12334890305b3988d5.zip | |
refactor(src): made sure all function follow calling conventions
| -rw-r--r-- | src/array_maker.s | 6 | ||||
| -rw-r--r-- | src/insertion_sort.s | 10 | ||||
| -rw-r--r-- | src/lib/int2str.s | 5 | ||||
| -rw-r--r-- | src/lib/strcmp.s | 2 | ||||
| -rw-r--r-- | src/lib/tub2tsv.s | 2 | ||||
| -rwxr-xr-x | src/quicksort.s | 1 |
6 files changed, 8 insertions, 18 deletions
diff --git a/src/array_maker.s b/src/array_maker.s index b0809ca..f62f364 100644 --- a/src/array_maker.s +++ b/src/array_maker.s @@ -4,7 +4,7 @@ # INPUTS : rdi = File descriptor # OUTPUTS : rax = Pointer to start of array in memory # rdx = Length of array in 8 byte chunks (the number of elements) -# CLOBBERS: rax, rsi +# CLOBBERS: rax, rdx, rdi, rsi # -------------------------------------------- .globl make_array_from_file .type make_array_from_file, @function @@ -64,7 +64,7 @@ end: # rsi = Size of file # OUTPUTS : rax = Pointer to start of pairwise data in memory # rdx = The number of pairs -# CLOBBERS: rdi, rsi, rdx, rax +# CLOBBERS: rax, rdx, rdi, rsi # -------------------------------------------- .globl make_pairwise_data .type make_pairwise_data, @function @@ -123,7 +123,7 @@ end: # INPUTS : rdi = File descriptor # OUTPUTS : rax = Pointer to start of file in memory # rdx = Length of file in bytes -# CLOBBERS: rax, rsi, rdi, rdx +# CLOBBERS: rax, rdx, rdi, rsi # -------------------------------------------- .globl create_file_buffer .type create_file_buffer, @function diff --git a/src/insertion_sort.s b/src/insertion_sort.s index f5c38ad..3048a89 100644 --- a/src/insertion_sort.s +++ b/src/insertion_sort.s @@ -6,17 +6,13 @@ # rsi = number of coordinates n # rdx = index of key to sort by # OUTPUTS : rax = address for sorted A -# CLOBBERS: none +# CLOBBERS: rax, rdx, rdi, rsi, r8, r9, r10, r11 # -------------------------------------------- .section .text .globl insertion_sort .type insertion_sort, @function insertion_sort: # save - push %r8 - push %r9 - push %r10 - push %r11 push %r14 push %r15 @@ -71,8 +67,4 @@ done: # retrieve pop %r15 pop %r14 - pop %r11 - pop %r10 - pop %r9 - pop %r8 ret diff --git a/src/lib/int2str.s b/src/lib/int2str.s index 82a2aaa..1e9801b 100644 --- a/src/lib/int2str.s +++ b/src/lib/int2str.s @@ -1,12 +1,11 @@ # -------------------------------------------- # FUNCTION: int2str -# PURPOSE : Convert a 64 bit integer into ascii -# into ASCII encoding +# PURPOSE : Convert a 64 bit integer into ASCII # INPUTS : rdi = 64 bit integer # rsi = address of buffer # OUTPUTS : rax = address of string (points into the provided buffer) # rdx = length of string -# CLOBBERS: +# CLOBBERS: rax, rcx, rdi, rsi, r8, r9, r10 # -------------------------------------------- .section .text .globl int2str diff --git a/src/lib/strcmp.s b/src/lib/strcmp.s index c24b5b5..d495a91 100644 --- a/src/lib/strcmp.s +++ b/src/lib/strcmp.s @@ -5,7 +5,7 @@ # INPUTS : rdi = address of first string # rsi = address of second string # OUTPUTS : rax = 1 if equals else 0 -# CLOBBERS: +# CLOBBERS: rax, rdi, rsi, r8, r9 # -------------------------------------------- .section .text .globl strcmp diff --git a/src/lib/tub2tsv.s b/src/lib/tub2tsv.s index 558c51e..f2f6ecf 100644 --- a/src/lib/tub2tsv.s +++ b/src/lib/tub2tsv.s @@ -6,7 +6,7 @@ # rsi = number of coordinates # OUTPUTS : rax = address to string of tab seperated values # rdx = number of bytes -# CLOBBERS: +# CLOBBERS: rax, rcx, rdx, rsi, rdi # -------------------------------------------- .section .text .globl tub2tsv diff --git a/src/quicksort.s b/src/quicksort.s index 78b9eea..54720bf 100755 --- a/src/quicksort.s +++ b/src/quicksort.s @@ -5,7 +5,6 @@ # rsi = number of coordinates n # rdx = index of key to sort by # OUTPUTS : rax = address for sorted A -# NOTES : preserves rdi, rdx # -------------------------------------------- .section .text .globl quicksort |