Re: [uClinux-dev] Re: [PATCH] NOMMU: implement access_remote_vm

From: Wan ZongShun
Date: Thu Mar 31 2011 - 02:14:14 EST


2011/3/29 Greg Ungerer <gerg@xxxxxxxxxxxx>:
> On 26/03/11 06:32, Mike Frysinger wrote:
>>
>> Recent vm changes brought in a new function which the core procfs code
>> utilizes. ÂSo implement it for nommu systems too to avoid link failures.
>>
>> Signed-off-by: Mike Frysinger<vapier@xxxxxxxxxx>
>
> Looks good.
>
> Acked-by: Greg Ungerer <gerg@xxxxxxxxxxx>
>

It applys to my nuc700 arm7tdmi platform, thanks!

Tested-by: Wan ZongShun <mcuos.com@xxxxxxxxx>

>
>> ---
>> Âmm/nommu.c | Â 52 +++++++++++++++++++++++++++++++++++++++-------------
>> Â1 files changed, 39 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/nommu.c b/mm/nommu.c
>> index cb86e7d..c4c542c 100644
>> --- a/mm/nommu.c
>> +++ b/mm/nommu.c
>> @@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma,
>> struct vm_fault *vmf)
>> Â}
>> ÂEXPORT_SYMBOL(filemap_fault);
>>
>> -/*
>> - * Access another process' address space.
>> - * - source/target buffer must be kernel space
>> - */
>> -int access_process_vm(struct task_struct *tsk, unsigned long addr, void
>> *buf, int len, int write)
>> +static int __access_remote_vm(struct task_struct *tsk, struct mm_struct
>> *mm,
>> + Â Â Â Â Â Â Â unsigned long addr, void *buf, int len, int write)
>> Â{
>> Â Â Â Âstruct vm_area_struct *vma;
>> - Â Â Â struct mm_struct *mm;
>> -
>> - Â Â Â if (addr + len< Âaddr)
>> - Â Â Â Â Â Â Â return 0;
>> -
>> - Â Â Â mm = get_task_mm(tsk);
>> - Â Â Â if (!mm)
>> - Â Â Â Â Â Â Â return 0;
>>
>> Â Â Â Âdown_read(&mm->mmap_sem);
>>
>> @@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk,
>> unsigned long addr, void *buf, in
>> Â Â Â Â}
>>
>> Â Â Â Âup_read(&mm->mmap_sem);
>> +
>> + Â Â Â return len;
>> +}
>> +
>> +/**
>> + * @access_remote_vm - access another process' address space
>> + * @mm: Â Â Â Â Â Â Â Âthe mm_struct of the target address space
>> + * @addr: Â Â Âstart address to access
>> + * @buf: Â Â Â source or destination buffer
>> + * @len: Â Â Â number of bytes to transfer
>> + * @write: Â Â whether the access is a write
>> + *
>> + * The caller must hold a reference on @mm.
>> + */
>> +int access_remote_vm(struct mm_struct *mm, unsigned long addr,
>> + Â Â Â Â Â Â Â void *buf, int len, int write)
>> +{
>> + Â Â Â return __access_remote_vm(NULL, mm, addr, buf, len, write);
>> +}
>> +
>> +/*
>> + * Access another process' address space.
>> + * - source/target buffer must be kernel space
>> + */
>> +int access_process_vm(struct task_struct *tsk, unsigned long addr, void
>> *buf, int len, int write)
>> +{
>> + Â Â Â struct mm_struct *mm;
>> +
>> + Â Â Â if (addr + len< Âaddr)
>> + Â Â Â Â Â Â Â return 0;
>> +
>> + Â Â Â mm = get_task_mm(tsk);
>> + Â Â Â if (!mm)
>> + Â Â Â Â Â Â Â return 0;
>> +
>> + Â Â Â len = __access_remote_vm(tsk, mm, addr, buf, len, write);
>> +
>> Â Â Â Âmmput(mm);
>> Â Â Â Âreturn len;
>> Â}
>
>
> --
> ------------------------------------------------------------------------
> Greg Ungerer Â-- ÂPrincipal Engineer    ÂEMAIL:   gerg@xxxxxxxxxxxx
> SnapGear Group, McAfee           ÂPHONE:    +61 7 3435 2888
> 8 Gardner Close               FAX:     +61 7 3217 5323
> Milton, QLD, 4064, Australia        ÂWEB: http://www.SnapGear.com
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev@xxxxxxxxxxx
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev@xxxxxxxxxxx
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>



--
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@xxxxxxxxxxxxxxxx
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/