Team LiB
Previous Section Next Section

Page Size

When working with pages of memory, never assume the page size. It is a common mistake for x86 programmers to assume that the page size is 4KB. Although this is true on x86 machines, other architectures have different sizes. Some architectures support multiple page sizes, in fact! Table 19.4 lists each support architecture's valid page size(s).

Table 19.4. Architecture Page Size(s)

Architecture

PAGE_SHIFT

PAGE_SIZE

alpha

13

8KB

arm

12, 14, 15

4KB, 16KB, 32KB

cris

13

8KB

h8300

12

4KB

i386

12

4KB

ia64

12, 13, 14, 16

4KB, 8KB, 16KB, 64KB

m32r

12

4KB

m68k

12, 13

4KB, 8KB

m68knommu

12

4KB

mips

12

4KB

mips64

12

4KB

parisc

12

4KB

ppc

12

4KB

ppc64

12

4KB

s390

12

4KB

sh

12

4KB

sparc

12, 13

4KB, 8KB

sparc64

13

8KB

v850

12

4KB

x86_64

12

4KB


When working with pages of memory, use PAGE_SIZE as the size of a page, in bytes. The value PAGE_SHIFT is the number of bits to left-shift an address to get its page number. For example, on x86 with 4KB pages, PAGE_SIZE is 4096 and PAGE_SHIFT is 12. These vales are defined in <asm/page.h>.

    Team LiB
    Previous Section Next Section