* Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
* libkperf licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
* Author: Mr.Jin
* Create: 2024-04-03
* Description: get-spe-data interface and spe-packet definitions
******************************************************************************/
#ifndef __SPE__DECODER_HH__
#define __SPE__DECODER_HH__
#include <cstdint>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/perf_event.h>
enum class SpePacketType {
SPE_PACKET_BAD,
SPE_PACKET_ADDRESS,
SPE_PACKET_CONTEXT,
SPE_PACKET_COUNTER,
SPE_PACKET_DATA_SOURCE,
SPE_PACKET_END,
SPE_PACKET_EVENTS,
SPE_PACKET_OP_TYPE,
SPE_PACKET_PAD,
SPE_PACKET_TIMESTAMP,
};
#define SPE_OP_CLASS_LD_ST_ATOMIC 0x1
#define SPE_OP_PACKET_ST (1ULL << 0)
#define SPE_OP_PACKET_AT (1ULL << 2)
#define SPE_OP_PACKET_EXCL (1ULL << 3)
#define SPE_OP_PACKET_AR (1ULL << 4)
enum SpeOpType {
SPE_OP_OTHER = 1 << 0,
SPE_OP_LDST = 1 << 1,
SPE_OP_BRANCH_ERET = 1 << 2,
};
struct SpePacket {
enum SpePacketType type;
uint64_t payload;
uint16_t header;
uint16_t payloadSize;
};
struct SpeRecord;
SpeRecord *SpeGetRecord(uint8_t *buf, uint8_t *end, struct SpeRecord *rec, int *remainSize);
#endif