Rev 793 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 793 | Rev 1382 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <arch/mm/page.h> |
29 | #include <arch/mm/page.h> |
- | 30 | #include <arch/mm/tlb.h> |
|
30 | #include <genarch/mm/page_ht.h> |
31 | #include <genarch/mm/page_ht.h> |
- | 32 | #include <mm/frame.h> |
|
- | 33 | #include <bitops.h> |
|
31 | 34 | ||
32 | void page_arch_init(void) |
35 | void page_arch_init(void) |
33 | { |
36 | { |
34 | page_mapping_operations = &ht_mapping_operations; |
37 | page_mapping_operations = &ht_mapping_operations; |
35 | } |
38 | } |
- | 39 | ||
- | 40 | __address hw_map(__address physaddr, size_t size) |
|
- | 41 | { |
|
- | 42 | unsigned int order; |
|
- | 43 | ||
- | 44 | if (size <= FRAME_SIZE) |
|
- | 45 | order = 0; |
|
- | 46 | else |
|
- | 47 | order = (fnzb32(size - 1) + 1) - FRAME_WIDTH; |
|
- | 48 | ||
- | 49 | __address virtaddr = PA2KA(PFN2ADDR(frame_alloc(order, FRAME_KA))); |
|
- | 50 | ||
- | 51 | dtlb_insert_mapping(virtaddr, physaddr, PAGESIZE_512K, true, false); |
|
- | 52 | dtlb_insert_mapping(virtaddr + 512 * 1024, physaddr + 512 * 1024, PAGESIZE_512K, true, false); |
|
- | 53 | ||
- | 54 | return virtaddr; |
|
- | 55 | } |