From: Albert H. <he...@us...> - 2009-10-25 18:59:41
|
Update of /cvsroot/gc-linux/linux/kernel In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv751/kernel Modified Files: kexec.c Log Message: Merge gc-linux-v2.6.31. Index: kexec.c =================================================================== RCS file: /cvsroot/gc-linux/linux/kernel/kexec.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** kexec.c 25 Oct 2009 18:56:56 -0000 1.4 --- kexec.c 25 Oct 2009 18:59:28 -0000 1.5 *************** *** 581,590 **** ! static int kimage_add_page(struct kimage *image, unsigned long page) { int result; page &= PAGE_MASK; ! result = kimage_add_entry(image, page | IND_SOURCE); if (result == 0) image->destination += PAGE_SIZE; --- 581,591 ---- ! static inline int kimage_add_page_with_flags(struct kimage *image, ! unsigned long page, int flags) { int result; page &= PAGE_MASK; ! result = kimage_add_entry(image, page | (flags & ~PAGE_MASK)); if (result == 0) image->destination += PAGE_SIZE; *************** *** 593,596 **** --- 594,607 ---- } + static int kimage_add_page(struct kimage *image, unsigned long page) + { + return kimage_add_page_with_flags(image, page, IND_SOURCE); + } + + static int kimage_add_page_noalloc(struct kimage *image, unsigned long page) + { + return kimage_add_page_with_flags(image, page, IND_SOURCE|IND_NOALLOC); + } + static void kimage_free_extra_pages(struct kimage *image) *************** *** 611,614 **** --- 622,646 ---- } + int kimage_add_preserved_region(struct kimage *image, unsigned long to, + unsigned long from, int length) + { + int result = 0; + + if (length > 0) { + result = kimage_set_destination(image, to); + if (result < 0) + goto out; + while (length > 0) { + result = kimage_add_page_noalloc(image, from); + if (result < 0) + goto out; + from += PAGE_SIZE; + length -= PAGE_SIZE; + } + } + out: + return result; + } + #define for_each_kimage_entry(image, ptr, entry) \ for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \ *************** *** 642,648 **** */ ind = entry; } - else if (entry & IND_SOURCE) - kimage_free_entry(entry); } /* Free the final indirection page */ --- 674,682 ---- */ ind = entry; + } else if (entry & IND_SOURCE) { + /* free only entries that we really allocated */ + if (!(entry & IND_NOALLOC)) + kimage_free_entry(entry); } } /* Free the final indirection page */ |