Subject: trap
To: None <netbsd-help@netbsd.org>
From: Pramod Srinivasan <pramodsri@yahoo.com>
List: netbsd-help
Date: 04/24/2003 12:25:38
Hi.

Not sure if this is the right mailing groups for this
question, please let me know if this has to be
directed to another group.

This question is related to powerpc mmu and handling
of a dsi trap.

my understanding is on a dsi, we will restore the kern
mapping (all segment registers including user segment
register?) and jump to the trap code, and in the trap
code we handle the fault and try to enter the address
into the page table. What I dont understand is  if the
va belongs to the user segment (first 4 bit amount to
12) then we 
get the last 4 bits of the user sr and make them the
first 4 bits of the vitual address.Whats the logic
behind this?

if ((va >> ADDR_SR_SHFT) == USER_SR) {
    sr_t user_sr;

    asm ("mfsr %0, %1"
          : "=r"(user_sr) : "K"(USER_SR));
    va &= ADDR_PIDX | ADDR_POFF;
    va |= user_sr << ADDR_SR_SHFT;
    map = &p->p_vmspace->vm_map;
}

any help is greatly appreciated...

Thanks,
--pramod


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com