vm_page.c (45347) | vm_page.c (46349) |
---|---|
1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 | 1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 |
37 * $Id: vm_page.c,v 1.128 1999/03/19 05:21:03 alc Exp $ | 37 * $Id: vm_page.c,v 1.129 1999/04/05 19:38:29 julian Exp $ |
38 */ 39 40/* 41 * Copyright (c) 1987, 1990 Carnegie-Mellon University. 42 * All rights reserved. 43 * 44 * Authors: Avadis Tevanian, Jr., Michael Wayne Young 45 * --- 1409 unchanged lines hidden (view full) --- 1455 1456 first_bit = base >> DEV_BSHIFT; 1457 last_bit = (base + size - 1) >> DEV_BSHIFT; 1458 1459 return ((2 << last_bit) - (1 << first_bit)); 1460} 1461 1462/* | 38 */ 39 40/* 41 * Copyright (c) 1987, 1990 Carnegie-Mellon University. 42 * All rights reserved. 43 * 44 * Authors: Avadis Tevanian, Jr., Michael Wayne Young 45 * --- 1409 unchanged lines hidden (view full) --- 1455 1456 first_bit = base >> DEV_BSHIFT; 1457 last_bit = (base + size - 1) >> DEV_BSHIFT; 1458 1459 return ((2 << last_bit) - (1 << first_bit)); 1460} 1461 1462/* |
1463 * set a page valid and clean. May not block. | 1463 * vm_page_set_validclean: |
1464 * | 1464 * |
1465 * In order to maintain consistancy due to the DEV_BSIZE granularity 1466 * of the valid bits, we have to zero non-DEV_BSIZE aligned portions of 1467 * the page at the beginning and end of the valid range when the 1468 * associated valid bits are not already set. | 1465 * Sets portions of a page valid and clean. The arguments are expected 1466 * to be DEV_BSIZE aligned but if they aren't the bitmap is inclusive 1467 * of any partial chunks touched by the range. The invalid portion of 1468 * such chunks will be zero'd. |
1469 * | 1469 * |
1470 * (base + size) must be less then or equal to PAGE_SIZE. | 1470 * This routine may not block. 1471 * 1472 * (base + size) must be less then or equal to PAGE_SIZE. |
1471 */ 1472void 1473vm_page_set_validclean(m, base, size) 1474 vm_page_t m; 1475 int base; 1476 int size; 1477{ 1478 int pagebits; --- 45 unchanged lines hidden (view full) --- 1524 pagebits = vm_page_bits(base, size); 1525 m->valid |= pagebits; 1526 m->dirty &= ~pagebits; 1527 1528 if (base == 0 && size == PAGE_SIZE) 1529 pmap_clear_modify(VM_PAGE_TO_PHYS(m)); 1530} 1531 | 1473 */ 1474void 1475vm_page_set_validclean(m, base, size) 1476 vm_page_t m; 1477 int base; 1478 int size; 1479{ 1480 int pagebits; --- 45 unchanged lines hidden (view full) --- 1526 pagebits = vm_page_bits(base, size); 1527 m->valid |= pagebits; 1528 m->dirty &= ~pagebits; 1529 1530 if (base == 0 && size == PAGE_SIZE) 1531 pmap_clear_modify(VM_PAGE_TO_PHYS(m)); 1532} 1533 |
1534#if 0 1535 1536void 1537vm_page_set_dirty(m, base, size) 1538 vm_page_t m; 1539 int base; 1540 int size; 1541{ 1542 m->dirty |= vm_page_bits(base, size); 1543} 1544 1545#endif 1546 1547void 1548vm_page_clear_dirty(m, base, size) 1549 vm_page_t m; 1550 int base; 1551 int size; 1552{ 1553 m->dirty &= ~vm_page_bits(base, size); 1554} 1555 |
|
1532/* | 1556/* |
1533 * set a page (partially) invalid. May not block. | 1557 * vm_page_set_invalid: 1558 * 1559 * Invalidates DEV_BSIZE'd chunks within a page. Both the 1560 * valid and dirty bits for the effected areas are cleared. 1561 * 1562 * May not block. |
1534 */ 1535void 1536vm_page_set_invalid(m, base, size) 1537 vm_page_t m; 1538 int base; 1539 int size; 1540{ 1541 int bits; 1542 | 1563 */ 1564void 1565vm_page_set_invalid(m, base, size) 1566 vm_page_t m; 1567 int base; 1568 int size; 1569{ 1570 int bits; 1571 |
1543 m->valid &= ~(bits = vm_page_bits(base, size)); 1544 if (m->valid == 0) 1545 m->dirty &= ~bits; | 1572 bits = vm_page_bits(base, size); 1573 m->valid &= ~bits; 1574 m->dirty &= ~bits; |
1546 m->object->generation++; 1547} 1548 1549/* 1550 * vm_page_zero_invalid() 1551 * 1552 * The kernel assumes that the invalid portions of a page contain 1553 * garbage, but such pages can be mapped into memory by user code. --- 335 unchanged lines hidden --- | 1575 m->object->generation++; 1576} 1577 1578/* 1579 * vm_page_zero_invalid() 1580 * 1581 * The kernel assumes that the invalid portions of a page contain 1582 * garbage, but such pages can be mapped into memory by user code. --- 335 unchanged lines hidden --- |