PDT mirror in nasm

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
stdcall
Member
Member
Posts: 78
Joined: Thu Mar 14, 2013 1:30 am

PDT mirror in nasm

Post 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
“Meaningless! Meaningless!”
says the Teacher.
“Utterly meaningless!
Everything is meaningless.” - Ecclesiastes 1, 2

Educational Purpose Operating System - EPOS
Boris
Member
Member
Posts: 145
Joined: Sat Nov 07, 2015 3:12 pm

Re: PDT mirror in nasm

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