summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-15 02:39:00 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-15 02:39:00 -0400
commitf37255cefaae3330edbea45c6cf6996cb76cea99 (patch)
treee567d28164d8a36a1825d2ae737c6234c306f1f8 /rt
parentb24267e29842d9f8fd513af63176fd099d1ef204 (diff)
downloadmc-f37255cefaae3330edbea45c6cf6996cb76cea99.tar.gz
Now the abort code works on OSX.
Diffstat (limited to 'rt')
-rw-r--r--rt/abort.s13
1 files changed, 7 insertions, 6 deletions
diff --git a/rt/abort.s b/rt/abort.s
index 8ac1c02..9c44ec7 100644
--- a/rt/abort.s
+++ b/rt/abort.s
@@ -7,18 +7,20 @@ __rt$abort_oob:
/* format pc */
movq (%rsp),%rax
movq $15,%rdx
+ leaq .digitchars(%rip),%r8
+ leaq .pcstr(%rip),%r9
.loop:
movq %rax, %rcx
andq $0xf, %rcx
- movb .digitchars(%rcx),%r8b
- movb %r8b,.pcstr(%rdx)
+ movb (%r8,%rcx),%r10b
+ movb %r10b,(%r9,%rdx)
subq $1, %rdx
shrq $4, %rax
jnz .loop
/* write abort message */
movq $1, %rax /* write(fd=%rdi, msg=%rsi, len=%rdx) */
movq $2, %rdi /* fd */
- movq $.msg, %rsi /* msg */
+ leaq .msg(%rip), %rsi /* msg */
movq $(.msgend-.msg), %rdx /* length */
syscall
/* kill self */
@@ -30,10 +32,9 @@ __rt$abort_oob:
syscall
.data
.msg: /* pc name: */
- .byte '0','x'
+ .ascii "0x"
.pcstr:
- .byte '0','0','0','0','0','0','0','0'
- .byte '0','0','0','0','0','0','0','0'
+ .ascii "0000000000000000"
.ascii ": out of bounds access\n"
.msgend: