Errors in paging?

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.
Post Reply
St8ic

Errors in paging?

Post by St8ic »

The following lines in my paging function (paging.c) are buggy. I'm using TCC on Win98. Can anyone help with these?

Code: Select all

unsigned long *page_directory = (unsigned long *)0xFFF00000; /*0x100000;*/
unsigned long *page_table;

void init_paging()
{
     page_table = page_directory + 0x1000;
     
     volatile unsigned long address = 0;    //1
     unsigned int i;                               //2
     
     for(i=0; i<1023; i++)                      //3
     {
          page_table[i] = address | 3;      //4
          address+= 4096;               
     }

     page_directory[0] = page_table;      //5
     page_directory[0] = page_directory[0] | 3;

     for(i=1; i<1023; i++)
     {
          page_directory[i] = 0 | 2; 
     }

     write_cr3(page_directory);
     enable_paging();
     printf("Paging enabled\n\r");
}
Here are the errors:
1: Expression syntax in function init_paging
2: Expression syntax in function init_paging
3: Undefined symbol 'i' in function init_paging
4: Undefined symbol 'address' in function init_paging
5: Non-portable pointer assignment in function init_paging

THANKS!
TB

Re:Errors in paging?

Post by TB »

TCC as in Turbo C Compiler? The one that's 16-bit?

You can't enable paging in 16-bit real-mode.
Use gcc and switch to protected mode, prior to enabling paging.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Errors in paging?

Post by Pype.Clicker »

iirc, TCC has nothing like a "long" integer ...
St8ic

Re:Errors in paging?

Post by St8ic »

hmmm...what kind of memory management could I use in a 16-bit real mode OS? I don't wanna have to change to 32-bit protected mode. Thanks again.
Curufir

Re:Errors in paging?

Post by Curufir »

St8ic wrote: hmmm...what kind of memory management could I use in a 16-bit real mode OS? I don't wanna have to change to 32-bit protected mode. Thanks again.
Well you could have some flavour of VM running interpreted code.
Tim

Re:Errors in paging?

Post by Tim »

St8ic wrote:what kind of memory management could I use in a 16-bit real mode OS?
You would use either very simple, but useless, memory management (the 64KB limit); or very clever but complicated memory management (like Windows had before Windows 95/NT).

16-bit programming is generally a waste of time. 32-bit programming is much easier, and much better.
Post Reply