x86 recipes: emit StackOverflow trap for all sp-relative loads and stores (#325)
* x86 recipes: emit StackOverflow trap for all sp-relative loads and stores * x86 recipes: emit StackOverflow trap for push and pop * x86 binary filetests: add stk_ovf trap annotations
This commit is contained in:
@@ -477,7 +477,7 @@ ebb0:
|
||||
; Colocated functions.
|
||||
|
||||
; asm: call bar
|
||||
call fn1() ; bin: e8 PCRel4(%bar-4) 00000000
|
||||
call fn1() ; bin: stk_ovf e8 PCRel4(%bar-4) 00000000
|
||||
|
||||
; asm: lea 0x0(%rip), %rcx
|
||||
[-,%rcx] v400 = func_addr.i64 fn1 ; bin: 48 8d 0d PCRel4(%bar-4) 00000000
|
||||
@@ -487,11 +487,11 @@ ebb0:
|
||||
[-,%r10] v402 = func_addr.i64 fn1 ; bin: 4c 8d 15 PCRel4(%bar-4) 00000000
|
||||
|
||||
; asm: call *%rcx
|
||||
call_indirect sig0, v400() ; bin: ff d1
|
||||
call_indirect sig0, v400() ; bin: stk_ovf ff d1
|
||||
; asm: call *%rsi
|
||||
call_indirect sig0, v401() ; bin: ff d6
|
||||
call_indirect sig0, v401() ; bin: stk_ovf ff d6
|
||||
; asm: call *%r10
|
||||
call_indirect sig0, v402() ; bin: 41 ff d2
|
||||
call_indirect sig0, v402() ; bin: stk_ovf 41 ff d2
|
||||
|
||||
; Non-colocated functions. Note that there is no non-colocated non-PIC call.
|
||||
|
||||
@@ -503,11 +503,11 @@ ebb0:
|
||||
[-,%r10] v412 = func_addr.i64 fn0 ; bin: 49 ba Abs8(%foo) 0000000000000000
|
||||
|
||||
; asm: call *%rcx
|
||||
call_indirect sig0, v410() ; bin: ff d1
|
||||
call_indirect sig0, v410() ; bin: stk_ovf ff d1
|
||||
; asm: call *%rsi
|
||||
call_indirect sig0, v411() ; bin: ff d6
|
||||
call_indirect sig0, v411() ; bin: stk_ovf ff d6
|
||||
; asm: call *%r10
|
||||
call_indirect sig0, v412() ; bin: 41 ff d2
|
||||
call_indirect sig0, v412() ; bin: stk_ovf 41 ff d2
|
||||
|
||||
; asm: movabsq $-1, %rcx
|
||||
[-,%rcx] v450 = globalsym_addr.i64 gv0 ; bin: 48 b9 Abs8(%some_gv) 0000000000000000
|
||||
@@ -519,33 +519,33 @@ ebb0:
|
||||
; Spill / Fill.
|
||||
|
||||
; asm: movq %rcx, 1032(%rsp)
|
||||
[-,ss1] v500 = spill v1 ; bin: 48 89 8c 24 00000408
|
||||
[-,ss1] v500 = spill v1 ; bin: stk_ovf 48 89 8c 24 00000408
|
||||
; asm: movq %rsi, 1032(%rsp)
|
||||
[-,ss1] v501 = spill v2 ; bin: 48 89 b4 24 00000408
|
||||
[-,ss1] v501 = spill v2 ; bin: stk_ovf 48 89 b4 24 00000408
|
||||
; asm: movq %r10, 1032(%rsp)
|
||||
[-,ss1] v502 = spill v3 ; bin: 4c 89 94 24 00000408
|
||||
[-,ss1] v502 = spill v3 ; bin: stk_ovf 4c 89 94 24 00000408
|
||||
|
||||
; asm: movq 1032(%rsp), %rcx
|
||||
[-,%rcx] v510 = fill v500 ; bin: 48 8b 8c 24 00000408
|
||||
[-,%rcx] v510 = fill v500 ; bin: stk_ovf 48 8b 8c 24 00000408
|
||||
; asm: movq 1032(%rsp), %rsi
|
||||
[-,%rsi] v511 = fill v501 ; bin: 48 8b b4 24 00000408
|
||||
[-,%rsi] v511 = fill v501 ; bin: stk_ovf 48 8b b4 24 00000408
|
||||
; asm: movq 1032(%rsp), %r10
|
||||
[-,%r10] v512 = fill v502 ; bin: 4c 8b 94 24 00000408
|
||||
[-,%r10] v512 = fill v502 ; bin: stk_ovf 4c 8b 94 24 00000408
|
||||
|
||||
; asm: movq %rcx, 1032(%rsp)
|
||||
regspill v1, %rcx -> ss1 ; bin: 48 89 8c 24 00000408
|
||||
regspill v1, %rcx -> ss1 ; bin: stk_ovf 48 89 8c 24 00000408
|
||||
; asm: movq 1032(%rsp), %rcx
|
||||
regfill v1, ss1 -> %rcx ; bin: 48 8b 8c 24 00000408
|
||||
regfill v1, ss1 -> %rcx ; bin: stk_ovf 48 8b 8c 24 00000408
|
||||
|
||||
; Push and Pop
|
||||
; asm: pushq %rcx
|
||||
x86_push v1 ; bin: 51
|
||||
x86_push v1 ; bin: stk_ovf 51
|
||||
; asm: pushq %r10
|
||||
x86_push v3 ; bin: 41 52
|
||||
x86_push v3 ; bin: stk_ovf 41 52
|
||||
; asm: popq %rcx
|
||||
[-,%rcx] v513 = x86_pop.i64 ; bin: 59
|
||||
[-,%rcx] v513 = x86_pop.i64 ; bin: stk_ovf 59
|
||||
; asm: popq %r10
|
||||
[-,%r10] v514 = x86_pop.i64 ; bin: 41 5a
|
||||
[-,%r10] v514 = x86_pop.i64 ; bin: stk_ovf 41 5a
|
||||
|
||||
; Adjust Stack Pointer Up
|
||||
; asm: addq $64, %rsp
|
||||
@@ -732,9 +732,9 @@ ebb0:
|
||||
[-,%rcx] v1 = iconst.i64 1
|
||||
|
||||
; asm: movq %rcx, 8(%rsp)
|
||||
[-,ss1] v10 = spill v1 ; bin: 48 89 8c 24 00000008
|
||||
[-,ss1] v10 = spill v1 ; bin: stk_ovf 48 89 8c 24 00000008
|
||||
; asm: movq %rcx, (%rsp)
|
||||
[-,ss2] v11 = spill v1 ; bin: 48 89 8c 24 00000000
|
||||
[-,ss2] v11 = spill v1 ; bin: stk_ovf 48 89 8c 24 00000000
|
||||
|
||||
return
|
||||
}
|
||||
@@ -1094,23 +1094,23 @@ ebb0:
|
||||
; Spill / Fill.
|
||||
|
||||
; asm: movl %ecx, 1032(%rsp)
|
||||
[-,ss1] v500 = spill v1 ; bin: 89 8c 24 00000408
|
||||
[-,ss1] v500 = spill v1 ; bin: stk_ovf 89 8c 24 00000408
|
||||
; asm: movl %esi, 1032(%rsp)
|
||||
[-,ss1] v501 = spill v2 ; bin: 89 b4 24 00000408
|
||||
[-,ss1] v501 = spill v2 ; bin: stk_ovf 89 b4 24 00000408
|
||||
; asm: movl %r10d, 1032(%rsp)
|
||||
[-,ss1] v502 = spill v3 ; bin: 44 89 94 24 00000408
|
||||
[-,ss1] v502 = spill v3 ; bin: stk_ovf 44 89 94 24 00000408
|
||||
|
||||
; asm: movl 1032(%rsp), %ecx
|
||||
[-,%rcx] v510 = fill v500 ; bin: 8b 8c 24 00000408
|
||||
[-,%rcx] v510 = fill v500 ; bin: stk_ovf 8b 8c 24 00000408
|
||||
; asm: movl 1032(%rsp), %esi
|
||||
[-,%rsi] v511 = fill v501 ; bin: 8b b4 24 00000408
|
||||
[-,%rsi] v511 = fill v501 ; bin: stk_ovf 8b b4 24 00000408
|
||||
; asm: movl 1032(%rsp), %r10d
|
||||
[-,%r10] v512 = fill v502 ; bin: 44 8b 94 24 00000408
|
||||
[-,%r10] v512 = fill v502 ; bin: stk_ovf 44 8b 94 24 00000408
|
||||
|
||||
; asm: movl %ecx, 1032(%rsp)
|
||||
regspill v1, %rcx -> ss1 ; bin: 89 8c 24 00000408
|
||||
regspill v1, %rcx -> ss1 ; bin: stk_ovf 89 8c 24 00000408
|
||||
; asm: movl 1032(%rsp), %ecx
|
||||
regfill v1, ss1 -> %rcx ; bin: 8b 8c 24 00000408
|
||||
regfill v1, ss1 -> %rcx ; bin: stk_ovf 8b 8c 24 00000408
|
||||
|
||||
; asm: cmpl %esi, %ecx
|
||||
[-,%rflags] v520 = ifcmp v1, v2 ; bin: 39 f1
|
||||
|
||||
Reference in New Issue
Block a user