Skip to content

Convert ZydisDecoder field decoder_mode to a bitmap.#435

Merged
athre0z merged 1 commit intozyantific:masterfrom
jpidancet:decoder-mode-bitmap
Apr 25, 2023
Merged

Convert ZydisDecoder field decoder_mode to a bitmap.#435
athre0z merged 1 commit intozyantific:masterfrom
jpidancet:decoder-mode-bitmap

Conversation

@jpidancet
Copy link
Copy Markdown
Contributor

Make decoder_mode a bitmap instead of an array of booleans for space efficiency.

Copy link
Copy Markdown
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, but it seems like some stuff needs to be fixed before merging 🙂

The regression tests are failing and the fuzzer complains as well.

Make decoder_mode a bitmap instead of an array of booleans for space
efficiency.
@jpidancet jpidancet force-pushed the decoder-mode-bitmap branch from 2e27d4b to 261f0ee Compare April 19, 2023 07:41
@jpidancet
Copy link
Copy Markdown
Contributor Author

Hi,

Thank you for having a look. It looks like the || vs | mix-up was causing all the build and fuzzing errors. It is fixed now.

@jpidancet jpidancet requested a review from flobernd April 19, 2023 08:01
@flobernd
Copy link
Copy Markdown
Member

flobernd commented Apr 19, 2023

@jpidancet Thanks for fixing! I will merge if @athre0z agrees as well.

@athre0z @th0rex fyi, this is a breaking change for the JS, Rust, etc. bindings 🙂

For v5 I would like to change the public API for this entirely (ZydisDecoderEnableMode(mode) -> ZydisDecoderSetModes(bitmask) and converting the ZYDIS_DECODER_MODE_X constants to bits), but for now it's probably better to keep the current API.

@athre0z
Copy link
Copy Markdown
Member

athre0z commented Apr 19, 2023

For v5 I would like to change the public API for this entirely (ZydisDecoderEnableMode(mode) -> ZydisDecoderSetModes(bitmask) and converting the ZYDIS_DECODER_MODE_X constants to bits), but for now it's probably better to keep the current API.

We can do this in a non-breaking manner by just adding such a function without removing the old one. I think this would be preferable here since maintaining the old function is very little effort. We can mark the old function as deprecated and remove it in a few years, or just keep it around forever. Changing the constants is not API breaking, only ABI breaking, so can be done in a minor version.

Copy link
Copy Markdown
Member

@athre0z athre0z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good change!

@athre0z athre0z merged commit 6d820cc into zyantific:master Apr 25, 2023
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

Successfully merging this pull request may close these issues.

3 participants