组装括号中的* ALL *种可能的算术方法是什么? [英] Assembly What are *ALL* possible arithmetic possibilities in brackets?

查看:75
本文介绍了组装括号中的* ALL *种可能的算术方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将x86 asm转换为C代码仿真器..对于我的解析器,我要进行括号内的解析

I'm making a x86 asm to C code emulator.. and for my parser I am up to the bracket parsing

QWORD PTR []

DWORD PTR []

WORD PTR []

BYTE PTR []

MOV X,[ ]

LEA X,[]

现在我将忽略。

MMWORD PTR []

XMMWORD PTR []

FWORD PTR []

TBYTE PTR []

我想知道放在方括号中的所有可能数学运算是什么

I want to know what are all the possible mathematical arithmetic can that be placed in the brackets

我遇到的最复杂的东西是..
[EBP + ECX * 4-E0]

Most complex I have encountered is.. [EBP+ECX*4-E0]

我必须解析的原因是将 E0 转换为 0x000000E0 然后是 4 0x00000004

The reason I have to parse is to convert E0 to 0x000000E0 then 4 to 0x00000004

据我所知 + - * 可能是 \ 和或 / 也是可能的,或者点呢?

As far as I know +, -, * are possible is \ and or / possible too, or how about dots? .?

我想出了分割每条包含方括号 []的指令的最佳方法/ code>获取内部数学。
然后将内部数学除以1个字符定界符 +-*

I figure best way to split every instruction which contains brackets [] to get inner math. Then split the inner math by 1 char delimiters +-*.

我要确保我都知道了吗这些有可能分裂吗?还是不进行XOR / OR / AND / NOT?

I want to make sure I get them all? is division ever possible in these? or not how about XOR/OR/AND/NOT ?

推荐答案

括号内是地址表达式。英特尔x86处理器家族支持某些地址操作,例如具有基址寄存器,添加偏移量以及以2,4或8进行缩放。某些汇编程序允许对结构中的字段进行点分隔引用,作为基本偏移量表达式的一部分。除了计算基本偏移量外,括号内的算术不是在汇编时进行数学运算,而是对要在运行时计算的指令地址部分进行编码。

What's inside the brackets are address expressions. The Intel x86 family of processors supports certain address operations, like having a base register, adding an offset, and scaling with 2,4 or 8. Some assemblers allow dotted references to fields in structures as part of the base offset expression. Except for calculating the base offset, the 'math' inside the brackets is not math done at assembly time but the encoding of the address portion of the instruction to be calculated at run-time.

这篇关于组装括号中的* ALL *种可能的算术方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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