Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- From: Nick Piggin <nickpiggin@xxxxxxxxxxxx>
- Date: Tue, 9 Oct 2007 01:25:26 +1000
On Tuesday 09 October 2007 16:40, Huang, Ying wrote:
+unsigned long copy_from_phys(void *to, unsigned long from_phys,
+ unsigned long n)
+{
+ struct page *page;
+ void *from;
+ unsigned long remain = n, offset, trunck;
+
+ while (remain) {
+ page = pfn_to_page(from_phys >> PAGE_SHIFT);
+ from = kmap_atomic(page, KM_USER0);
+ offset = from_phys & ~PAGE_MASK;
+ if (remain > PAGE_SIZE - offset)
+ trunck = PAGE_SIZE - offset;
+ else
+ trunck = remain;
+ memcpy(to, from + offset, trunck);
+ kunmap_atomic(from, KM_USER0);
+ to += trunck;
+ from_phys += trunck;
+ remain -= trunck;
+ }
+ return n;
+}
I suppose that's not unreasonable to put in mm/memory.c, although
it's not really considered a problem to do this kind of stuff in
a low level arch file...
You have no kernel virtual mapping for the source data?
Should it be __init?
Care to add a line of documentation if you keep it in mm/memory.c?
Thanks,
Nick
-
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/
- Follow-Ups:
- Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- From: Andi Kleen
- Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- From: Huang, Ying
- Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- References:
- [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- From: Huang, Ying
- [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- Prev by Date: Re: remove zero_page (was Re: -mm merge plans for 2.6.24)
- Next by Date: Re: halt does not shut the system down
- Previous by thread: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- Next by thread: Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- Index(es):
Relevant Pages
|