Skip to contentSkip to conversation

PAGE_ALIGN + PAGE_SHIFT from userspace

DISCUSSION Daniel Laird 2 participants 3 messages Dec 18, 2006 – Dec 19, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

Hi All,

I was using linux 2.6.17.13 on my MIPS and it was all going well. I am just porting to 2.6.19 and am having a couple of issues.

My first issue is that i used to mmap a buffer from user space. I used to use a PAGE_ALIGN macro when doing this:
/** to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)

this worked as PAGE_SIZE and PAGE_MASK were available in page.h.

This have now been moved inside the #ifdef KERNEL guard in the header file. Meaning these are no longer available.

Are these available somewhere else?
Should I be doing something different to mmap?

Any help appreciated
Daniel Laird

Signature · 2 lines
View this message in context: http://www.nabble.com/PAGE_ALIGN-%2B-PAGE_SHIFT-from-userspace-tf2838680.html#a7925460
Sent from the linux-mips main mailing list archive at Nabble.com.
#1 lore raw
Quoted 6 lines · Daniel Laird

Hi All,

I was using linux 2.6.17.13 on my MIPS and it was all going well. I am just porting to 2.6.19 and am having a couple of issues.

Quoted 6 lines

My first issue is that i used to mmap a buffer from user space. I used to use a PAGE_ALIGN macro when doing this:
/** to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)

this worked as PAGE_SIZE and PAGE_MASK were available in page.h.

It didn't work reliably since the pagesize is a kernel configuration option.

Quoted 5 lines

This have now been moved inside the #ifdef KERNEL guard in the header file. Meaning these are no longer available.

Are these available somewhere else?
Should I be doing something different to mmap?

Use the libc's sysconf(_SC_PAGESIZE) function.

Thiemo

#2 lore raw

Works a treat thankyou!

Signature · 2 lines
View this message in context: http://www.nabble.com/PAGE_ALIGN-%2B-PAGE_SHIFT-from-userspace-tf2838680.html#a7943224
Sent from the linux-mips main mailing list archive at Nabble.com.