Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
4.1.1: Improve performance of baz-cat and fix a bug with git subcom…
Browse files Browse the repository at this point in the history
…mand residuals

Signed-off-by: Ari Archer <[email protected]>
  • Loading branch information
Ari Archer committed Oct 27, 2022
1 parent bfccdbb commit 863c1be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
8 changes: 7 additions & 1 deletion baz
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ "$BAZ_DEBUG" ] && set -x

export BAZ_VERSION='4.1.0'
export BAZ_VERSION='4.1.1'
export BAZ_DIR="$HOME/.local/share/baz"
export BAZ_CONFDIR="$HOME/.config/baz"
export BAZ_CONF="$BAZ_CONFDIR/config.env"
Expand Down Expand Up @@ -441,6 +441,12 @@ bazp_install_git() {
_plugdir="/tmp/$(get_base "$1")"
if [ -e "$_plugdir" ]; then
log "Removing $1... " printf
rm -rf -- "$_plugdir"
eecho 'done'
fi
log "Cloning repository: $1... " printf
baz_git_clone "$1" "$_plugdir"
eecho 'done'
Expand Down
20 changes: 10 additions & 10 deletions baz-cat-impls/baz-cat.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ include "includes/libbaz.asm"

_start:
;; int read_bytes =
xor rax, rax ;; SYS_read[0](
xor rdi, rdi ;; fd=STDIN_FILENO[0],
mov rsi, buffer ;; buf=&buffer,
mov rdx, BUF_SIZE ;; count=BUF_SIZE,
xor eax, eax ;; SYS_read[0](
xor edi, edi ;; fd=STDIN_FILENO[0],
mov esi, buffer ;; buf=&buffer,
mov edx, BUF_SIZE ;; count=BUF_SIZE,
syscall ;; );

test eax, eax ;; if (read_bytes == 0)
jz .exit ;; goto .exit;

movsxd rdx, eax ;; int write_count = read_bytes;
mov edx, eax ;; int write_count = read_bytes;

mov rax, SYS_write ;; SYS_write(
mov rdi, STDOUT_FILENO ;; fd=stdout,
mov rsi, buffer ;; buf=&buffer,
mov eax, SYS_write ;; SYS_write(
mov edi, STDOUT_FILENO ;; fd=stdout,
mov esi, buffer ;; buf=&buffer,
;; count=write_count,
syscall ;; );

jmp _start ;; LOOP_AGAIN;

.exit:
mov rax, SYS_exit ;; SYS_exit(
xor rdi, rdi ;; status=EXIT_OK[0],
mov eax, SYS_exit ;; SYS_exit(
xor edi, edi ;; status=EXIT_OK[0],
syscall ;; );

segment readable writable
Expand Down

0 comments on commit 863c1be

Please sign in to comment.