equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
371 alignedLength = round_page(numBytes); |
371 alignedLength = round_page(numBytes); |
372 pageCount = alignedLength/vm_page_size; |
372 pageCount = alignedLength/vm_page_size; |
373 |
373 |
374 // Allocate storage for pages and flags. |
374 // Allocate storage for pages and flags. |
375 pages = malloc(pageCount * sizeof(vm_offset_t)); |
375 pages = malloc(pageCount * sizeof(vm_offset_t)); |
|
376 if (pages == NULL) { |
|
377 (*env)->DeleteLocalRef(env, array); |
|
378 return NULL; |
|
379 } |
376 mapped = calloc(pageCount, sizeof(int)); |
380 mapped = calloc(pageCount, sizeof(int)); |
|
381 if (mapped == NULL) { |
|
382 (*env)->DeleteLocalRef(env, array); |
|
383 free(pages); |
|
384 return NULL; |
|
385 } |
377 |
386 |
378 task_t gTask = getTask(env, this_obj); |
387 task_t gTask = getTask(env, this_obj); |
379 // Try to read each of the pages. |
388 // Try to read each of the pages. |
380 for (i = 0; i < pageCount; i++) { |
389 for (i = 0; i < pageCount; i++) { |
381 result = vm_read(gTask, alignedAddress + i*vm_page_size, vm_page_size, |
390 result = vm_read(gTask, alignedAddress + i*vm_page_size, vm_page_size, |