OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 25, 2018 7:44 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Data structures of kernel that directly accessed by CPU
PostPosted: Sun Apr 16, 2017 6:51 am 
Offline

Joined: Sun Apr 16, 2017 4:04 am
Posts: 3
Hi everyone,

I'm thinking how to find all data structures of a kernel that directly accessed by CPU hardware. For example, the page table, whose physical address is stored in the TTBR (ARM architecture). If the CPU doesn't know the addresses of such data structures, it cannot run. For data structures such as stack or heap, their address are virtual addresses, so the CPU doesn't directly access them but by MMU. We only consider CPU modes that the MMU is enabled, so we don't consider the real mode of x86, in which all kernel data structures are accessed by physical address.

The reason of finding such data structures is that I think these data structures forms the minimal data collection that supports the CPU to run properly. So far, I only find two such kinds of data structures, the page table and the exception table, both of whose addresses are stored in CPU's registers. One way of find such data structures is by checking all registers of defined by the CPU architecture reference manual one by one. Does anybody have some better way?

Best Regards,
Shijun


Top
 Profile  
 
 Post subject: Re: Data structures of kernel that directly accessed by CPU
PostPosted: Sun Apr 16, 2017 10:10 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
you dont have to crawl for them, if you copy all of your important data to a buffer previously.

_________________
Operating system for SUBLEQ cpu architecture:
http://gerigeri.uw.hu/DawnOS/index.html


Top
 Profile  
 
 Post subject: Re: Data structures of kernel that directly accessed by CPU
PostPosted: Thu Nov 09, 2017 8:34 am 
Offline
Member
Member

Joined: Sat Jan 21, 2017 7:35 am
Posts: 35
Hi shijun,

Yes, for each CPU, you should maintain a Processor descriptor which contains the data structures (or pointers to them), so you can easily access them from other CPUs as well. To separate your platform independent & architectural data, keep the architectural data at the end of the structure with a more abstract type (which is for the being-compiled-for machine). This way you could implement processor-status updating and locks to run-queues.

Regards,
Shukant Pal


Top
 Profile  
 
 Post subject: Re: Data structures of kernel that directly accessed by CPU
PostPosted: Thu Nov 09, 2017 9:18 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8337
Location: At his keyboard!
Hi,

shijun wrote:
So far, I only find two such kinds of data structures, the page table and the exception table, both of whose addresses are stored in CPU's registers. One way of find such data structures is by checking all registers of defined by the CPU architecture reference manual one by one. Does anybody have some better way?


If it helps, for 80x86 there's:
  • GDT
  • IDT
  • TSS
  • Paging structures
  • (inaccessible) SMM state save area
  • (optional) LDT
  • (optional) IO port permission map
  • (optional) IRQ redirection table (used by virtual 8086 mode)
  • (optional) branch trace store buffer
  • (optional) virtual-machine control data structure/s
  • (optional) SGX enclave control structures


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


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 1 guest


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