Rev 2199 | Rev 2361 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2199 | Rev 2238 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * Copyright (c) 2005 Jakub Jermar |
2 | * Copyright (c) 2007 Michal Kebrt |
| 3 | * All rights reserved. |
3 | * All rights reserved. |
| 4 | * |
4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
7 | * are met: |
| Line 39... | Line 39... | ||
| 39 | #include <arch/mm/page.h> |
39 | #include <arch/mm/page.h> |
| 40 | 40 | ||
| 41 | /** Invalidate all entries in TLB. */ |
41 | /** Invalidate all entries in TLB. */ |
| 42 | void tlb_invalidate_all(void) |
42 | void tlb_invalidate_all(void) |
| 43 | { |
43 | { |
| 44 | - | ||
| 45 | asm volatile ( |
44 | asm volatile ( |
| 46 | "eor r1, r1\n" |
45 | "eor r1, r1\n" |
| 47 | "MCR p15, 0, r1, c8, c7, 0\n" // see ARM Architecture reference relE 3.7.7 p.528 |
46 | "MCR p15, 0, r1, c8, c7, 0\n" // see ARM Architecture reference relE 3.7.7 p.528 |
| 48 | 47 | ||
| 49 | ::: "r1" |
48 | ::: "r1" |
| 50 | ); |
49 | ); |
| Line 60... | Line 59... | ||
| 60 | } |
59 | } |
| 61 | 60 | ||
| 62 | /** Invalidate single entry in TLB |
61 | /** Invalidate single entry in TLB |
| 63 | * @param page Virtual adress of the page |
62 | * @param page Virtual adress of the page |
| 64 | */ |
63 | */ |
| 65 | static inline void invlpg(uintptr_t page) |
64 | static inline void invalidate_page(uintptr_t page) |
| 66 | { |
65 | { |
| 67 | asm volatile ( |
66 | asm volatile ( |
| 68 | "MCR p15, 0, %0, c8, c7, 1" |
67 | "MCR p15, 0, %0, c8, c7, 1" |
| 69 | 68 | ||
| 70 | : /* no output */ |
69 | : /* no output */ |
| Line 81... | Line 80... | ||
| 81 | void tlb_invalidate_pages(asid_t asid, uintptr_t page, count_t cnt) |
80 | void tlb_invalidate_pages(asid_t asid, uintptr_t page, count_t cnt) |
| 82 | { |
81 | { |
| 83 | unsigned int i; |
82 | unsigned int i; |
| 84 | 83 | ||
| 85 | for (i = 0; i < cnt; i++) |
84 | for (i = 0; i < cnt; i++) |
| 86 | invlpg(page + i * PAGE_SIZE); |
85 | invalidate_page(page + i * PAGE_SIZE); |
| 87 | } |
86 | } |
| 88 | 87 | ||
| 89 | /** @} |
88 | /** @} |
| 90 | */ |
89 | */ |