Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1377 → Rev 1378

/kernel/trunk/arch/ppc32/include/asm.h
140,7 → 140,6
 
void cpu_halt(void);
void asm_delay_loop(__u32 t);
void invalidate_bat(void);
 
extern void userspace_asm(__address uspace_uarg, __address stack, __address entry);
 
/kernel/trunk/arch/ppc32/src/asm.S
33,7 → 33,6
.global userspace_asm
.global iret
.global iret_syscall
.global invalidate_bat
.global memsetb
.global memcpy
.global memcpy_from_uspace
194,38 → 193,6
 
rfi
invalidate_bat:
# invalidate block address translation registers
li r14, 0
mtspr ibat0u, r14
mtspr ibat0l, r14
mtspr ibat1u, r14
mtspr ibat1l, r14
mtspr ibat2u, r14
mtspr ibat2l, r14
mtspr ibat3u, r14
mtspr ibat3l, r14
mtspr dbat0u, r14
mtspr dbat0l, r14
mtspr dbat1u, r14
mtspr dbat1l, r14
mtspr dbat2u, r14
mtspr dbat2l, r14
mtspr dbat3u, r14
mtspr dbat3l, r14
blr
memsetb:
rlwimi r5, r5, 8, 16, 23
rlwimi r5, r5, 16, 0, 15
/kernel/trunk/arch/ppc32/src/mm/page.c
49,8 → 49,8
* The AS->lock must be held on entry to this function.
*
* @param badvaddr Faulting virtual address.
* @param istate Pointer to interrupted state.
* @param pfrc Pointer to variable where as_page_fault() return code will be stored.
* @param istate Pointer to interrupted state.
* @param pfrc Pointer to variable where as_page_fault() return code will be stored.
* @return PTE on success, NULL otherwise.
*
*/
114,6 → 114,7
panic("%p: PHT Refill Exception at %p (%s<-%s)\n", badvaddr, istate->pc, symbol, sym2);
}
 
 
static void pht_insert(const __address vaddr, const pfn_t pfn)
{
__u32 page = (vaddr >> 12) & 0xffff;
130,17 → 131,33
__u32 hash = ((vsid ^ page) & 0x3ff) << 3;
__u32 i;
bool found = false;
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte[hash + i].v)
if (!phte[hash + i].v) {
found = true;
break;
}
}
// TODO: Check access/change bits, secondary hash
if (!found) {
/* Secondary hash (not) */
hash = ~hash;
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte[hash + i].v) {
found = true;
break;
}
}
if (!found) {
// TODO: A/C precedence groups
i = page % 8;
}
}
if (i == 8)
i = page % 8;
phte[hash + i].v = 1;
phte[hash + i].vsid = vsid;
phte[hash + i].h = 0;
183,19 → 200,18
pte = find_mapping_and_check(badvaddr, istate, &pfcr);
if (!pte) {
switch (pfcr) {
case AS_PF_FAULT:
goto fail;
break;
case AS_PF_DEFER:
/*
* The page fault came during copy_from_uspace()
* or copy_to_uspace().
*/
page_table_unlock(AS, true);
return;
default:
panic("Unexpected pfrc (%d)\n", pfcr);
break;
case AS_PF_FAULT:
goto fail;
break;
case AS_PF_DEFER:
/*
* The page fault came during copy_from_uspace()
* or copy_to_uspace().
*/
page_table_unlock(AS, true);
return;
default:
panic("Unexpected pfrc (%d)\n", pfcr);
}
}
214,15 → 230,6
void pht_init(void)
{
memsetb((__address) phte, 1 << PHT_BITS, 0);
/* Insert global kernel mapping */
__address cur;
for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
pte_t *pte = page_mapping_find(AS_KERNEL, PA2KA(cur));
if ((pte) && (pte->p) && (pte->g))
pht_insert(PA2KA(cur), pte->pfn);
}
}
 
 
256,9 → 263,5
:
: "r" ((__address) physical_phte)
);
/* Invalidate block address translation registers,
thus remove the temporary mapping */
// invalidate_bat();
}
}