Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcr2_fcwait(u64 mmcr2, int pmc) {
return ((mmcr2 & (1ull << (58 - (((pmc)-1) * 9)))) >> (58 - (((pmc)-1) * 9)));
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcr2_fch(u64 mmcr2, int pmc) {
return ((mmcr2 & (1ull << (57 - (((pmc)-1) * 9)))) >> (57 - (((pmc)-1) * 9)));
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcr2_fcta(u64 mmcr2, int pmc) {
return ((mmcr2 & (1ull << (55 - (((pmc)-1) * 9)))) >> (55 - (((pmc)-1) * 9)));
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcr3_src(u64 mmcr3, int pmc) {
if (pvr != POWER10)
return 0;
return ((mmcr3 >> ((49 - (15 * ((pmc)-1))))) & 0x7fff);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline u64 get_mmcra_bhrb_disable(u64 mmcra, int pmc) {
if (pvr == POWER10)
return mmcra & BHRB_DISABLE;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcra_rand_samp_elig(u64 mmcra, int pmc) {
return ((mmcra >> 4) & 0x7);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcra_sample_mode(u64 mmcra, int pmc) {
return ((mmcra >> 1) & 0x3);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h |
static inline int get_mmcra_marked(u64 mmcra, int pmc) { return mmcra & 0x1; } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_exceptionbits_test.c | static int mmcr0_exceptionbits(void) {
struct event event;
u64 *intr_regs;
SKIP_IF(check_pvr_for_sampling_tests());
/* Init the event for the sampling test */
event_init_sampling(&event, 0x500fa);
event.attr.sample_regs_intr = platform_extended_mask;
FAIL_IF(event_open(&event));
event.mmap_buffer = ev... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmccext_test.c |
int main(void) { return test_harness(mmcr0_pmccext, "mmcr0_pmccext"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmcjce_test.c | static int mmcr0_pmcjce(void) {
struct event event;
u64 *intr_regs;
SKIP_IF(check_pvr_for_sampling_tests());
/* Init the event for the sampling test */
event_init_sampling(&event, 0x500fa);
event.attr.sample_regs_intr = platform_extended_mask;
FAIL_IF(event_open(&event));
event.mmap_buffer = event_sam... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr0_pmcjce_test.c |
int main(void) { return test_harness(mmcr0_pmcjce, "mmcr0_pmcjce"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr2_fcs_fch_test.c |
int main(void) { return test_harness(mmcr2_fcs_fch, "mmcr2_fcs_fch"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcr3_src_test.c |
int main(void) { return test_harness(mmcr3_src, "mmcr3_src"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_any_test.c |
int main(void) {
return test_harness(mmcra_bhrb_any_test, "mmcra_bhrb_any_test");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_disable_test.c |
int main(void) {
return test_harness(mmcra_bhrb_disable_test, "mmcra_bhrb_disable_test");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_bhrb_ind_call_test.c |
int main(void) {
return test_harness(mmcra_bhrb_ind_call_test, "mmcra_bhrb_ind_call_test");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c |
static int protect_region(void) {
if (mprotect(mem_region + page_size, page_size, PROT_NONE)) {
perror("mprotect");
return 1;
}
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c |
static int unprotect_region(void) {
if (mprotect(mem_region + page_size, page_size, PROT_READ | PROT_WRITE)) {
perror("mprotect");
return 1;
}
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c |
static int do_one_test(char *p, int page_offset) {
unsigned long should;
unsigned long got;
FAIL_IF(unprotect_region());
should = *(unsigned long *)p;
FAIL_IF(protect_region());
got = load_unaligned_zeropad(p);
if (should != got) {
printf("offset %u load_unaligned_zeropad returned 0x%lx, should be... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/child.h | int wait_child(struct child_sync *sync) {
int ret;
ret = sem_wait(&sync->sem_parent);
if (ret) {
perror("Error waiting for child");
return 1;
}
return sync->child_gave_up;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/child.h | int wait_parent(struct child_sync *sync) {
int ret;
ret = sem_wait(&sync->sem_child);
if (ret) {
perror("Error waiting for parent");
return 1;
}
return sync->parent_gave_up;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/core-pkey.c |
static int increase_core_file_limit(void) {
struct rlimit rlim;
int ret;
ret = getrlimit(RLIMIT_CORE, &rlim);
FAIL_IF(ret);
if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < CORE_FILE_LIMIT) {
rlim.rlim_cur = CORE_FILE_LIMIT;
if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < CORE_FILE_LIMI... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/core-pkey.c | static int child(struct shared_info *info) {
bool disable_execute = true;
int pkey1, pkey2, pkey3;
int *ptr, ret;
ret = wait_parent(&info->child_sync);
if (ret)
return ret;
ret = increase_core_file_limit();
FAIL_IF(ret);
/* Get some pkeys so that we can change their bits in the AMR. */
pkey1 = ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/core-pkey.c |
static int core_pkey(void) {
char *core_pattern;
bool changed_core_pattern;
struct shared_info *info;
int shm_id;
int ret;
pid_t pid;
ret = setup_core_pattern(&core_pattern, &changed_core_pattern);
if (ret)
return ret;
shm_id = shmget(IPC_PRIVATE, sizeof(*info), 0777 | IPC_CREAT);
info = shma... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int perf_process_event_open_exclude_user(__u32 type, __u64 addr,
__u64 len, bool exclude_user) {
struct perf_event_attr attr;
perf_event_attr_set(&attr, type, addr, len, exclude_user);
return syscall(__NR_perf_event_open, &attr, getpid(), -1, -1, 0);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static void disable_fds(int *fd, int n) {
int i;
for (i = 0; i < n; i++)
ioctl(fd[i], PERF_EVENT_IOC_DISABLE);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int test_process_multi_same_addr(void) {
unsigned long long breaks1 = 0, breaks2 = 0;
int fd1, fd2;
char *desc = "Process specific, Two events, same addr";
size_t res;
fd1 = perf_process_event_open(HW_BREAKPOINT_RW, (__u64)&a, (__u64)sizeof(a));
if (fd1 < 0) {
perror("perf_process_event_open");... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int test_process_multi_diff_addr_ro_wo(void) {
unsigned long long breaks1 = 0, breaks2 = 0;
int fd1, fd2;
char *desc =
"Process specific, Two events, diff addr, one is RO, other is WO";
size_t res;
fd1 = perf_process_event_open(HW_BREAKPOINT_W, (__u64)&a, (__u64)sizeof(a));
if (fd1 < 0) {
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int test_process_multi_same_addr_ro_wo(void) {
unsigned long long breaks1 = 0, breaks2 = 0;
int fd1, fd2;
char *desc =
"Process specific, Two events, same addr, one is RO, other is WO";
size_t res;
fd1 = perf_process_event_open(HW_BREAKPOINT_R, (__u64)&a, (__u64)sizeof(a));
if (fd1 < 0) {
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int test_syswide_multi_diff_addr(void) {
unsigned long long breaks1 = 0, breaks2 = 0;
int *fd1 = malloc(nprocs * sizeof(int));
int *fd2 = malloc(nprocs * sizeof(int));
char *desc = "Systemwide, Two events, diff addr";
int ret;
ret = perf_systemwide_event_open(fd1, HW_BREAKPOINT_RW, (__u64)&a,
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
static int runtest_multi_dawr(void) {
int ret = 0;
ret |= test_process_multi_diff_addr();
ret |= test_process_multi_same_addr();
ret |= test_process_multi_diff_addr_ro_wo();
ret |= test_process_multi_same_addr_ro_wo();
ret |= test_syswide_multi_diff_addr();
ret |= test_syswide_multi_same_addr();
ret |... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c |
int main(int argc, char *argv[], char **envp) {
return test_harness(perf_hwbreak, "perf_hwbreak");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c | static uint64_t rand_reg(void) {
uint64_t result;
long r;
r = random();
result = r & 0xffff;
if (r & 0x10000)
return result;
// Pointers tend to have high bits set
result |= random() << (__LONG_WIDTH__ - 31);
if (r & 0x100000)
return result;
// And sometimes we want a full 64-bit value
r... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c |
int ptrace_gpr(void) {
unsigned long seed;
int ret, status;
pid_t pid;
seed = getpid() ^ time(NULL);
printf("srand(%lu)\n", seed);
srand(seed);
child_gpr_val = rand_reg();
child_fpr_val = rand_reg();
parent_gpr_val = rand_reg();
parent_fpr_val = rand_reg();
shm_id = shmget(IPC_PRIVATE, sizeof(... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c |
int main(int argc, char *argv[]) {
return test_harness(ptrace_gpr, "ptrace_gpr");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-gpr.h | int validate_gpr(unsigned long *gpr, unsigned long val) {
int i, found = 1;
for (i = 0; i < 18; i++) {
if (gpr[i] != val) {
printf("GPR[%d]: %lx Expected: %lx\n", i + 14, gpr[i], val);
found = 0;
}
}
if (!found)
return TEST_FAIL;
return TEST_PASS;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c |
static bool dawr_present(struct ppc_debug_info *dbginfo) {
return !!(dbginfo->features & PPC_DEBUG_FEATURE_DATA_BP_DAWR);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c |
static void write_var(int len) {
__u8 *pcvar;
__u16 *psvar;
__u32 *pivar;
__u64 *plvar;
switch (len) {
case 1:
pcvar = (__u8 *)&glvar;
*pcvar = 0xff;
break;
case 2:
psvar = (__u16 *)&glvar;
*psvar = 0xffff;
break;
case 4:
pivar = (__u32 *)&glvar;
*pivar = 0xffffffff;
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c |
static void read_var(int len) {
__u8 cvar __attribute__((unused));
__u16 svar __attribute__((unused));
__u32 ivar __attribute__((unused));
__u64 lvar __attribute__((unused));
switch (len) {
case 1:
cvar = (__u8)glvar;
break;
case 2:
svar = (__u16)glvar;
break;
case 4:
ivar = (__u32... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c | static void test_sethwdebug_range_unaligned(pid_t child_pid) {
struct ppc_hw_breakpoint info;
unsigned long wp_addr;
char *name = "PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED";
int len;
int wh;
wp_addr = (unsigned long)&gstruct.b;
len = B_LEN;
get_ppc_hw_breakpoint(&info, PPC_BREAKPOINT_TRIGGER_WRI... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c | static void test_sethwdebug_range_unaligned_dar(pid_t child_pid) {
struct ppc_hw_breakpoint info;
unsigned long wp_addr;
char *name = "PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED, DAR OUTSIDE";
int len;
int wh;
wp_addr = (unsigned long)&gstruct.b;
len = B_LEN;
get_ppc_hw_breakpoint(&info, PPC_BREAK... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c |
static int perf_cpu_event_open(int cpu, __u64 addr, __u64 len) {
struct perf_event_attr attr;
perf_user_event_attr_set(&attr, addr, len);
return syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c |
static int perf_cpu_kernel_event_open(int cpu) {
struct perf_event_attr attr;
perf_kernel_event_attr_set(&attr);
return syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int child(void) {
int ret;
ret = ptrace(PTRACE_TRACEME, 0, NULL, 0);
if (ret) {
printf("Error: PTRACE_TRACEME failed\n");
return 0;
}
kill(getpid(), SIGUSR1);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int test1(pid_t child_pid) {
int perf_fd;
int ptrace_fd;
int ret = 0;
perf_fd = perf_cpu_event_open(0, (__u64)perf_data1, sizeof(*perf_data1));
if (perf_fd < 0)
return -1;
ptrace_fd =
ptrace_open(child_pid, (__u64)ptrace_data1, sizeof(*ptrace_data1));
if (ptrace_fd > 0 || errno != ENOSP... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int test6(pid_t child_pid) {
int perf_fd;
int ptrace_fd;
int ret = 0;
ptrace_fd =
ptrace_open(child_pid, (__u64)ptrace_data1, sizeof(*ptrace_data1));
if (ptrace_fd < 0)
return -1;
perf_fd = perf_thread_kernel_event_open(child_pid);
if (perf_fd < 0) {
ret = -1;
goto ptrace_close;... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int test10(pid_t child_pid) {
int perf_fd;
int ptrace_fd;
int ret = 0;
ptrace_fd =
ptrace_open(child_pid, (__u64)ptrace_data1, sizeof(*ptrace_data1));
if (ptrace_fd < 0)
return -1;
perf_fd = perf_cpu_event_open(0, (__u64)perf_data1, sizeof(*perf_data1));
if (perf_fd > 0 || errno != ENOS... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int test14(pid_t child_pid) {
int perf_fd;
int ptrace_fd;
int cpid;
int ret = 0;
ptrace_fd =
ptrace_open(child_pid, (__u64)ptrace_data1, sizeof(*ptrace_data1));
if (ptrace_fd < 0)
return -1;
cpid = fork();
if (!cpid) {
/* Temporary Child */
pause();
exit(EXIT_SUCCESS);
}... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c | static int ptrace_perf_hwbreak(void) {
int ret;
pid_t child_pid;
struct ppc_debug_info dbginfo;
child_pid = fork();
if (!child_pid)
return child();
wait(NULL); /* <-- child (SIGUSR1) */
get_dbginfo(child_pid, &dbginfo);
SKIP_IF(dbginfo.num_data_bps <= 1);
ret = perf_cpu_event_open(0, (__u64)pe... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c |
int main(int argc, char *argv[]) {
return test_harness(ptrace_perf_hwbreak, "ptrace-perf-hwbreak");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c |
int main(int argc, char *argv[]) {
return test_harness(ptrace_pkey, "ptrace_pkey");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tar.c | void tar(void) {
unsigned long reg[3];
int ret;
cptr = (int *)shmat(shm_id, NULL, 0);
printf("%-30s TAR: %u PPR: %lx DSCR: %u\n", user_write, TAR_1, PPR_1, DSCR_1);
mtspr(SPRN_TAR, TAR_1);
mtspr(SPRN_PPR, PPR_1);
mtspr(SPRN_DSCR, DSCR_1);
cptr[2] = 1;
while (!cptr[0])
asm volatile("" : : : "me... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tar.c |
int trace_tar(pid_t child) {
unsigned long reg[3];
FAIL_IF(start_trace(child));
FAIL_IF(show_tar_registers(child, reg));
printf("%-30s TAR: %lu PPR: %lx DSCR: %lu\n", ptrace_read_running, reg[0],
reg[1], reg[2]);
FAIL_IF(validate_tar_registers(reg, TAR_1, PPR_1, DSCR_1));
FAIL_IF(stop_trace(chil... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tar.c |
int trace_tar_write(pid_t child) {
FAIL_IF(start_trace(child));
FAIL_IF(write_tar_registers(child, TAR_2, PPR_2, DSCR_2));
printf("%-30s TAR: %u PPR: %lx DSCR: %u\n", ptrace_write_running, TAR_2,
PPR_2, DSCR_2);
FAIL_IF(stop_trace(child));
return TEST_PASS;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tar.c | int ptrace_tar(void) {
pid_t pid;
int ret, status;
SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07));
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777 | IPC_CREAT);
pid = fork();
if (pid < 0) {
perror("fork() failed");
return TEST_FAIL;
}
if (pid == 0)
tar();
if (pid) {
pptr = (int *... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tar.h |
int validate_tar_registers(unsigned long *reg, unsigned long tar,
unsigned long ppr, unsigned long dscr) {
int match = 1;
if (reg[0] != tar)
match = 0;
if (reg[1] != ppr)
match = 0;
if (reg[2] != dscr)
match = 0;
if (!match)
return TEST_FAIL;
return TEST_PASS;... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c |
int ptrace_tm_gpr(void) {
pid_t pid;
int ret, status;
SKIP_IF(!have_htm());
SKIP_IF(htm_is_synthetic());
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777 | IPC_CREAT);
pid = fork();
if (pid < 0) {
perror("fork() failed");
return TEST_FAIL;
}
if (pid == 0)
tm_gpr();
if (pid) {
pp... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c |
int trace_tm_spd_gpr(pid_t child) {
unsigned long gpr[18];
__u64 fpr[32];
FAIL_IF(start_trace(child));
FAIL_IF(show_gpr(child, gpr));
FAIL_IF(validate_gpr(gpr, GPR_4));
FAIL_IF(show_fpr(child, fpr));
FAIL_IF(validate_fpr(fpr, FPR_4_REP));
FAIL_IF(show_ckpt_fpr(child, fpr));
FAIL_IF(validate_fpr(fpr,... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c |
void wait_parent(void) {
cptr[2] = 1;
while (!cptr[1])
asm volatile("" : : : "memory");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c |
void tm_spd_vsx(void) {
unsigned long result, texasr;
int ret;
cptr = (int *)shmat(shm_id, NULL, 0);
trans:
cptr[2] = 0;
asm __volatile__("bl load_vsx_ckpt;"
"1: ;"
"tbegin.;"
"beq 2f;"
"bl load_vsx_new;"
"tsus... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c |
int main(int argc, char *argv[]) {
return test_harness(ptrace_tm_spd_vsx, "ptrace_tm_spd_vsx");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c |
void tm_vsx(void) {
unsigned long result, texasr;
int ret;
cptr = (unsigned long *)shmat(shm_id, NULL, 0);
trans:
cptr[1] = 0;
asm __volatile__("bl load_vsx_ckpt;"
"1: ;"
"tbegin.;"
"beq 2f;"
"bl load_vsx;"
"ts... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c |
int ptrace_tm_vsx(void) {
pid_t pid;
int ret, status, i;
SKIP_IF(!have_htm());
SKIP_IF(htm_is_synthetic());
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777 | IPC_CREAT);
for (i = 0; i < 128; i++) {
fp_load[i] = 1 + rand();
fp_load_ckpt[i] = 1 + 2 * rand();
fp_load_ckpt_new[i] = 1 + 3 * ran... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c |
int trace_vsx(pid_t child) {
unsigned long vsx[VSX_MAX];
unsigned long vmx[VMX_MAX + 2][2];
FAIL_IF(start_trace(child));
FAIL_IF(show_vsx(child, vsx));
FAIL_IF(validate_vsx(vsx, fp_load));
FAIL_IF(show_vmx(child, vmx));
FAIL_IF(validate_vmx(vmx, fp_load));
memset(vsx, 0, sizeof(vsx));
memset(vmx, 0... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h | int compare_vsx_vmx(unsigned long *store, unsigned long *load) {
int i;
for (i = 0; i < VSX_MAX; i++) {
if (store[1 + 2 * i] != load[1 + 2 * i]) {
printf("store[%d]: %lx load[%d] %lx\n", 1 + 2 * i, store[i], 1 + 2 * i,
load[i]);
return TEST_FAIL;
}
}
#if __BYTE_ORDER__ == __ORDE... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h |
int cont_trace(pid_t child) {
int ret;
ret = ptrace(PTRACE_CONT, child, NULL, NULL);
if (ret) {
perror("ptrace(PTRACE_CONT) failed");
return TEST_FAIL;
}
return TEST_PASS;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h |
int ptrace_read_regs(pid_t child, unsigned long type, unsigned long regs[],
int n) {
struct iovec iov;
long ret;
FAIL_IF(start_trace(child));
iov.iov_base = regs;
iov.iov_len = n * sizeof(unsigned long);
ret = ptrace(PTRACE_GETREGSET, child, type, &iov);
if (ret)
return ret;
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h |
int write_gpr(pid_t child, unsigned long val) {
struct pt_regs *regs;
int i, ret;
regs = (struct pt_regs *)malloc(sizeof(struct pt_regs));
if (!regs) {
perror("malloc() failed");
return TEST_FAIL;
}
ret = ptrace(PTRACE_GETREGS, child, NULL, regs);
if (ret) {
perror("ptrace(PTRACE_GETREGSET)... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h | int show_vmx(pid_t child, unsigned long vmx[][2]) {
int ret;
ret = ptrace(PTRACE_GETVRREGS, child, 0, vmx);
if (ret) {
perror("ptrace(PTRACE_GETVRREGS) failed");
return TEST_FAIL;
}
return TEST_PASS;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h | int show_tm_spr(pid_t child, struct tm_spr_regs *out) {
struct tm_spr_regs *regs;
struct iovec iov;
int ret;
regs = (struct tm_spr_regs *)malloc(sizeof(struct tm_spr_regs));
if (!regs) {
perror("malloc() failed");
return TEST_FAIL;
}
iov.iov_base = (u64 *)regs;
iov.iov_len = sizeof(struct tm_s... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h | inline unsigned long get_tfiar(void) {
unsigned long ret;
asm volatile("mfspr %0,%1" : "=r"(ret) : "i"(SPRN_TFIAR));
return ret;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/ptrace/ptrace.h |
void analyse_texasr(unsigned long texasr) {
printf("TEXASR: %16lx\t", texasr);
if (texasr & TEXASR_FP)
printf("TEXASR_FP ");
if (texasr & TEXASR_DA)
printf("TEXASR_DA ");
if (texasr & TEXASR_NO)
printf("TEXASR_NO ");
if (texasr & TEXASR_FO)
printf("TEXASR_FO ");
if (texasr & TEXASR... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/security/entry_flush.c |
int main(int argc, char *argv[]) {
return test_harness(entry_flush_test, "entry_flush_test");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/security/rfi_flush.c |
int main(int argc, char *argv[]) {
return test_harness(rfi_flush_test, "rfi_flush_test");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigfuz.c | static void mess_with_tm(void) {
if (one_in_chance(3)) {
asm("tbegin. ;"
"beq 8 ;");
/* And suspended half of them */
if (one_in_chance(2))
asm("tsuspend. ;");
}
/* Call 'tend' in 5% of the runs */
if (one_in_chance(20))
asm("tend. ;");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigfuz.c | static void seg_signal_handler(int signo, siginfo_t *si, void *uc) { exit(0); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigfuz.c | int main(int argc, char **argv) {
int opt;
while ((opt = getopt(argc, argv, "bamxt:fi:h")) != -1) {
if (opt == 'b') {
printf("Mess with TM before signal\n");
args |= ARG_MESS_WITH_TM_BEFORE;
} else if (opt == 'a') {
printf("Mess with TM at signal handler\n");
args |= ARG_MESS_WITH_T... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigreturn_kernel.c |
static pid_t fork_child(void) {
pid_t pid;
pid = fork();
if (pid == 0) {
raise(SIGUSR1);
exit(0);
}
return pid;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigreturn_unaligned.c |
static void sigusr1_handler(int signo, siginfo_t *info, void *ptr) {
ucontext_t *uc = ptr;
UCONTEXT_NIA(uc) |= 3;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigreturn_vdso.c |
static void sigusr1_handler(int sig) { took_signal++; } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigreturn_vdso.c | int test_sigreturn_vdso(void) {
unsigned long low, high, size;
struct sigaction act;
char *p;
act.sa_handler = sigusr1_handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
assert(sigaction(SIGUSR1, &act, NULL) == 0);
assert(search_proc_maps("[vdso]", &low, &high) == 0);
size = high - low + 1;
pr... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sigreturn_vdso.c |
int main(void) { return test_harness(test_sigreturn_vdso, "sigreturn_vdso"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c |
static ssize_t raw_read(int fd, void *buf, size_t count) {
register long nr asm("r0") = __NR_read;
register long _fd asm("r3") = fd;
register void *_buf asm("r4") = buf;
register size_t _count asm("r5") = count;
asm volatile(" b 0f \n"
" b 1f \n"
" 0: sc 0 \n"
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/stringloops/memcmp.c |
void exit_vmx_ops(void) { vmx_count--; } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/stringloops/memcmp.c | static void test_one(char *s1, char *s2, unsigned long max_offset,
unsigned long size_start, unsigned long max_size) {
unsigned long offset, size;
for (offset = 0; offset < max_offset; offset++) {
for (size = size_start; size < (max_size - offset); size++) {
int x, y;
unsigned ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/stringloops/memcmp.c |
int main(void) {
test_harness_set_timeout(300);
return test_harness(testcases, "memcmp");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/stringloops/strlen.c | static void test_one(char *s) {
unsigned long offset;
for (offset = 0; offset < SIZE; offset++) {
int x, y;
unsigned long i;
y = strlen(s + offset);
x = test_strlen(s + offset);
if (x != y) {
printf("strlen() returned %d, should have returned %d (%p offset %ld)\n",
x, y, s,... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/stringloops/strlen.c |
static void bench_test(char *s) {
struct timespec ts_start, ts_end;
int i;
clock_gettime(CLOCK_MONOTONIC, &ts_start);
for (i = 0; i < ITERATIONS_BENCH; i++)
test_strlen(s);
clock_gettime(CLOCK_MONOTONIC, &ts_end);
printf("len %3.3d : time = %.6f\n", test_strlen(s),
ts_end.tv_sec - ts_start... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/syscalls/rtas_filter.c |
static int read_kregion_bounds(struct region *kregion) {
char *buf;
int fd;
int rc;
fd = open("/proc/ppc64/rtas/rmo_buffer", O_RDONLY);
if (fd < 0) {
printf("Could not open rmo_buffer file\n");
return RTAS_IO_ASSERT;
}
rc = read_entire_file(fd, &buf, NULL);
close(fd);
if (rc) {
free(buf... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-fork.c |
int main(int argc, char *argv[]) { return test_harness(test_fork, "tm_fork"); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | int test_body(void) {
uint64_t rv, dscr1 = 1, dscr2, texasr;
SKIP_IF(!have_htm());
SKIP_IF(htm_is_synthetic());
printf("Check DSCR TM context switch: ");
fflush(stdout);
for (;;) {
asm __volatile__(
"ld 3, %[dscr1];"
"mtspr %[sprn_dscr], 3;"
"li %[rv], 1;"
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-context-chk-fpu.c | static int tm_signal_context_chk_fpu() {
struct sigaction act;
int i;
long rc;
pid_t pid = getpid();
SKIP_IF(!have_htm());
SKIP_IF(htm_is_synthetic());
act.sa_sigaction = signal_usr1;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
if (sigaction(SIGUSR1, &act, NULL) < 0) {
perror("sigact... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-context-chk-fpu.c |
int main(void) {
return test_harness(tm_signal_context_chk_fpu, "tm_signal_context_chk_fpu");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | void seg_signal_handler(int signo, siginfo_t *si, void *uc) {
count++;
setcontext(&init_context);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c |
int main(int argc, char **argv) {
test_harness(tm_signal_context_force_tm, "tm_signal_context_force_tm");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-pagefault.c | void signal_handler(int signo, siginfo_t *si, void *uc) {
ucontext_t *ucp = uc;
ucp->uc_link->uc_mcontext.regs->nip += 4;
ucp->uc_mcontext.v_regs =
get_uf_mem(sizeof(elf_vrreg_t), ucp->uc_mcontext.v_regs);
ucp->uc_link->uc_mcontext.v_regs =
get_uf_mem(sizeof(elf_vrreg_t), ucp->uc_link->uc_mcontex... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-pagefault.c |
bool have_userfaultfd(void) {
long rc;
errno = 0;
rc = syscall(__NR_userfaultfd, -1);
return rc == 0 || errno != ENOSYS;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c | void trap_signal_handler(int signo, siginfo_t *si, void *uc) {
ucontext_t *ucp = (ucontext_t *)uc;
asm("tbegin.; tsuspend.;");
ucp->uc_mcontext.regs->nip += 4;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/powerpc/tm/tm-signal-stack.c | void signal_segv(int signum) { exit(1); } | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.