Multitasking

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Multitasking

Post by Combuster »

1: Something that looks like an attempt at executing code from video memory. You'd have to check bochs' dump to see if that indeed is the case...

2: That's GRUB trying to see if the bios supports some obscure function - it doesn't depend on it, so you can just ignore it.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
leledumbo
Member
Member
Posts: 103
Joined: Wed Apr 23, 2008 8:46 pm

Re: Multitasking

Post by leledumbo »

Sorry for answering old question, but I think it's worth to know.
How would the following C code be defined in Pascal?
I've asked this once in FPC mailing list, here's the answer (the developers even add it to the wiki):
C:

Code: Select all

typedef struct page
{
   u32int present    : 1;   // Page present in memory
   u32int rw         : 1;   // Read-only if clear, readwrite if set
   u32int user       : 1;   // Supervisor level only if clear
   u32int accessed   : 1;   // Has the page been accessed since last refresh?
   u32int dirty      : 1;   // Has the page been written to since last refresh?
   u32int unused     : 7;   // Amalgamation of unused and reserved bits
   u32int frame      : 20;  // Frame address (shifted right 12 bits)
} page_t;

pascal:

Code: Select all

type
    Unsigned_7  = 0 .. (1 shl 7)  - 1;
    Unsigned_20 = 0 .. (1 shl 20) - 1;
 
type
    page_t = bitpacked record
       present  : boolean;
       rw       : boolean;
       user     : boolean;
       accessed : boolean;
       dirty    : boolean;
       unused   : Unsigned_7;
       frame    : Unsigned_20;
    end;
Note that this is NOT the correct structure (I don't know why JamesM simply amalgamate unused bits), read intel manuals about paging data structures and put the unused bits in the right place (check my fpos for reference).
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Multitasking

Post by System123 »

I actually got my answer to this from your OS. Thanks very much. I did change the way it was done because I noticed James M had just joined the bits, even though the intel manuals state it differently. So I followed the intel manual.

@leledumbo: I just would like to thank you, your OS has helped me quite a few times when I got lost converting C code, it pushed me back in the right direction
Gizmic OS
Currently - Busy with FAT12 driver and VFS
leledumbo
Member
Member
Posts: 103
Joined: Wed Apr 23, 2008 8:46 pm

Re: Multitasking

Post by leledumbo »

You're welcome :D, btw I just upload a new version. Please check it out.
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Multitasking

Post by System123 »

I will be sure to do so. :D
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Post Reply