#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # libxed.py: Python wrapper for libxed.so # Copyright (c) 2014-2021, Intel Corporation. # To use Intel XED, libxed.so must be present. To build and install # libxed.so: # git clone https://github.com/intelxed/mbuild.git mbuild # git clone https://github.com/intelxed/xed # cd xed # ./mfile.py --share # sudo ./mfile.py --prefix=/usr/local install # sudo ldconfig # import sys from ctypes import CDLL, Structure, create_string_buffer, addressof, sizeof, \ c_void_p, c_bool, c_byte, c_char, c_int, c_uint, c_longlong, c_ulonglong # XED Disassembler class xed_state_t(Structure): _fields_ = [ ("mode", c_int), ("width", c_int) ] class XEDInstruction(): def __init__(self, libxed): # Current xed_decoded_inst_t structure is 192 bytes. Use 512 to allow for future expansion xedd_t = c_byte * 512 self.xedd = xedd_t() self.xedp = addressof(self.xedd) libxed.xed_decoded_inst_zero(self.xedp) self.state = xed_state_t() self.statep = addressof(self.state) # Buffer for disassembled instruction text self.buffer = create_string_buffer(256) self.bufferp = addressof(self.buffer) class LibXED(): def __init__(self): try: self.libxed = CDLL("libxed.so") except: self.libxed = None if not self.libxed: self.libxed = CDLL("/usr/local/lib/libxed.so") self.xed_tables_init = self.libxed.xed_tables_init self.xed_tables_init.restype = None self.xed_tables_init.argtypes = [] self.xed_decoded_inst_zero = self.libxed.xed_decoded_inst_zero self.xed_decoded_inst_zero.restype = None self.xed_decoded_inst_zero.argtypes = [ c_void_p ] self.xed_operand_values_set_mode = self.libxed.xed_operand_values_set_mode self.xed_operand_values_set_mode.restype = None self.xed_operand_values_set_mode.argtypes = [ c_void_p, c_void_p ] self.xed_decoded_inst_zero_keep_mode = self.libxed.xed_decoded_inst_zero_keep_mode self.xed_decoded_inst_zero_keep_mode.restype = None self.xed_decoded_inst_zero_keep_mode.argtypes = [ c_void_p ] self.xed_decode = self.libxed.xed_decode self.xed_decode.restype = c_int self.xed_decode.argtypes = [ c_void_p, c_void_p, c_uint ] self.xed_format_context = self.libxed.xed_format_context self.xed_format_context.restype = c_uint self.xed_format_context.argtypes = [ c_int, c_void_p, c_void_p, c_int, c_ulonglong, c_void_p, c_void_p ] self.xed_tables_init() def Instruction(self): return XEDInstruction(self) def SetMode(self, inst, mode): if mode: inst.state.mode = 4 # 32-bit inst.state.width = 4 # 4 bytes else: inst.state.mode = 1 # 64-bit inst.state.width = 8 # 8 bytes self.xed_operand_values_set_mode(inst.xedp, inst.statep) def DisassembleOne(self, inst, bytes_ptr, bytes_cnt, ip): self.xed_decoded_inst_zero_keep_mode(inst.xedp) err = self.xed_decode(inst.xedp, bytes_ptr, bytes_cnt) if err: return 0, "" # Use AT&T mode (2), alternative is Intel (3) ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0) if not ok: return 0, "" if sys.version_info[0] == 2: result = inst.buffer.value else: result = inst.buffer.value.decode() # Return instruction length and the disassembled instruction text # For now, assume the length is in byte 166 return inst.xedd[166], result 3.7.y'>linux-3.7.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
path: root/fs/Kconfig
AgeCommit message (Expand)Author
2025-04-25nfs: add missing selections of CONFIG_CRC32Eric Biggers
2024-10-03nfs_common: fix Kconfig for NFS_COMMON_LOCALIO_SUPPORTMike Snitzer
2024-09-24Merge tag 'nfs-for-6.12-1' of git://git.linux-nfs.org/projects/anna/linux-nfsLinus Torvalds
2024-09-23nfs_common: add NFS LOCALIO auxiliary protocol enablementMike Snitzer
2024-09-01mm/hugetlb: enforce that PMD PT sharing has split PMD PT locksDavid Hildenbrand
2024-03-14Merge tag 'mm-stable-2024-03-13-20-04' of git://git.kernel.org/pub/scm/linux/...Linus Torvalds
2024-03-13pidfs: remove config optionChristian Brauner
2024-03-11Merge tag 'vfs-6.9.pidfd' of git://git.kernel.org/pub/scm/linux/kernel/git/vf...Linus Torvalds
2024-03-06hugetlb: have CONFIG_HUGETLBFS select CONFIG_PADATAGang Li
2024-03-01pidfd: add pidfsChristian Brauner
2024-02-22dax: check for data cache aliasing at runtimeMathieu Desnoyers
2024-01-24fs: Remove NTFS classicMatthew Wilcox (Oracle)
2024-01-19Merge tag 'vfs-6.8.netfs' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs...Linus Torvalds
2024-01-09Merge tag 'mm-stable-2024-01-08-15-31' of git://git.kernel.org/pub/scm/linux/...Linus Torvalds
2024-01-08Merge tag 'vfs-6.8.rw' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfsLinus Torvalds
2023-12-24netfs, fscache: Move fs/fscache/* into fs/netfs/David Howells
2023-12-23fs: prepare for stackable filesystems backing file helpersAmir Goldstein
2023-12-10fs/Kconfig: make hugetlbfs a menuconfigPeter Xu
2023-12-06mm/hugetlb: have CONFIG_HUGETLB_PAGE select CONFIG_XARRAY_MULTISidhartha Kumar
2023-11-01Merge tag 'asm-generic-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/...Linus Torvalds
2023-10-22bcachefs: Initial commitKent Overstreet
2023-09-11arch: Remove Itanium (IA-64) architectureArd Biesheuvel
2023-08-29Merge tag 'for-6.6/block-2023-08-28' of git://git.kernel.dk/linuxLinus Torvalds
2023-08-29Merge tag 'mm-stable-2023-08-28-18-26' of git://git.kernel.org/pub/scm/linux/...Linus Torvalds
2023-08-18mm/vmemmap optimization: split hugetlb and devdax vmemmap optimizationAneesh Kumar K.V
2023-08-18mm: make MEMFD_CREATE into a selectable config optionThomas Weißschuh
2023-08-10tmpfs,xattr: enable limited user extended attributesHugh Dickins
2023-08-09shmem: prepare shmem quota infrastructureCarlos Maiolino
2023-08-02fs: add CONFIG_BUFFER_HEADChristoph Hellwig
2023-05-24smb: move client and server files to common directory fs/smbSteve French
2023-04-18mm/hugetlb_vmemmap: rename ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAPAneesh Kumar K.V
2023-01-26fs: build the legacy direct I/O code conditionallyChristoph Hellwig