OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 4:20 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GDT: Downside of Basic Flat Model?
PostPosted: Wed Mar 28, 2018 7:21 am 
Offline

Joined: Wed Mar 28, 2018 6:33 am
Posts: 5
Hi, I've been lurking here for a while and started working on a kernel (whenever I'm not procrastinating), starting with the Barebones tutorial.
Currently I've got paging implemented with higher half, but I'm a bit confused by the GDT (I actually wanted to implement interrupts so I can catch Page Faults, but the wiki mentioned I should do the GDT first), so I decided to finally make an account and ask.

The Intel Manual mentions that models other than the basic flat model have hardware protections against program bugs.

What exactly are these protections and how relevant are they while using paging?
Are there any downsides to just using the basic flat model? (Any reason I should not use it? Is it a security issue?)
What should I be considering to pick the right model?


Top
 Profile  
 
 Post subject: Re: GDT: Downside of Basic Flat Model?
PostPosted: Wed Mar 28, 2018 11:50 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
No modern compiler or runtime supports non-flat models. That's a huge disadvantage that most people are not accepting (including Linux, Windows and all other common kernels). There have been some religious wars about whether x86 segmentation provides any meaningful provides any benefit at all (you can use the search function for that) but a majority of frequent users (me including) thinks that this is not the case.

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: GDT: Downside of Basic Flat Model?
PostPosted: Wed Mar 28, 2018 12:03 pm 
Offline

Joined: Wed Mar 28, 2018 6:33 am
Posts: 5
Korona wrote:
No modern compiler or runtime supports non-flat models. That's a huge disadvantage that most people are not accepting (including Linux, Windows and all other common kernels). There have been some religious wars about whether x86 segmentation provides any meaningful provides any benefit at all (you can use the search function for that) but a majority of frequent users (me including) thinks that this is not the case.


Alright, I'll be going with the flat model, then. Thanks.

I assume the segmentation itself is just there for historical/backwards compatibility reasons, since there is paging now?


Top
 Profile  
 
 Post subject: Re: GDT: Downside of Basic Flat Model?
PostPosted: Wed Mar 28, 2018 12:07 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
In Linux, Windows and the other established x86 kernels, yes, it is ignored as much as possible and Intel only includes it for backwards compatibility. You cannot disable it so you live with it and set all segments to a flat model. On x86_64 segmentation is not functional any more (i.e. segment limits are ignored).

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group