headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / kernel / arch / ppc / arch_mmu.cpp
blob0c41003d89bc9928253251c38a2a02c5cf78219d
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
7 #include <arch_mmu.h>
8 #include <arch_cpu.h>
11 uint32
12 page_table_entry::PrimaryHash(uint32 virtualSegmentID, uint32 virtualAddress)
14 return (virtualSegmentID & 0x7ffff) ^ ((virtualAddress >> 12) & 0xffff);
18 uint32
19 page_table_entry::SecondaryHash(uint32 virtualSegmentID, uint32 virtualAddress)
21 return ~PrimaryHash(virtualSegmentID, virtualAddress);
25 uint32
26 page_table_entry::SecondaryHash(uint32 primaryHash)
28 return ~primaryHash;
32 void
33 ppc_get_page_table(page_table_entry_group **_pageTable, size_t *_size)
35 uint32 sdr1 = get_sdr1();
37 *_pageTable = (page_table_entry_group *)(sdr1 & 0xffff0000);
38 *_size = ((sdr1 & 0x1ff) + 1) << 16;
42 void
43 ppc_set_page_table(page_table_entry_group *pageTable, size_t size)
45 set_sdr1(((uint32)pageTable & 0xffff0000) | (((size -1) >> 16) & 0x1ff));