当前位置: 首页>>代码示例>>Python>>正文


Python Memory.read_dword方法代码示例

本文整理汇总了Python中memory.Memory.read_dword方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.read_dword方法的具体用法?Python Memory.read_dword怎么用?Python Memory.read_dword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在memory.Memory的用法示例。


在下文中一共展示了Memory.read_dword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Device

# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import read_dword [as 别名]

#.........这里部分代码省略.........
    def map_registers(self):
        self.reg = cast(self.bar0, POINTER(c_uint32 * (0x8000 / 4))).contents

        for (name, offset, t) in tg3_blocks:
            setattr(self, name, self.block_at(name, offset, t))
            self.blocks += [getattr(self, name)]

    def map_memory(self):
        print "[+] mapping device memory window"
        self.mem = Memory(self)
        for i in tg3_mem:
            self.mem.map_struct(*i)

    def reg_dump(self):
        for i in range(len(self.reg)):
            a = i * 4
            if 0 == (a % 0x10):
                print
                print "0x%04x: " % a,
            print "%08x" % self.reg[i],

    def reg_save(self):
        buf = (c_uint32 * len(self.reg))()
        for i in range(len(self.reg)):
            buf[i] = self.reg[i]
        return buf

    
    
    def reset(self, cold = None, quick = False, pcie = False):
	if cold == None:
	    cold = not hasattr(self, "drv")

        magic = self.mem.read_dword(0xb50)	
        print "[+] found %08x at offset 0xb50," % magic, 
	if not cold:
	    print "writing 0x4b657654"
            self.mem.write_dword(0xb50, 0x4b657654)
	else:
	    print "clearing"
	    self.mem.write_dword(0xb50, 0)

        if not cold:
	    try:
		self.nvram.acquire_lock()
	    except:
		print "\n[-] failed to acquire nvram lock"
		self.rxcpu.halt()
		self.nvram.reset()
		self.nvram.acquire_lock()

	print "[+] clearing fast boot program counter register,",
	print "was %08x" % self.grc.fastboot_pc.word
	self.grc.fastboot_pc.word = 0

        if not pcie:
            if self.grc.misc_config.disable_grc_reset_on_pcie_block == 0:
                print "[+] disabling grc reset on pcie block"
                self.grc.misc_config.disable_grc_reset_on_pcie_block = 1
	
        if not cold:
            if self.grc.misc_config.gphy_keep_power_during_reset == 0:
                print "[+] enabling gphy power during reset"
                self.grc.misc_config.gphy_keep_power_during_reset = 1

        print "[+] resetting core clocks"
开发者ID:kamilion,项目名称:thundergate,代码行数:70,代码来源:device.py


注:本文中的memory.Memory.read_dword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。