diff options
author | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
commit | be8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch) | |
tree | 726e2468c0c07add773c0dbd86ab6386844259ae /gcc/config/rs6000/ntstack.asm |
initial commit
Diffstat (limited to 'gcc/config/rs6000/ntstack.asm')
-rwxr-xr-x | gcc/config/rs6000/ntstack.asm | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/config/rs6000/ntstack.asm b/gcc/config/rs6000/ntstack.asm new file mode 100755 index 0000000..aa4179e --- /dev/null +++ b/gcc/config/rs6000/ntstack.asm @@ -0,0 +1,42 @@ +# Allocate stack for NT, inserting stack probes every 4k pages + + .file "ntstack.asm" + +# Setup MS Structured-Exception-Handling + .pdata + .align 2 + .ualong ..__allocate_stack,__allocate_stack.e,0,0,__allocate_stack.b + +# Switch to the relocation section + .reldata + .globl __allocate_stack + .globl ..__allocate_stack +__allocate_stack: + .ualong ..__allocate_stack,.toc + + .text + .align 2 +..__allocate_stack: + .function ..__allocate_stack +__allocate_stack.b: + addi 3,3,15 # round up to 16 byte alignment + lwz 0,0(1) # old stack link + rlwinm 3,3,0,0,28 + srawi. 4,3,12 # get # of pages to check + neg 3,3 # negate so we can use stwux + bgt- 0,.Lcheck + stwux 0,1,3 # small request, just decrement and return + blr + +.Lcheck: + mtctr 4 # number of pages to check + mr 5,1 # tmp pointer +.Lloop: + lwzu 6,-4096(5) # touch the page + bdnz+ .Lloop # and loop back + + stwux 0,1,3 # update stack pointer + blr + +__allocate_stack.e: +FE_MOT_RESVD..__allocate_stack: |