// Program that loops for ever doing lots of recursions and system calls,
// intended to be used as part of a stress test for GCS context switching.
//
// Copyright 2015-2023 Arm Ltd
// Recurse x20 times
.macro recurse id
function recurse\id
stp x29, x30, [sp, #-16]!
mov x29, sp
cmp x20, 0
beq 1f sub x20, x20, 1
bl recurse\id
1:
ldp x29, x30, [sp], #16
// Do a syscall immediately prior to returning to try to provoke
// scheduling and migration at a point where coherency issues
// might trigger.
mov x8, #__NR_getpid
svc #0
ret
endfunction
.endm
// Generate and use two copies so we're changing the GCS contents
recurse 1
recurse 2
.globl _start
function _start
// Run with GCS
mov x0, PR_SET_SHADOW_STACK_STATUS
mov x1, PR_SHADOW_STACK_ENABLE
mov x2, xzr
mov x3, xzr
mov x4, xzr
mov x5, xzr
mov x8, #__NR_prctl
svc #0
cbz x0, 1f
puts "Failed to enable GCS\n"
b abort
1:
loop:
// Small recursion depth so we're frequently flipping between
// the two recursors and changing what's on the stack
mov x20, #5
bl recurse1
mov x20, #5
bl recurse2
b loop
endfunction
abort:
mov x0, #255
mov x8, #__NR_exit
svc #0
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.