pt_regs 结构中的 eax 在哪里?只有斧头存在 [英] Where is eax in the pt_regs struct? Only ax is present

查看:11
本文介绍了pt_regs 结构中的 eax 在哪里?只有斧头存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 pt_regs 结构来获取和设置诸如 eax 之类的寄存器,但是编译错误告诉我 pt_regs 没有这样的成员eax.

I am trying to use the pt_regs struct to get and set registers such as eax, but compilation errors tell me that pt_regs has no such member eax.

但是,我能够获得 ax 寄存器.谁能告诉我发生了什么?

However, I am able to get the ax register. Can anybody tell me what is happening?

我使用带有 3.0.0 内核的 32 位 Ubuntu linux.再次感谢.

I am using 32-bit Ubuntu linux with the 3.0.0 kernel. Thank you again.

推荐答案

看看arch/x86/include/asm/ptrace.h.

Take a look at the definition of struct pt_regs in arch/x86/include/asm/ptrace.h.

注意#ifndef __KERNEL__ 里面的东西,这意味着该结构的定义对于内核模式和用户模式代码是不同的.

Notice #ifndef __KERNEL__ stuff there, it means that the definition of that structure is different for kernel-mode and user-mode code.

对于内核代码,pt_regs::ax 可能就是你需要的值.它应该包含 %eax 在 32 位系统上的值和 %rax 在 64 位系统上的值.

For the kernel code, pt_regs::ax is probably the value you need. It should contain the value of %eax on a 32-bit system and %rax on a 64-bit one.

这篇关于pt_regs 结构中的 eax 在哪里?只有斧头存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆