Changeset e3c762cd in mainline for arch/ppc32/src


Ignore:
Timestamp:
2006-05-05T11:59:19Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de07bcf
Parents:
22cf454d
Message:

Complete implementation of copy_from_uspace() and copy_to_uspace()
for amd64 and ia32. Other architectures still compile and run,
but need to implement their own assembly-only memcpy(), memcpy_from_uspace(),
memcpy_to_uspace() and their failover parts. For these architectures
only dummy implementations are provided.

Location:
arch/ppc32/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/src/asm.S

    r22cf454d re3c762cd  
    3636.global memsetb
    3737.global memcpy
     38.global memcpy_from_uspace
     39.global memcpy_to_uspace
     40.global memcpy_from_uspace_failover_address
     41.global memcpy_to_uspace_failover_address
    3842
    3943userspace_asm:
     
    234238
    235239memcpy:
     240memcpy_from_uspace:
     241memcpy_to_uspace:
     242
    236243        srwi. r7, r5, 3
    237244        addi r6, r3, -4
     
    294301        mtctr r7
    295302        b 1b
     303
     304memcpy_from_uspace_failover_address:
     305memcpy_to_uspace_failover_address:
     306        b memcpy_from_uspace_failover_address
  • arch/ppc32/src/mm/tlb.c

    r22cf454d re3c762cd  
    6969 *
    7070 * @param badvaddr Faulting virtual address.
     71 * @param istate Pointer to interrupted state.
     72 * @param pfrc Pointer to variable where as_page_fault() return code will be stored.
    7173 * @return         PTE on success, NULL otherwise.
    7274 *
    7375 */
    74 static pte_t *find_mapping_and_check(__address badvaddr)
     76static pte_t *find_mapping_and_check(__address badvaddr, istate_t *istate, int *pfcr)
    7577{
    7678        /*
     
    8587                return pte;
    8688        } else {
     89                int rc;
     90       
    8791                /*
    8892                 * Mapping not found in page tables.
     
    9094                 */
    9195                page_table_unlock(AS, true);
    92                 if (as_page_fault(badvaddr)) {
     96                switch (rc = as_page_fault(badvaddr, istate)) {
     97                case AS_PF_OK:
    9398                        /*
    9499                         * The higher-level page fault handler succeeded,
     
    99104                        ASSERT((pte) && (pte->p));
    100105                        return pte;
    101                 } else {
     106                        break;
     107                case AS_PF_DEFER:
     108                        page_table_lock(AS, true);
     109                        *pfcr = rc;
     110                        return NULL;
     111                        break;
     112                case AS_PF_FAULT:
    102113                        page_table_lock(AS, true);
    103114                        printf("Page fault.\n");
     115                        *pfcr = rc;
    104116                        return NULL;
    105                 }
    106                
     117                        break;
     118                default:
     119                        panic("unexpected rc (%d)\n", rc);
     120                        break;
     121                }       
    107122        }
    108123}
     
    140155        __u32 hash;
    141156        __u32 i;
     157        int pfcr;
    142158       
    143159        if (data) {
     
    155171        page_table_lock(AS, true);
    156172       
    157         pte = find_mapping_and_check(badvaddr);
    158         if (!pte)
    159                 goto fail;
     173        pte = find_mapping_and_check(badvaddr, istate, &pfcr);
     174        if (!pte) {
     175                switch (pfcr) {
     176                case AS_PF_FAULT:
     177                        goto fail;
     178                        break;
     179                case AS_PF_DEFER:
     180                        /*
     181                         * The page fault came during copy_from_uspace()
     182                         * or copy_to_uspace().
     183                         */
     184                        page_table_unlock(AS, true);
     185                        return;
     186                default:
     187                        panic("Unexpected pfrc (%d)\n", pfcr);
     188                        break;
     189                }
     190        }
    160191
    161192        /* Record access to PTE */
Note: See TracChangeset for help on using the changeset viewer.