wp.c (a713ca234ea9d946235ac7248995c5fddfd9e523) wp.c (ccb05590c4325ce50b1c0deedd54d5f24f4f1652)
1// SPDX-License-Identifier: GPL-2.0
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include <sys/ioctl.h>
6#include <linux/hw_breakpoint.h>
7#include <linux/kernel.h>
8#include "tests.h"

--- 7 unchanged lines hidden (view full) ---

16 long long count; \
17 wp_read(fd, &count, sizeof(long long)); \
18 TEST_ASSERT_VAL(text, count == val); \
19} while (0)
20
21volatile u64 data1;
22volatile u8 data2[3];
23
1// SPDX-License-Identifier: GPL-2.0
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include <sys/ioctl.h>
6#include <linux/hw_breakpoint.h>
7#include <linux/kernel.h>
8#include "tests.h"

--- 7 unchanged lines hidden (view full) ---

16 long long count; \
17 wp_read(fd, &count, sizeof(long long)); \
18 TEST_ASSERT_VAL(text, count == val); \
19} while (0)
20
21volatile u64 data1;
22volatile u8 data2[3];
23
24#ifndef __s390x__
24static int wp_read(int fd, long long *count, int size)
25{
26 int ret = read(fd, count, size);
27
28 if (ret != size) {
29 pr_debug("failed to read: %d\n", ret);
30 return -1;
31 }

--- 11 unchanged lines hidden (view full) ---

43 attr->bp_addr = (unsigned long)wp_addr;
44 attr->bp_len = wp_len;
45 attr->sample_period = 1;
46 attr->sample_type = PERF_SAMPLE_IP;
47 attr->exclude_kernel = 1;
48 attr->exclude_hv = 1;
49}
50
25static int wp_read(int fd, long long *count, int size)
26{
27 int ret = read(fd, count, size);
28
29 if (ret != size) {
30 pr_debug("failed to read: %d\n", ret);
31 return -1;
32 }

--- 11 unchanged lines hidden (view full) ---

44 attr->bp_addr = (unsigned long)wp_addr;
45 attr->bp_len = wp_len;
46 attr->sample_period = 1;
47 attr->sample_type = PERF_SAMPLE_IP;
48 attr->exclude_kernel = 1;
49 attr->exclude_hv = 1;
50}
51
51#ifndef __s390x__
52static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
53{
54 int fd;
55 struct perf_event_attr attr;
56
57 get__perf_event_attr(&attr, wp_type, wp_addr, wp_len);
58 fd = sys_perf_event_open(&attr, 0, -1, -1,
59 perf_event_open_cloexec_flag());

--- 142 unchanged lines hidden ---
52static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
53{
54 int fd;
55 struct perf_event_attr attr;
56
57 get__perf_event_attr(&attr, wp_type, wp_addr, wp_len);
58 fd = sys_perf_event_open(&attr, 0, -1, -1,
59 perf_event_open_cloexec_flag());

--- 142 unchanged lines hidden ---