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

Probable bug in gdt.cpp #4

Open
sorjon02 opened this issue May 12, 2017 · 5 comments
Open

Probable bug in gdt.cpp #4

sorjon02 opened this issue May 12, 2017 · 5 comments

Comments

@sorjon02
Copy link

Line 35 in gdt.cpp reads: "if (limit <= 65536)". This is a reference to a memory adress, and a memory adress always start at 0. I recognize the number 65536 as 2^16 so the correct line should probably be "if (limit < 65536)", allowing for memory address from 0 to 65535. Please examine the code and check if I have noticed a bona fide bug.

@mpetch
Copy link

mpetch commented Apr 30, 2018

Not a bug from what I can tell. The GDT and IDT have a limit that is unique. The value 1 needs to be subtracted from the real limit (per the Intel documentation). GDT and IDT are designed so that a limit of 0 isn't possible. He checks that the pre-adjusted limit <= 65536. 65536 will be stored as 65536-1 (65535).

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

3 participants
@mpetch @sorjon02 and others