Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disassembler: Add option to get register offsets #576

Open
Symbai opened this issue Jun 22, 2024 · 2 comments
Open

Disassembler: Add option to get register offsets #576

Symbai opened this issue Jun 22, 2024 · 2 comments

Comments

@Symbai
Copy link
Contributor

Symbai commented Jun 22, 2024

For displacement and immediate we can get the offsets. For used registers we currently cannot. I'd like to request the possibility to retrieve the offsets for registers too (C#).

In my scenario I have an array of bytes where some registers are wildcarded. I need to know which register(s) was wildcarded from this array to deal with it later on.

namespace Iced.Intel {

	public readonly struct UsedRegister {

		public Register Register;
		public OpAccess Access;
++		public byte Offset;

	}
}
@wtfsck
Copy link
Member

wtfsck commented Jun 23, 2024

Register bits can be in multiple bytes, eg. one bit could be in the REX prefix and 3 other bits in the modrm byte, or the bits could be in different bytes in the VEX/EVEX/etc prefix. So there's no single byte offset that could be returned.

@Symbai
Copy link
Contributor Author

Symbai commented Jun 23, 2024

And when the instruction has no prefix? I can change the proposed property to nullable byte so that it only returns the offset if its possible and null when its not, like in the cases you mentioned.

Edit: Here is an example of an instruction where a register is wildcarded: 48 8B ?? 30 => mov rsi,[r??+30]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants