X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/143cc14e17b26a90f1f4060725df7ea635161581..b4c24cb9d3df001f2892dc4ed451bc769ff28a9f:/osfmk/i386/loose_ends.c diff --git a/osfmk/i386/loose_ends.c b/osfmk/i386/loose_ends.c index e64faedb2..b0cd27fff 100644 --- a/osfmk/i386/loose_ends.c +++ b/osfmk/i386/loose_ends.c @@ -64,6 +64,49 @@ */ +/* + * copy 'size' bytes from physical to physical address + * the caller must validate the physical ranges + * + * if flush_action == 0, no cache flush necessary + * if flush_action == 1, flush the source + * if flush_action == 2, flush the dest + * if flush_action == 3, flush both source and dest + */ + +kern_return_t copyp2p(vm_offset_t source, vm_offset_t dest, unsigned int size, unsigned int flush_action) { + + switch(flush_action) { + case 1: + flush_dcache(source, size, 1); + break; + case 2: + flush_dcache(dest, size, 1); + break; + case 3: + flush_dcache(source, size, 1); + flush_dcache(dest, size, 1); + break; + + } + bcopy_phys((char *)source, (char *)dest, size); /* Do a physical copy */ + + switch(flush_action) { + case 1: + flush_dcache(source, size, 1); + break; + case 2: + flush_dcache(dest, size, 1); + break; + case 3: + flush_dcache(source, size, 1); + flush_dcache(dest, size, 1); + break; + + } +} + + /* * Copies data from a physical page to a virtual page. This is used to