summaryrefslogtreecommitdiff
path: root/sh.asm
diff options
context:
space:
mode:
authorfaissaloo <faissaloo@gmail.com>2016-07-23 19:31:17 +0100
committerfaissaloo <faissaloo@gmail.com>2016-07-23 19:31:17 +0100
commitc2f00cb50d8507c83b45798fb287dff407d18cdd (patch)
tree45734a87cc50dcd0e11109ca04469daef3773e9b /sh.asm
parentece7bd6dc17ba91deff32a9c121af80bcc1e79f2 (diff)
downloaddbsh-c2f00cb50d8507c83b45798fb287dff407d18cdd.tar.gz
Path finder now compares a qword at a time for speed
Diffstat (limited to 'sh.asm')
-rw-r--r--sh.asm32
1 files changed, 11 insertions, 21 deletions
diff --git a/sh.asm b/sh.asm
index a1dc0be..0c5d707 100644
--- a/sh.asm
+++ b/sh.asm
@@ -154,27 +154,17 @@ _parse_path2:
; Reads the PATH variable
_pathfinder:
inc r8
- xor rax, rax
- mov byte al, [r8]
- cmp al, `P`
- jne _pathfinder
- mov byte al, [r8+1]
- cmp al, `A`
- jne _pathfinder
- mov byte al, [r8+2]
- cmp al, `T`
- jne _pathfinder
- mov byte al, [r8+3]
- cmp al, `H`
- jne _pathfinder
- mov byte al, [r8+4]
- cmp al, `=`
- jne _pathfinder
- mov byte al, [r8+5]
- cmp al, `"`
- jne _pathfinder
- test al, al ;checks for 0
- je _quit
+
+ ;Check that we've found the PATH variable
+ mov r10, `\0\0PATH="`
+ mov rax, [r8]
+ shl rax, 16
+ cmp rax,r10
+ jne _pathfinder ;if we haven't, let's move right one and see if it's there
+ shr rax, 56
+ test al, al ;checks for a null terminator after 'PATH='
+ jz _quit
+
add r8, 0x6
mov r10, 0x1
push 0x0