Correctly calculate size of memory to be mapped when copying. Removal

of the 256Mb 1:1 BAT mapping exposed this as copying into memory that
hadn't been claimed from OpenFirmware.

compiled-tested on: panther (sparc64). Code built, but not used, on sparc64
This commit is contained in:
Peter Grehan 2004-07-08 06:06:56 +00:00
parent 4bb04ec4eb
commit ff6e6584fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131782

View File

@ -47,9 +47,11 @@ ofw_copyin(const void *src, vm_offset_t dest, const size_t len)
{
void *destp, *addr;
size_t dlen;
size_t resid;
destp = (void *)(dest & ~PAGE_MASK);
dlen = roundup(len, PAGE_SIZE);
resid = dest & PAGE_MASK;
dlen = roundup(len + resid, PAGE_SIZE);
if (OF_call_method("claim", memory, 3, 1, destp, dlen, 0, &addr)
== -1) {