1 |
/* Implementation of memory_object_data_request for pager library |
/* Implementation of memory_object_data_request for pager library |
2 |
Copyright (C) 1994,95,96,97,2000,02 Free Software Foundation |
Copyright (C) 1994,95,96,97,2000,02,05 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
5 |
modify it under the terms of the GNU General Public License as |
modify it under the terms of the GNU General Public License as |
40 |
if (!p) |
if (!p) |
41 |
return EOPNOTSUPP; |
return EOPNOTSUPP; |
42 |
|
|
43 |
/* Acquire the right to meddle with the pagemap */ |
/* Acquire the right to meddle with the pagemap. */ |
44 |
mutex_lock (&p->interlock); |
mutex_lock (&p->interlock); |
45 |
_pager_wait_for_seqno (p, seqno); |
_pager_wait_for_seqno (p, seqno); |
46 |
|
|
47 |
/* sanity checks -- we don't do multi-page requests yet. */ |
/* Sanity checks -- we don't do multi-page requests yet. */ |
48 |
if (control != p->memobjcntl) |
if (control != p->memobjcntl) |
49 |
{ |
{ |
50 |
printf ("incg data request: wrong control port\n"); |
printf ("incg data request: wrong control port\n"); |
67 |
if (p->pager_state != NORMAL) |
if (p->pager_state != NORMAL) |
68 |
{ |
{ |
69 |
printf ("pager in wrong state for read\n"); |
printf ("pager in wrong state for read\n"); |
70 |
_pager_release_seqno (p, seqno); |
_pager_allow_termination (p); |
71 |
mutex_unlock (&p->interlock); |
goto release_out; |
|
goto allow_term_out; |
|
72 |
} |
} |
73 |
|
|
74 |
err = _pager_pagemap_resize (p, offset + length); |
err = _pager_pagemap_resize (p, offset + length); |
75 |
if (err) |
if (err) |
76 |
goto release_out; /* Can't do much about the actual error. */ |
{ |
77 |
|
_pager_allow_termination (p); |
78 |
|
goto release_out; /* Can't do much about the actual error. */ |
79 |
|
} |
80 |
|
|
81 |
/* If someone is paging this out right now, the disk contents are |
/* If someone is paging this out right now, the disk contents are |
82 |
unreliable, so we have to wait. It is too expensive (right now) to |
unreliable, so we have to wait. It is too expensive (right now) to |
123 |
goto error_read; |
goto error_read; |
124 |
|
|
125 |
memory_object_data_supply (p->memobjcntl, offset, page, length, 1, |
memory_object_data_supply (p->memobjcntl, offset, page, length, 1, |
126 |
write_lock ? VM_PROT_WRITE : VM_PROT_NONE, 0, |
write_lock ? VM_PROT_WRITE : VM_PROT_NONE, |
127 |
|
p->notify_on_evict ? 1 : 0, |
128 |
MACH_PORT_NULL); |
MACH_PORT_NULL); |
129 |
mutex_lock (&p->interlock); |
mutex_lock (&p->interlock); |
130 |
_pager_mark_object_error (p, offset, length, 0); |
_pager_mark_object_error (p, offset, length, 0); |