Changeset 9ea6cc5 in mainline


Ignore:
Timestamp:
2006-05-19T13:46:21Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1068f6a
Parents:
5ca586a1
Message:

kernel identity mapping still to be done using BAT

Location:
arch/ppc32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/include/asm.h

    r5ca586a1 r9ea6cc5  
    141141void cpu_halt(void);
    142142void asm_delay_loop(__u32 t);
    143 void invalidate_bat(void);
    144143
    145144extern void userspace_asm(__address uspace_uarg, __address stack, __address entry);
  • arch/ppc32/src/asm.S

    r5ca586a1 r9ea6cc5  
    3434.global iret
    3535.global iret_syscall
    36 .global invalidate_bat
    3736.global memsetb
    3837.global memcpy
     
    195194        rfi
    196195       
    197 invalidate_bat:
    198        
    199         # invalidate block address translation registers
    200        
    201         li r14, 0
    202        
    203         mtspr ibat0u, r14
    204         mtspr ibat0l, r14
    205        
    206         mtspr ibat1u, r14
    207         mtspr ibat1l, r14
    208        
    209         mtspr ibat2u, r14
    210         mtspr ibat2l, r14
    211        
    212         mtspr ibat3u, r14
    213         mtspr ibat3l, r14
    214        
    215         mtspr dbat0u, r14
    216         mtspr dbat0l, r14
    217        
    218         mtspr dbat1u, r14
    219         mtspr dbat1l, r14
    220        
    221         mtspr dbat2u, r14
    222         mtspr dbat2l, r14
    223        
    224         mtspr dbat3u, r14
    225         mtspr dbat3l, r14
    226        
    227         blr
    228        
    229196memsetb:
    230197        rlwimi r5, r5, 8, 16, 23
  • arch/ppc32/src/mm/page.c

    r5ca586a1 r9ea6cc5  
    5050 *
    5151 * @param badvaddr Faulting virtual address.
    52  * @param istate Pointer to interrupted state.
    53  * @param pfrc Pointer to variable where as_page_fault() return code will be stored.
     52 * @param istate   Pointer to interrupted state.
     53 * @param pfrc     Pointer to variable where as_page_fault() return code will be stored.
    5454 * @return         PTE on success, NULL otherwise.
    5555 *
     
    115115}
    116116
     117
    117118static void pht_insert(const __address vaddr, const pfn_t pfn)
    118119{
     
    131132       
    132133        __u32 i;
     134        bool found = false;
    133135        /* Find unused PTE in PTEG */
    134136        for (i = 0; i < 8; i++) {
    135                 if (!phte[hash + i].v)
     137                if (!phte[hash + i].v) {
     138                        found = true;
    136139                        break;
    137         }
    138        
    139         // TODO: Check access/change bits, secondary hash
    140        
    141         if (i == 8)
    142                 i = page % 8;
     140                }
     141        }
     142       
     143        if (!found) {
     144                /* Secondary hash (not) */
     145                hash = ~hash;
     146               
     147                /* Find unused PTE in PTEG */
     148                for (i = 0; i < 8; i++) {
     149                        if (!phte[hash + i].v) {
     150                                found = true;
     151                                break;
     152                        }
     153                }
     154               
     155                if (!found) {
     156                        // TODO: A/C precedence groups
     157                        i = page % 8;
     158                }
     159        }
    143160       
    144161        phte[hash + i].v = 1;
     
    184201        if (!pte) {
    185202                switch (pfcr) {
    186                 case AS_PF_FAULT:
    187                         goto fail;
    188                         break;
    189                 case AS_PF_DEFER:
    190                         /*
    191                          * The page fault came during copy_from_uspace()
    192                          * or copy_to_uspace().
    193                          */
    194                         page_table_unlock(AS, true);
    195                         return;
    196                 default:
    197                         panic("Unexpected pfrc (%d)\n", pfcr);
    198                         break;
     203                        case AS_PF_FAULT:
     204                                goto fail;
     205                                break;
     206                        case AS_PF_DEFER:
     207                                /*
     208                                 * The page fault came during copy_from_uspace()
     209                                 * or copy_to_uspace().
     210                                 */
     211                                page_table_unlock(AS, true);
     212                                return;
     213                        default:
     214                                panic("Unexpected pfrc (%d)\n", pfcr);
    199215                }
    200216        }
     
    215231{
    216232        memsetb((__address) phte, 1 << PHT_BITS, 0);
    217        
    218         /* Insert global kernel mapping */
    219        
    220         __address cur;
    221         for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
    222                 pte_t *pte = page_mapping_find(AS_KERNEL, PA2KA(cur));
    223                 if ((pte) && (pte->p) && (pte->g))
    224                         pht_insert(PA2KA(cur), pte->pfn);
    225         }
    226233}
    227234
     
    257264                        : "r" ((__address) physical_phte)
    258265                );
    259                
    260                 /* Invalidate block address translation registers,
    261                    thus remove the temporary mapping */
    262 //              invalidate_bat();
    263         }
    264 }
     266        }
     267}
Note: See TracChangeset for help on using the changeset viewer.