Page 1 of 1

PDT mirror in nasm

Posted: Sun Sep 04, 2016 2:05 pm
by stdcall
Hi.
I managed to get PDT mirror working in C.
I'm trying now to put it in the initial loader assembly code but I run in to trouble with nasm.

The code is :

Code: Select all

 section .data
  align 0x1000
  pdt:
      dd 0x00000083
      times (KERNEL_PAGE_NUMBER - 1) dd 0                 ; Pages before kernel space.
      dd 0x00000083
     times (1024 - KERNEL_PAGE_NUMBER - 2) dd 0  ; Pages after the kernel image.
     dd (pdt|0x3)
On compilation I get the following error that points to the last line in the code snippet.
boot/loader.s:96: error: `|' operator may only be applied to scalar values
According to google, It appears that the location of pdt is not constant during assembly.
Is there any way to get it working, or do I need to do it in code later on.

Thanks,
Ramon

Re: PDT mirror in nasm

Posted: Sun Sep 04, 2016 2:26 pm
by Boris
Hi,
Because your PDT is aligned on a 4kb boundary,
you can safely replace the OR operator with a + operator.
Masm will then be able to compute that.