Skip to content

Commit

Permalink
wrong offsets for siginfo_t, now fixed: correctly detects SEGV and pr…
Browse files Browse the repository at this point in the history
…ogram exit codes, 0.3.1
  • Loading branch information
StefanoBelli committed Jan 28, 2019
1 parent b5bb872 commit 6ed6001
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions amd64/linux/main.S
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.include "macros.S"

.data
sz_sysh_banner: .string "sysh version 0.3.0\n"
sz_sysh_banner: .string "sysh version 0.3.1-emma\n"
last_status_code_operation: .long 1

.extern install_sighandler
Expand All @@ -23,7 +23,7 @@ main:
movq $2, %rdi # SIGINT
call install_sighandler

sys_write_stdout $sz_sysh_banner, $19
sys_write_stdout $sz_sysh_banner, $24

xorw %bx, %bx
movb $0x20, %bh
Expand Down
9 changes: 7 additions & 2 deletions amd64/linux/sayexec.S
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ segv_received: .asciz "sysh: segmentation fault\n"
.global sayexec
.text
sayexec:
msysh_internal_setstatus $0

xchgq %r11, %rdx
sys_fork
xchgq %r8, %r10
Expand All @@ -24,10 +26,13 @@ sayexec:

subq $128, %rsp
sys_waitid %rbx, %rsp
movl 24(%rsp), %eax # grazie riccardo per il suggerimento sull'offset
movl 24(%rsp), %ebx # return value
msysh_internal_setstatus %rbx
movl 8(%rsp), %ebx # why it terminated
addq $128, %rsp

cmp $11, %eax
# check if it is segv
cmpl $3, %ebx
jne __sayexec_finish

__sayexec_child_segv:
Expand Down

0 comments on commit 6ed6001

Please sign in to comment.