Changeset e3c762cd in mainline for generic/src/mm


Ignore:
Timestamp:
2006-05-05T11:59:19Z (20 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:
generic/src/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/as.c

    r22cf454d re3c762cd  
    5858#include <adt/btree.h>
    5959#include <proc/task.h>
     60#include <proc/thread.h>
    6061#include <arch/asm.h>
    6162#include <panic.h>
     
    6970#include <arch/types.h>
    7071#include <typedefs.h>
     72#include <syscall/copy.h>
     73#include <arch/interrupt.h>
    7174
    7275as_operations_t *as_operations = NULL;
     
    478481 *
    479482 * @param page Faulting page.
    480  *
    481  * @return 0 on page fault, 1 on success.
    482  */
    483 int as_page_fault(__address page)
     483 * @param istate Pointer to interrupted state.
     484 *
     485 * @return 0 on page fault, 1 on success or 2 if the fault was caused by copy_to_uspace() or copy_from_uspace().
     486 */
     487int as_page_fault(__address page, istate_t *istate)
    484488{
    485489        pte_t *pte;
     
    497501                 */
    498502                spinlock_unlock(&AS->lock);
    499                 return 0;
     503                goto page_fault;
    500504        }
    501505
     
    507511                spinlock_unlock(&area->lock);
    508512                spinlock_unlock(&AS->lock);
    509                 return 0;               
     513                goto page_fault;               
    510514        }
    511515
     
    555559        spinlock_unlock(&area->lock);
    556560        spinlock_unlock(&AS->lock);
    557         return 1;
     561        return AS_PF_OK;
     562
     563page_fault:
     564        if (!THREAD)
     565                return AS_PF_FAULT;
     566       
     567        if (THREAD->in_copy_from_uspace) {
     568                THREAD->in_copy_from_uspace = false;
     569                istate_set_retaddr(istate, (__address) &memcpy_from_uspace_failover_address);
     570        } else if (THREAD->in_copy_to_uspace) {
     571                THREAD->in_copy_to_uspace = false;
     572                istate_set_retaddr(istate, (__address) &memcpy_to_uspace_failover_address);
     573        } else {
     574                return AS_PF_FAULT;
     575        }
     576
     577        return AS_PF_DEFER;
    558578}
    559579
     
    885905{
    886906        as_area_acptsnd_arg_t arg;
    887        
    888         copy_from_uspace(&arg, uspace_accept_arg, sizeof(as_area_acptsnd_arg_t));
     907        int rc;
     908       
     909        rc = copy_from_uspace(&arg, uspace_accept_arg, sizeof(as_area_acptsnd_arg_t));
     910        if (rc != 0)
     911                return rc;
    889912       
    890913        if (!arg.size)
     
    907930{
    908931        as_area_acptsnd_arg_t arg;
    909        
    910         copy_from_uspace(&arg, uspace_send_arg, sizeof(as_area_acptsnd_arg_t));
     932        int rc;
     933       
     934        rc = copy_from_uspace(&arg, uspace_send_arg, sizeof(as_area_acptsnd_arg_t));
     935        if (rc != 0)
     936                return rc;
    911937
    912938        if (!arg.size)
  • generic/src/mm/slab.c

    r22cf454d re3c762cd  
    176176                slab = data + fsize - sizeof(*slab);
    177177        }
    178                
     178       
    179179        /* Fill in slab structures */
    180180        for (i=0; i < (1 << cache->order); i++)
     
    278278                /* Allow recursion and reclaiming
    279279                 * - this should work, as the slab control structures
    280                  *   are small and do not need to allocte with anything
    281                  *   other ten frame_alloc when they are allocating,
     280                 *   are small and do not need to allocate with anything
     281                 *   other than frame_alloc when they are allocating,
    282282                 *   that's why we should get recursion at most 1-level deep
    283283                 */
     
    880880
    881881        ASSERT(_slab_initialized);
    882         ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W));
     882        ASSERT(size && size <= (1 << SLAB_MAX_MALLOC_W));
    883883       
    884884        if (size < (1 << SLAB_MIN_MALLOC_W))
     
    890890}
    891891
    892 
    893892void free(void *obj)
    894893{
Note: See TracChangeset for help on using the changeset viewer.