reverie/tests/disabled/clobbered.S
Jason White 20c7020868 Appease the copyright linter
Summary: The OSS license linter doesn't like the word "its".

Reviewed By: johnhurt

Differential Revision: D36856385

fbshipit-source-id: 909037d96de8976f08004497d28b77838f8c6870
2022-06-02 11:51:06 -07:00

108 lines
1.6 KiB
ArmAsm

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* clobbered.S: used by reverie *only*
* to test inject/tail_inject wouldn't clobber any
* syscall registers.
* NB: %rcx is clobbered by `syscall`.
*/
.text
.global _start
.type _start, @function
_start:
sub $0x18, %rsp
mov $9, %eax // mmap
movq $0, %rdi
movq $4096, %rsi
movq $1, %rdx
movq $0x22, %r10
movq $-1, %r8
movq $0, %r9
syscall
cmp $0xfffffffffffff000,%rax
ja panic
movq %rax, 0x8(%rsp)
cmpq $0, %rdi
jne panic
cmpq $4096, %rsi
jne panic
cmpq $1, %rdx
jne panic
cmpq $0x22, %r10
jne panic
cmpq $-1, %r8
jne panic
cmpq $0, %r9
jne panic
movq $0x12345678, %rdi
movq $0x17654321, %rsi
movq $0x42421234, %rdx
movq $0x1234abab, %r10
movq $0x12123434, %r8
movq $0x78781212, %r9
mov $39, %eax // getpid
syscall
cmpq $0x12345678, %rdi
jne panic
cmpq $0x17654321, %rsi
jne panic
cmpq $0x42421234, %rdx
jne panic
cmpq $0x1234abab, %r10
jne panic
cmpq $0x12123434, %r8
jne panic
cmpq $0x78781212, %r9
jne panic
mov $11, %eax // munmap
movq 8(%rsp), %rdi
movq $4096, %rsi
syscall
cmp $0xfffffffffffff000,%rax
ja panic
cmpq $0x42421234, %rdx
jne panic
cmpq $0x1234abab, %r10
jne panic
cmpq $0x12123434, %r8
jne panic
cmpq $0x78781212, %r9
jne panic
add $18, %rsp
mov $0xe7, %eax // exit_group
mov $0, %rdi
syscall
panic: add $18, %rsp
mov $1, %rdi
mov $0xe7, %eax
syscall