Skip to contentSkip to conversation

linux-libc-headers 2.6.8.0

ANNOUNCE Albert Cahalan 1 participant 1 message Aug 19, 2004

lore
Share & tools
lore
#0 lore raw

For IA-64 and MIPS, and for any other arch with variable page sizes, you need something like this:

////////////////////////////////////////
extern int getpagesize(void);

#define PAGE_SIZE ((unsigned long)(getpagesize()))

// This is a gcc statement-expression.
// You might want the __extension__ keyword.

#define PAGE_SHIFT ({          \
  int _PAGE_SIZE = PAGE_SIZE;  \
  (_PAGE_SIZE > 16*1024)       \   
  ?  (_PAGE_SIZE == 32*1024)   \  
     ? 15ul                      \  
     : 16ul                      \  
  :  (_PAGE_SIZE == 8*1024)     \
     ? 13ul                      \  
     :  (_PAGE_SIZE == 4*1024)  \
        ? 12ul                   \
        : 14ul                  \

; \
})
//////////////////////////////////////////