Commit 8421cc62 authored by Gilles Chanteperdrix's avatar Gilles Chanteperdrix
Browse files

Fault heaps memory on ARM

parent 779be695
2008-11-16 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
* ksrc/arch/arm/hal.c (rthal_fault_range): Add a service to the
hal allowing to fault a user-space address range.
* ksrc/nucleus/heap.c (xnheap_mmap): Call this new service.
2008-11-15 Philippe Gerum <rpm@xenomai.org>
* ksrc/arch/blackfin/Kconfig: Enable generic stack pool for kernel
......
......@@ -275,6 +275,8 @@ static inline void rthal_restore_fpu(rthal_fpenv_t *fpuenv)
#endif /* CONFIG_XENO_HW_FPU */
void rthal_fault_range(struct vm_area_struct *vma);
static const char *const rthal_fault_labels[] = {
[IPIPE_TRAP_ACCESS] = "Data or instruction access",
[IPIPE_TRAP_SECTION] = "Section fault",
......
......@@ -214,6 +214,8 @@ static inline void xnarch_free_stack_mem(void *chunk, u_long bytes)
kfree(chunk);
}
#define xnarch_fault_range(vma) rthal_fault_range(vma)
#ifdef __cplusplus
}
#endif
......
......@@ -227,6 +227,13 @@ int rthal_irq_end(unsigned irq)
return rthal_irq_chip_end(irq);
}
void rthal_fault_range(struct vm_area_struct *vma)
{
unsigned long addr;
for (addr = vma->vm_start; addr != vma->vm_end; addr += PAGE_SIZE)
handle_mm_fault(vma->vm_mm, vma, addr, 1);
}
static inline int do_exception_event(unsigned event, unsigned domid, void *data)
{
if (domid == RTHAL_DOMAIN_ID) {
......@@ -280,6 +287,7 @@ EXPORT_SYMBOL(rthal_arch_init);
EXPORT_SYMBOL(rthal_arch_cleanup);
EXPORT_SYMBOL(rthal_thread_switch);
EXPORT_SYMBOL(rthal_thread_trampoline);
EXPORT_SYMBOL(rthal_fault_range);
#if defined(CONFIG_VFP) && defined(CONFIG_XENO_HW_FPU)
EXPORT_SYMBOL(last_VFP_context);
EXPORT_SYMBOL(rthal_vfp_save);
......
......@@ -1056,6 +1056,10 @@ static int xnheap_mmap(struct file *file, struct vm_area_struct *vma)
size, PAGE_SHARED))
return -EAGAIN;
#ifdef xnarch_fault_range
xnarch_fault_range(vma);
#endif /* xnarch_fault_range */
atomic_inc(&heap->archdep.numaps);
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment