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

Remove the data segment from assembly 64-bit GDT #278

Merged
merged 3 commits into from Jan 14, 2017

Conversation

Projects
None yet
1 participant
@phil-opp
Copy link
Owner

phil-opp commented Jan 14, 2017

The Intel and AMD manuals state that no data segment is needed in 64-bit mode. However, the iretq instruction expects a valid data segment selector or a null selector in the ss register.

This PR removes all ignored fields from the GDT structure overview in Entering Long Mode. It also removes the data segment from the assembly 64-bit GDT and no longer reloads the data segment registers before jumping to 64-bit mode. Instead, we reload them with null selectors after we're in 64-bit mode.

Fixes #273
Fixes #277

phil-opp added some commits Jan 12, 2017

Load null selectors to all data registers
This is required for some instructions such as iretq (ss must be valid or 0).
Update GDT code in post (no data segments anymore)
We also load 0 into all data segment registers to avoid future problems with iretq. Also: minor wording improvements.

@phil-opp phil-opp merged commit 0ec93fc into master Jan 14, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@phil-opp phil-opp deleted the gdt-without-data-segment branch Jan 14, 2017

@phil-opp

This comment has been minimized.

Copy link
Owner Author

phil-opp commented Jan 15, 2017

Cherry-picked e179dad and 8f8b46a to entering_longmode set_up_rust printing_to_screen allocating_frames page_tables remap_the_kernel kernel_heap catching_exceptions better_exception_messages returning_from_exceptions double_faults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.