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

Thread.get_linear_address doesn't take into account the segment's granularity #57

Open
MIvanchev opened this issue Feb 17, 2020 · 2 comments
Labels

Comments

@MIvanchev
Copy link
Contributor

Thread.get_linear_address is currently (almost) guaranteed to cause an exception due to an address too large. The reason is that the limit calculation must take into account the granularity of the segment. As state here & here the granularity is either in bytes or pages. Now, the Microsoft docs are not explicit on that, but the granularity affects the calculation of the segment's limit, see for instance the ReactOS source (Line 164).

As a side note, my fix for #55 forgot to address the formatting of the error's text for the case where no segment is given. Might be a good idea to do it here...

@MarioVilas MarioVilas added the bug label Feb 18, 2020
@MarioVilas
Copy link
Owner

I'm guessing older versions of Windows always had the same granularity, and that changed later?

@MIvanchev
Copy link
Contributor Author

I'm guessing older versions of Windows always had the same granularity, and that changed later?

I actually have no idea about this one. I noticed it yesterday while doing some segmentation experiments. I always got "Address too large" even for the default segment base of 0. It was then that I found out about it. Protected mode segmentation seems to be surrounded by a great deal of obscurity...

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

No branches or pull requests

2 participants