Rev 2141 | Rev 2170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2141 | Rev 2144 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | } |
59 | } |
60 | 60 | ||
61 | int as_constructor_arch(as_t *as, int flags) |
61 | int as_constructor_arch(as_t *as, int flags) |
62 | { |
62 | { |
63 | #ifdef CONFIG_TSB |
63 | #ifdef CONFIG_TSB |
- | 64 | /* |
|
- | 65 | * The order must be calculated with respect to the emulated |
|
- | 66 | * 16K page size. |
|
- | 67 | */ |
|
64 | int order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * |
68 | int order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * |
65 | sizeof(tsb_entry_t)) >> MMU_FRAME_WIDTH); |
69 | sizeof(tsb_entry_t)) >> FRAME_WIDTH); |
66 | uintptr_t tsb = (uintptr_t) frame_alloc(order, flags | FRAME_KA); |
70 | uintptr_t tsb = (uintptr_t) frame_alloc(order, flags | FRAME_KA); |
67 | 71 | ||
68 | if (!tsb) |
72 | if (!tsb) |
69 | return -1; |
73 | return -1; |
70 | 74 | ||
71 | as->arch.itsb = (tsb_entry_t *) tsb; |
75 | as->arch.itsb = (tsb_entry_t *) tsb; |
72 | as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT * |
76 | as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT * |
73 | sizeof(tsb_entry_t)); |
77 | sizeof(tsb_entry_t)); |
74 | memsetb((uintptr_t) as->arch.itsb, |
78 | memsetb((uintptr_t) as->arch.itsb, |
75 | (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0); |
79 | (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0); |
76 | #endif |
80 | #endif |
77 | return 0; |
81 | return 0; |
78 | } |
82 | } |
79 | 83 | ||
80 | int as_destructor_arch(as_t *as) |
84 | int as_destructor_arch(as_t *as) |
81 | { |
85 | { |
82 | #ifdef CONFIG_TSB |
86 | #ifdef CONFIG_TSB |
- | 87 | /* |
|
- | 88 | * The count must be calculated with respect to the emualted 16K page |
|
- | 89 | * size. |
|
- | 90 | */ |
|
83 | count_t cnt = ((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * |
91 | count_t cnt = ((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * |
84 | sizeof(tsb_entry_t)) >> MMU_FRAME_WIDTH; |
92 | sizeof(tsb_entry_t)) >> FRAME_WIDTH; |
85 | frame_free(KA2PA((uintptr_t) as->arch.itsb)); |
93 | frame_free(KA2PA((uintptr_t) as->arch.itsb)); |
86 | return cnt; |
94 | return cnt; |
87 | #else |
95 | #else |
88 | return 0; |
96 | return 0; |
89 | #endif |
97 | #endif |