Page 1 of 1

Errors in paging?

Posted: Tue Jan 27, 2004 10:38 pm
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!

Re:Errors in paging?

Posted: Tue Jan 27, 2004 11:00 pm
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.

Re:Errors in paging?

Posted: Wed Jan 28, 2004 3:34 am
by Pype.Clicker
iirc, TCC has nothing like a "long" integer ...

Re:Errors in paging?

Posted: Wed Jan 28, 2004 8:28 am
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.

Re:Errors in paging?

Posted: Wed Jan 28, 2004 9:47 am
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.

Re:Errors in paging?

Posted: Fri Jan 30, 2004 12:52 pm
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.