1 // SPDX-License-Identifier: GPL-2.0-only
3 * check_initial_reg_state.c - check that execve sets the correct state
4 * Copyright (c) 2014-2016 Andrew Lutomirski
11 unsigned long ax
, bx
, cx
, dx
, si
, di
, bp
, sp
, flags
;
12 unsigned long r8
, r9
, r10
, r11
, r12
, r13
, r14
, r15
;
15 ".pushsection .text\n\t"
16 ".type real_start, @function\n\t"
17 ".global real_start\n\t"
51 ".size real_start, . - real_start\n\t"
59 printf("[FAIL]\tTest was built incorrectly\n");
63 if (ax
|| bx
|| cx
|| dx
|| si
|| di
|| bp
65 || r8
|| r9
|| r10
|| r11
|| r12
|| r13
|| r14
|| r15
68 printf("[FAIL]\tAll GPRs except SP should be 0\n");
69 #define SHOW(x) printf("\t" #x " = 0x%lx\n", x);
90 printf("[OK]\tAll GPRs except SP are 0\n");
94 printf("[FAIL]\tFLAGS is 0x%lx, but it should be 0x202\n", flags
);
97 printf("[OK]\tFLAGS is 0x202\n");
100 return nerrs
? 1 : 0;