Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1287 → Rev 1288

/kernel/trunk/generic/src/mm/slab.c
175,7 → 175,7
fsize = (PAGE_SIZE << cache->order);
slab = data + fsize - sizeof(*slab);
}
/* Fill in slab structures */
for (i=0; i < (1 << cache->order); i++)
frame_set_parent(pfn+i, slab, zone);
277,8 → 277,8
if (list_empty(&cache->partial_slabs)) {
/* Allow recursion and reclaiming
* - this should work, as the slab control structures
* are small and do not need to allocte with anything
* other ten frame_alloc when they are allocating,
* are small and do not need to allocate with anything
* other than frame_alloc when they are allocating,
* that's why we should get recursion at most 1-level deep
*/
spinlock_unlock(&cache->slablock);
879,7 → 879,7
int idx;
 
ASSERT(_slab_initialized);
ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W));
ASSERT(size && size <= (1 << SLAB_MAX_MALLOC_W));
if (size < (1 << SLAB_MIN_MALLOC_W))
size = (1 << SLAB_MIN_MALLOC_W);
889,7 → 889,6
return slab_alloc(malloc_caches[idx], flags);
}
 
 
void free(void *obj)
{
slab_t *slab;
/kernel/trunk/generic/src/mm/as.c
57,6 → 57,7
#include <adt/list.h>
#include <adt/btree.h>
#include <proc/task.h>
#include <proc/thread.h>
#include <arch/asm.h>
#include <panic.h>
#include <debug.h>
68,6 → 69,8
#include <config.h>
#include <arch/types.h>
#include <typedefs.h>
#include <syscall/copy.h>
#include <arch/interrupt.h>
 
as_operations_t *as_operations = NULL;
 
477,10 → 480,11
* Interrupts are assumed disabled.
*
* @param page Faulting page.
* @param istate Pointer to interrupted state.
*
* @return 0 on page fault, 1 on success.
* @return 0 on page fault, 1 on success or 2 if the fault was caused by copy_to_uspace() or copy_from_uspace().
*/
int as_page_fault(__address page)
int as_page_fault(__address page, istate_t *istate)
{
pte_t *pte;
as_area_t *area;
496,7 → 500,7
* Signal page fault to low-level handler.
*/
spinlock_unlock(&AS->lock);
return 0;
goto page_fault;
}
 
if (area->attributes & AS_AREA_ATTR_PARTIAL) {
506,7 → 510,7
*/
spinlock_unlock(&area->lock);
spinlock_unlock(&AS->lock);
return 0;
goto page_fault;
}
 
ASSERT(!(area->flags & AS_AREA_DEVICE));
554,7 → 558,23
spinlock_unlock(&area->lock);
spinlock_unlock(&AS->lock);
return 1;
return AS_PF_OK;
 
page_fault:
if (!THREAD)
return AS_PF_FAULT;
if (THREAD->in_copy_from_uspace) {
THREAD->in_copy_from_uspace = false;
istate_set_retaddr(istate, (__address) &memcpy_from_uspace_failover_address);
} else if (THREAD->in_copy_to_uspace) {
THREAD->in_copy_to_uspace = false;
istate_set_retaddr(istate, (__address) &memcpy_to_uspace_failover_address);
} else {
return AS_PF_FAULT;
}
 
return AS_PF_DEFER;
}
 
/** Switch address spaces.
884,8 → 904,11
__native sys_as_area_accept(as_area_acptsnd_arg_t *uspace_accept_arg)
{
as_area_acptsnd_arg_t arg;
int rc;
copy_from_uspace(&arg, uspace_accept_arg, sizeof(as_area_acptsnd_arg_t));
rc = copy_from_uspace(&arg, uspace_accept_arg, sizeof(as_area_acptsnd_arg_t));
if (rc != 0)
return rc;
if (!arg.size)
return (__native) EPERM;
906,8 → 929,11
__native sys_as_area_send(as_area_acptsnd_arg_t *uspace_send_arg)
{
as_area_acptsnd_arg_t arg;
int rc;
copy_from_uspace(&arg, uspace_send_arg, sizeof(as_area_acptsnd_arg_t));
rc = copy_from_uspace(&arg, uspace_send_arg, sizeof(as_area_acptsnd_arg_t));
if (rc != 0)
return rc;
 
if (!arg.size)
return (__native) EPERM;