Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37000 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -87,14 +87,15 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
|
|||||||
aligned_phys = (unaligned_phys + buffer_size - 1) & ~(buffer_size - 1);
|
aligned_phys = (unaligned_phys + buffer_size - 1) & ~(buffer_size - 1);
|
||||||
aligned_addr = unaligned_addr + (aligned_phys - unaligned_phys);
|
aligned_addr = unaligned_addr + (aligned_phys - unaligned_phys);
|
||||||
|
|
||||||
SHOW_FLOW(3, "unaligned_phys = %#lx, aligned_phys = %#lx, unaligned_addr = %#lx, aligned_addr = %#lx",
|
SHOW_FLOW(3, "unaligned_phys = %#" B_PRIxPHYSADDR ", aligned_phys = %#"
|
||||||
unaligned_phys, aligned_phys, unaligned_addr, aligned_addr);
|
B_PRIxPHYSADDR ", unaligned_addr = %#" B_PRIxADDR ", aligned_addr = %#"
|
||||||
|
B_PRIxADDR, unaligned_phys, aligned_phys, unaligned_addr, aligned_addr);
|
||||||
|
|
||||||
device->buffer = (void *)aligned_addr;
|
device->buffer = (void *)aligned_addr;
|
||||||
device->buffer_size = buffer_size;
|
device->buffer_size = buffer_size;
|
||||||
// s/g list is directly after buffer
|
// s/g list is directly after buffer
|
||||||
device->buffer_sg_list = (void *)(aligned_addr + buffer_size);
|
device->buffer_sg_list = (void *)(aligned_addr + buffer_size);
|
||||||
device->buffer_sg_list[0].address = (void *)aligned_phys;
|
device->buffer_sg_list[0].address = aligned_phys;
|
||||||
device->buffer_sg_list[0].size = buffer_size;
|
device->buffer_sg_list[0].size = buffer_size;
|
||||||
device->buffer_sg_count = 1;
|
device->buffer_sg_count = 1;
|
||||||
|
|
||||||
@@ -490,8 +491,9 @@ copy_sg_data(scsi_ccb *request, uint offset, uint allocation_length,
|
|||||||
bytes = min(size, req_size);
|
bytes = min(size, req_size);
|
||||||
bytes = min(bytes, sg_list->size);
|
bytes = min(bytes, sg_list->size);
|
||||||
|
|
||||||
SHOW_FLOW(0, "buffer = %p, virt_addr = %#lx, bytes = %lu, to_buffer = %d",
|
SHOW_FLOW(0, "buffer = %p, virt_addr = %#" B_PRIxPHYSADDR ", bytes = %"
|
||||||
buffer, sg_list->address + offset, bytes, to_buffer);
|
B_PRIuSIZE ", to_buffer = %d", buffer, sg_list->address + offset,
|
||||||
|
bytes, to_buffer);
|
||||||
|
|
||||||
if (to_buffer) {
|
if (to_buffer) {
|
||||||
vm_memcpy_from_physical(buffer, sg_list->address + offset, bytes,
|
vm_memcpy_from_physical(buffer, sg_list->address + offset, bytes,
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ sort_physical_address_ranges(phys_addr_range* ranges, uint32 numRanges)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
insert_physical_memory_range(addr_t start, size_t size)
|
insert_physical_memory_range(phys_addr_t start, phys_size_t size)
|
||||||
{
|
{
|
||||||
return insert_physical_address_range(gKernelArgs.physical_memory_range,
|
return insert_physical_address_range(gKernelArgs.physical_memory_range,
|
||||||
&gKernelArgs.num_physical_memory_ranges, MAX_PHYSICAL_MEMORY_RANGE,
|
&gKernelArgs.num_physical_memory_ranges, MAX_PHYSICAL_MEMORY_RANGE,
|
||||||
@@ -379,7 +379,7 @@ insert_physical_memory_range(addr_t start, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
insert_physical_allocated_range(addr_t start, size_t size)
|
insert_physical_allocated_range(phys_addr_t start, phys_size_t size)
|
||||||
{
|
{
|
||||||
return insert_physical_address_range(gKernelArgs.physical_allocated_range,
|
return insert_physical_address_range(gKernelArgs.physical_allocated_range,
|
||||||
&gKernelArgs.num_physical_allocated_ranges,
|
&gKernelArgs.num_physical_allocated_ranges,
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ get_next_virtual_address(size_t size)
|
|||||||
static addr_t
|
static addr_t
|
||||||
get_next_physical_address(size_t size)
|
get_next_physical_address(size_t size)
|
||||||
{
|
{
|
||||||
addr_t base;
|
phys_addr_t base;
|
||||||
if (!get_free_physical_address_range(gKernelArgs.physical_allocated_range,
|
if (!get_free_physical_address_range(gKernelArgs.physical_allocated_range,
|
||||||
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
||||||
size, &base)) {
|
size, &base)) {
|
||||||
@@ -435,7 +435,7 @@ mmu_allocate_physical(addr_t base, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check whether the physical range is still free
|
// check whether the physical range is still free
|
||||||
addr_t foundBase;
|
phys_addr_t foundBase;
|
||||||
if (!get_free_physical_address_range(gKernelArgs.physical_allocated_range,
|
if (!get_free_physical_address_range(gKernelArgs.physical_allocated_range,
|
||||||
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
||||||
size, &foundBase) || foundBase != base) {
|
size, &foundBase) || foundBase != base) {
|
||||||
|
|||||||
+23
-15
@@ -196,7 +196,7 @@ PrecacheIO::IOFinished(status_t status, bool partialTransfer,
|
|||||||
phys_size_t pagesTransferred
|
phys_size_t pagesTransferred
|
||||||
= (bytesTransferred + B_PAGE_SIZE - 1) / B_PAGE_SIZE;
|
= (bytesTransferred + B_PAGE_SIZE - 1) / B_PAGE_SIZE;
|
||||||
|
|
||||||
if (fOffset + bytesTransferred > fCache->virtual_end)
|
if (fOffset + (off_t)bytesTransferred > fCache->virtual_end)
|
||||||
bytesTransferred = fCache->virtual_end - fOffset;
|
bytesTransferred = fCache->virtual_end - fOffset;
|
||||||
|
|
||||||
for (uint32 i = 0; i < pagesTransferred; i++) {
|
for (uint32 i = 0; i < pagesTransferred; i++) {
|
||||||
@@ -343,7 +343,7 @@ read_pages_and_clear_partial(file_cache_ref* ref, void* cookie, off_t offset,
|
|||||||
|
|
||||||
generic_size_t bytesEnd = *_numBytes;
|
generic_size_t bytesEnd = *_numBytes;
|
||||||
|
|
||||||
if (offset + bytesEnd > ref->cache->virtual_end)
|
if (offset + (off_t)bytesEnd > ref->cache->virtual_end)
|
||||||
bytesEnd = ref->cache->virtual_end - offset;
|
bytesEnd = ref->cache->virtual_end - offset;
|
||||||
|
|
||||||
if (status == B_OK && bytesEnd < bytesUntouched) {
|
if (status == B_OK && bytesEnd < bytesUntouched) {
|
||||||
@@ -387,12 +387,12 @@ read_into_cache(file_cache_ref* ref, void* cookie, off_t offset,
|
|||||||
generic_io_vec vecs[MAX_IO_VECS];
|
generic_io_vec vecs[MAX_IO_VECS];
|
||||||
uint32 vecCount = 0;
|
uint32 vecCount = 0;
|
||||||
|
|
||||||
size_t numBytes = PAGE_ALIGN(pageOffset + bufferSize);
|
generic_size_t numBytes = PAGE_ALIGN(pageOffset + bufferSize);
|
||||||
vm_page* pages[MAX_IO_VECS];
|
vm_page* pages[MAX_IO_VECS];
|
||||||
int32 pageIndex = 0;
|
int32 pageIndex = 0;
|
||||||
|
|
||||||
// allocate pages for the cache and mark them busy
|
// allocate pages for the cache and mark them busy
|
||||||
for (size_t pos = 0; pos < numBytes; pos += B_PAGE_SIZE) {
|
for (generic_size_t pos = 0; pos < numBytes; pos += B_PAGE_SIZE) {
|
||||||
vm_page* page = pages[pageIndex++] = vm_page_allocate_page(
|
vm_page* page = pages[pageIndex++] = vm_page_allocate_page(
|
||||||
reservation, PAGE_STATE_CACHED | VM_PAGE_ALLOC_BUSY);
|
reservation, PAGE_STATE_CACHED | VM_PAGE_ALLOC_BUSY);
|
||||||
|
|
||||||
@@ -475,8 +475,9 @@ read_from_file(file_cache_ref* ref, void* cookie, off_t offset,
|
|||||||
ref->cache->Unlock();
|
ref->cache->Unlock();
|
||||||
vm_page_unreserve_pages(reservation);
|
vm_page_unreserve_pages(reservation);
|
||||||
|
|
||||||
|
generic_size_t toRead = bufferSize;
|
||||||
status_t status = vfs_read_pages(ref->vnode, cookie, offset + pageOffset,
|
status_t status = vfs_read_pages(ref->vnode, cookie, offset + pageOffset,
|
||||||
&vec, 1, 0, &bufferSize);
|
&vec, 1, 0, &toRead);
|
||||||
|
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
reserve_pages(ref, reservation, reservePages, false);
|
reserve_pages(ref, reservation, reservePages, false);
|
||||||
@@ -501,7 +502,7 @@ write_to_cache(file_cache_ref* ref, void* cookie, off_t offset,
|
|||||||
// large chunk on the heap.
|
// large chunk on the heap.
|
||||||
generic_io_vec vecs[MAX_IO_VECS];
|
generic_io_vec vecs[MAX_IO_VECS];
|
||||||
uint32 vecCount = 0;
|
uint32 vecCount = 0;
|
||||||
size_t numBytes = PAGE_ALIGN(pageOffset + bufferSize);
|
generic_size_t numBytes = PAGE_ALIGN(pageOffset + bufferSize);
|
||||||
vm_page* pages[MAX_IO_VECS];
|
vm_page* pages[MAX_IO_VECS];
|
||||||
int32 pageIndex = 0;
|
int32 pageIndex = 0;
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
@@ -510,7 +511,7 @@ write_to_cache(file_cache_ref* ref, void* cookie, off_t offset,
|
|||||||
bool writeThrough = false;
|
bool writeThrough = false;
|
||||||
|
|
||||||
// allocate pages for the cache and mark them busy
|
// allocate pages for the cache and mark them busy
|
||||||
for (size_t pos = 0; pos < numBytes; pos += B_PAGE_SIZE) {
|
for (generic_size_t pos = 0; pos < numBytes; pos += B_PAGE_SIZE) {
|
||||||
// TODO: if space is becoming tight, and this cache is already grown
|
// TODO: if space is becoming tight, and this cache is already grown
|
||||||
// big - shouldn't we better steal the pages directly in that case?
|
// big - shouldn't we better steal the pages directly in that case?
|
||||||
// (a working set like approach for the file cache)
|
// (a working set like approach for the file cache)
|
||||||
@@ -656,8 +657,9 @@ write_to_file(file_cache_ref* ref, void* cookie, off_t offset, int32 pageOffset,
|
|||||||
generic_io_vec vec;
|
generic_io_vec vec;
|
||||||
vec.base = buffer;
|
vec.base = buffer;
|
||||||
vec.length = bufferSize;
|
vec.length = bufferSize;
|
||||||
|
generic_size_t toWrite = bufferSize;
|
||||||
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
||||||
&vec, 1, 0, &bufferSize);
|
&vec, 1, 0, &toWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
@@ -672,8 +674,8 @@ write_to_file(file_cache_ref* ref, void* cookie, off_t offset, int32 pageOffset,
|
|||||||
static inline status_t
|
static inline status_t
|
||||||
satisfy_cache_io(file_cache_ref* ref, void* cookie, cache_func function,
|
satisfy_cache_io(file_cache_ref* ref, void* cookie, cache_func function,
|
||||||
off_t offset, addr_t buffer, bool useBuffer, int32 &pageOffset,
|
off_t offset, addr_t buffer, bool useBuffer, int32 &pageOffset,
|
||||||
generic_size_t bytesLeft, size_t &reservePages, off_t &lastOffset,
|
size_t bytesLeft, size_t &reservePages, off_t &lastOffset,
|
||||||
addr_t &lastBuffer, int32 &lastPageOffset, generic_size_t &lastLeft,
|
addr_t &lastBuffer, int32 &lastPageOffset, size_t &lastLeft,
|
||||||
size_t &lastReservedPages, vm_page_reservation* reservation)
|
size_t &lastReservedPages, vm_page_reservation* reservation)
|
||||||
{
|
{
|
||||||
if (lastBuffer == buffer)
|
if (lastBuffer == buffer)
|
||||||
@@ -1286,8 +1288,11 @@ file_cache_read(void* _cacheRef, void* cookie, off_t offset, void* buffer,
|
|||||||
// Caching is disabled -- read directly from the file.
|
// Caching is disabled -- read directly from the file.
|
||||||
generic_io_vec vec;
|
generic_io_vec vec;
|
||||||
vec.base = (addr_t)buffer;
|
vec.base = (addr_t)buffer;
|
||||||
vec.length = *_size;
|
generic_size_t size = vec.length = *_size;
|
||||||
return vfs_read_pages(ref->vnode, cookie, offset, &vec, 1, 0, _size);
|
status_t error = vfs_read_pages(ref->vnode, cookie, offset, &vec, 1, 0,
|
||||||
|
&size);
|
||||||
|
*_size = size;
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cache_io(ref, cookie, offset, (addr_t)buffer, _size, false);
|
return cache_io(ref, cookie, offset, (addr_t)buffer, _size, false);
|
||||||
@@ -1306,9 +1311,12 @@ file_cache_write(void* _cacheRef, void* cookie, off_t offset,
|
|||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
generic_io_vec vec;
|
generic_io_vec vec;
|
||||||
vec.base = (addr_t)buffer;
|
vec.base = (addr_t)buffer;
|
||||||
vec.length = *_size;
|
generic_size_t size = vec.length = *_size;
|
||||||
return vfs_write_pages(ref->vnode, cookie, offset, &vec, 1, 0,
|
|
||||||
_size);
|
status_t error = vfs_write_pages(ref->vnode, cookie, offset, &vec,
|
||||||
|
1, 0, &size);
|
||||||
|
*_size = size;
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NULL buffer -- use a dummy buffer to write zeroes
|
// NULL buffer -- use a dummy buffer to write zeroes
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ VMVnodeCache::Read(off_t offset, const generic_io_vec *vecs, size_t count,
|
|||||||
|
|
||||||
generic_size_t bytesEnd = *_numBytes;
|
generic_size_t bytesEnd = *_numBytes;
|
||||||
|
|
||||||
if (offset + bytesEnd > virtual_end)
|
if (offset + (off_t)bytesEnd > virtual_end)
|
||||||
bytesEnd = virtual_end - offset;
|
bytesEnd = virtual_end - offset;
|
||||||
|
|
||||||
// If the request could be filled completely, or an error occured,
|
// If the request could be filled completely, or an error occured,
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ IOCache::_DoRequest(IORequest* request, generic_size_t& _bytesTransferred)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
// truncate the request to the device capacity
|
// truncate the request to the device capacity
|
||||||
if (fDeviceCapacity - offset < length)
|
if (fDeviceCapacity - offset < (off_t)length)
|
||||||
length = fDeviceCapacity - offset;
|
length = fDeviceCapacity - offset;
|
||||||
|
|
||||||
_bytesTransferred = 0;
|
_bytesTransferred = 0;
|
||||||
@@ -374,8 +374,8 @@ IOCache::_TransferRequestLine(IORequest* request, off_t lineOffset,
|
|||||||
// request that doesn't cover the complete missing range.
|
// request that doesn't cover the complete missing range.
|
||||||
if (request->IsRead()
|
if (request->IsRead()
|
||||||
|| requestOffset < (off_t)firstMissing * B_PAGE_SIZE
|
|| requestOffset < (off_t)firstMissing * B_PAGE_SIZE
|
||||||
|| requestOffset + requestLength
|
|| requestOffset + (off_t)requestLength
|
||||||
> (lastMissing + 1) * B_PAGE_SIZE) {
|
> (off_t)(lastMissing + 1) * B_PAGE_SIZE) {
|
||||||
status_t error = _TransferPages(firstMissing - firstPageOffset,
|
status_t error = _TransferPages(firstMissing - firstPageOffset,
|
||||||
missingPages, false, isVIP);
|
missingPages, false, isVIP);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
|
|||||||
@@ -260,9 +260,9 @@ IOBuffer::Dump() const
|
|||||||
|
|
||||||
kprintf(" origin: %s\n", fUser ? "user" : "kernel");
|
kprintf(" origin: %s\n", fUser ? "user" : "kernel");
|
||||||
kprintf(" kind: %s\n", fPhysical ? "physical" : "virtual");
|
kprintf(" kind: %s\n", fPhysical ? "physical" : "virtual");
|
||||||
kprintf(" length: %lu\n", fLength);
|
kprintf(" length: %" B_PRIuGENADDR "\n", fLength);
|
||||||
kprintf(" capacity: %lu\n", fCapacity);
|
kprintf(" capacity: %" B_PRIuSIZE "\n", fCapacity);
|
||||||
kprintf(" vecs: %lu\n", fVecCount);
|
kprintf(" vecs: %" B_PRIuSIZE "\n", fVecCount);
|
||||||
|
|
||||||
for (uint32 i = 0; i < fVecCount; i++) {
|
for (uint32 i = 0; i < fVecCount; i++) {
|
||||||
kprintf(" [%" B_PRIu32 "] %#" B_PRIxGENADDR ", %" B_PRIuGENADDR "\n",
|
kprintf(" [%" B_PRIu32 "] %#" B_PRIxGENADDR ", %" B_PRIuGENADDR "\n",
|
||||||
@@ -354,7 +354,7 @@ IOOperation::Finish()
|
|||||||
|
|
||||||
if (offset < startOffset) {
|
if (offset < startOffset) {
|
||||||
// If the complete vector is before the start offset, skip it.
|
// If the complete vector is before the start offset, skip it.
|
||||||
if (offset + length <= startOffset) {
|
if (offset + (off_t)length <= startOffset) {
|
||||||
offset += length;
|
offset += length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ IOOperation::Finish()
|
|||||||
length -= diff;
|
length -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset + length > endOffset) {
|
if (offset + (off_t)length > endOffset) {
|
||||||
// If we're already beyond the end offset, we're done.
|
// If we're already beyond the end offset, we're done.
|
||||||
if (offset >= endOffset)
|
if (offset >= endOffset)
|
||||||
break;
|
break;
|
||||||
@@ -462,7 +462,7 @@ IOOperation::Prepare(IORequest* request)
|
|||||||
vecOffset = 0;
|
vecOffset = 0;
|
||||||
|
|
||||||
if (base >= bounceBufferStart && base < bounceBufferEnd) {
|
if (base >= bounceBufferStart && base < bounceBufferEnd) {
|
||||||
if (offset + length > endOffset)
|
if (offset + (off_t)length > endOffset)
|
||||||
length = endOffset - offset;
|
length = endOffset - offset;
|
||||||
status_t error = fParent->CopyData(offset,
|
status_t error = fParent->CopyData(offset,
|
||||||
bounceBuffer + (base - bounceBufferStart), length);
|
bounceBuffer + (base - bounceBufferStart), length);
|
||||||
@@ -666,10 +666,10 @@ IOOperation::Dump() const
|
|||||||
kprintf(" dma buffer: %p\n", fDMABuffer);
|
kprintf(" dma buffer: %p\n", fDMABuffer);
|
||||||
kprintf(" offset: %-8Ld (original: %Ld)\n", fOffset,
|
kprintf(" offset: %-8Ld (original: %Ld)\n", fOffset,
|
||||||
fOriginalOffset);
|
fOriginalOffset);
|
||||||
kprintf(" length: %-8lu (original: %lu)\n", fLength,
|
kprintf(" length: %-8" B_PRIuGENADDR " (original: %"
|
||||||
fOriginalLength);
|
B_PRIuGENADDR ")\n", fLength, fOriginalLength);
|
||||||
kprintf(" transferred: %lu\n", fTransferredBytes);
|
kprintf(" transferred: %" B_PRIuGENADDR "\n", fTransferredBytes);
|
||||||
kprintf(" block size: %lu\n", fBlockSize);
|
kprintf(" block size: %" B_PRIuGENADDR "\n", fBlockSize);
|
||||||
kprintf(" saved vec index: %u\n", fSavedVecIndex);
|
kprintf(" saved vec index: %u\n", fSavedVecIndex);
|
||||||
kprintf(" saved vec length: %u\n", fSavedVecLength);
|
kprintf(" saved vec length: %u\n", fSavedVecLength);
|
||||||
kprintf(" r/w: %s\n", IsWrite() ? "write" : "read");
|
kprintf(" r/w: %s\n", IsWrite() ? "write" : "read");
|
||||||
@@ -772,7 +772,7 @@ IORequest::CreateSubRequest(off_t parentOffset, off_t offset,
|
|||||||
generic_size_t length, IORequest*& _subRequest)
|
generic_size_t length, IORequest*& _subRequest)
|
||||||
{
|
{
|
||||||
ASSERT(parentOffset >= fOffset && length <= fLength
|
ASSERT(parentOffset >= fOffset && length <= fLength
|
||||||
&& parentOffset - fOffset <= fLength - length);
|
&& parentOffset - fOffset <= (off_t)(fLength - length));
|
||||||
|
|
||||||
// find start vec
|
// find start vec
|
||||||
generic_size_t vecOffset = parentOffset - fOffset;
|
generic_size_t vecOffset = parentOffset - fOffset;
|
||||||
@@ -1160,7 +1160,7 @@ IORequest::_CopyData(void* _buffer, off_t offset, size_t size, bool copyIn)
|
|||||||
|
|
||||||
uint8* buffer = (uint8*)_buffer;
|
uint8* buffer = (uint8*)_buffer;
|
||||||
|
|
||||||
if (offset < fOffset || offset + size > fOffset + fLength) {
|
if (offset < fOffset || offset + (off_t)size > fOffset + (off_t)fLength) {
|
||||||
panic("IORequest::_CopyData(): invalid range: (%lld, %lu)", offset,
|
panic("IORequest::_CopyData(): invalid range: (%lld, %lu)", offset,
|
||||||
size);
|
size);
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -1284,9 +1284,9 @@ IORequest::Dump() const
|
|||||||
kprintf(" mutex: %p\n", &fLock);
|
kprintf(" mutex: %p\n", &fLock);
|
||||||
kprintf(" IOBuffer: %p\n", fBuffer);
|
kprintf(" IOBuffer: %p\n", fBuffer);
|
||||||
kprintf(" offset: %Ld\n", fOffset);
|
kprintf(" offset: %Ld\n", fOffset);
|
||||||
kprintf(" length: %lu\n", fLength);
|
kprintf(" length: %" B_PRIuGENADDR "\n", fLength);
|
||||||
kprintf(" transfer size: %lu\n", fTransferSize);
|
kprintf(" transfer size: %" B_PRIuGENADDR "\n", fTransferSize);
|
||||||
kprintf(" relative offset: %lu\n", fRelativeParentOffset);
|
kprintf(" relative offset: %" B_PRIuGENADDR "\n", fRelativeParentOffset);
|
||||||
kprintf(" pending children: %ld\n", fPendingChildren);
|
kprintf(" pending children: %ld\n", fPendingChildren);
|
||||||
kprintf(" flags: %#lx\n", fFlags);
|
kprintf(" flags: %#lx\n", fFlags);
|
||||||
kprintf(" team: %ld\n", fTeam);
|
kprintf(" team: %ld\n", fTeam);
|
||||||
@@ -1296,8 +1296,8 @@ IORequest::Dump() const
|
|||||||
kprintf(" finished cvar: %p\n", &fFinishedCondition);
|
kprintf(" finished cvar: %p\n", &fFinishedCondition);
|
||||||
kprintf(" iteration:\n");
|
kprintf(" iteration:\n");
|
||||||
kprintf(" vec index: %lu\n", fVecIndex);
|
kprintf(" vec index: %lu\n", fVecIndex);
|
||||||
kprintf(" vec offset: %lu\n", fVecOffset);
|
kprintf(" vec offset: %" B_PRIuGENADDR "\n", fVecOffset);
|
||||||
kprintf(" remaining bytes: %lu\n", fRemainingBytes);
|
kprintf(" remaining bytes: %" B_PRIuGENADDR "\n", fRemainingBytes);
|
||||||
kprintf(" callbacks:\n");
|
kprintf(" callbacks:\n");
|
||||||
kprintf(" finished %p, cookie %p\n", fFinishedCallback, fFinishedCookie);
|
kprintf(" finished %p, cookie %p\n", fFinishedCallback, fFinishedCookie);
|
||||||
kprintf(" iteration %p, cookie %p\n", fIterationCallback,
|
kprintf(" iteration %p, cookie %p\n", fIterationCallback,
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ IOSchedulerSimple::_PrepareRequestOperations(IORequest* request,
|
|||||||
usedBandwidth = 0;
|
usedBandwidth = 0;
|
||||||
|
|
||||||
if (fDMAResource != NULL) {
|
if (fDMAResource != NULL) {
|
||||||
while (quantum >= fBlockSize && request->RemainingBytes() > 0) {
|
while (quantum >= (off_t)fBlockSize && request->RemainingBytes() > 0) {
|
||||||
IOOperation* operation = fUnusedOperations.RemoveHead();
|
IOOperation* operation = fUnusedOperations.RemoveHead();
|
||||||
if (operation == NULL)
|
if (operation == NULL)
|
||||||
return false;
|
return false;
|
||||||
@@ -618,14 +618,14 @@ IOSchedulerSimple::_Scheduler()
|
|||||||
fActiveRequestOwners.Remove(&marker);
|
fActiveRequestOwners.Remove(&marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner == NULL || quantum < fBlockSize) {
|
if (owner == NULL || quantum < (off_t)fBlockSize) {
|
||||||
if (!_NextActiveRequestOwner(owner, quantum)) {
|
if (!_NextActiveRequestOwner(owner, quantum)) {
|
||||||
// we've been asked to terminate
|
// we've been asked to terminate
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (resourcesAvailable && iterationBandwidth >= fBlockSize) {
|
while (resourcesAvailable && iterationBandwidth >= (off_t)fBlockSize) {
|
||||||
//dprintf("IOSchedulerSimple::_Scheduler(): request owner: %p (thread %ld)\n",
|
//dprintf("IOSchedulerSimple::_Scheduler(): request owner: %p (thread %ld)\n",
|
||||||
//owner, owner->thread);
|
//owner, owner->thread);
|
||||||
// Prepare operations for the owner.
|
// Prepare operations for the owner.
|
||||||
@@ -643,12 +643,14 @@ IOSchedulerSimple::_Scheduler()
|
|||||||
quantum -= bandwidth;
|
quantum -= bandwidth;
|
||||||
iterationBandwidth -= bandwidth;
|
iterationBandwidth -= bandwidth;
|
||||||
|
|
||||||
if (quantum < fBlockSize || iterationBandwidth < fBlockSize)
|
if (quantum < (off_t)fBlockSize
|
||||||
|
|| iterationBandwidth < (off_t)fBlockSize) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (resourcesAvailable && quantum >= fBlockSize
|
while (resourcesAvailable && quantum >= (off_t)fBlockSize
|
||||||
&& iterationBandwidth >= fBlockSize) {
|
&& iterationBandwidth >= (off_t)fBlockSize) {
|
||||||
IORequest* request = owner->requests.Head();
|
IORequest* request = owner->requests.Head();
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
resourcesAvailable = false;
|
resourcesAvailable = false;
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ translate_partition_access(devfs_partition* partition, io_request* request)
|
|||||||
off_t offset = request->Offset();
|
off_t offset = request->Offset();
|
||||||
|
|
||||||
ASSERT(offset >= 0);
|
ASSERT(offset >= 0);
|
||||||
ASSERT(offset + request->Length() <= partition->info.size);
|
ASSERT(offset + (off_t)request->Length() <= partition->info.size);
|
||||||
|
|
||||||
request->SetOffset(offset + partition->info.offset);
|
request->SetOffset(offset + partition->info.offset);
|
||||||
}
|
}
|
||||||
@@ -1792,7 +1792,7 @@ devfs_io(fs_volume *volume, fs_vnode *_vnode, void *_cookie,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vnode->stream.u.dev.partition != NULL) {
|
if (vnode->stream.u.dev.partition != NULL) {
|
||||||
if (request->Offset() + request->Length()
|
if (request->Offset() + (off_t)request->Length()
|
||||||
> vnode->stream.u.dev.partition->info.size) {
|
> vnode->stream.u.dev.partition->info.size) {
|
||||||
request->SetStatusAndNotify(B_BAD_VALUE);
|
request->SetStatusAndNotify(B_BAD_VALUE);
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ DMABuffer::Dump() const
|
|||||||
{
|
{
|
||||||
kprintf("DMABuffer at %p\n", this);
|
kprintf("DMABuffer at %p\n", this);
|
||||||
|
|
||||||
kprintf(" bounce buffer: %p (physical %#lx)\n",
|
kprintf(" bounce buffer: %p (physical %#" B_PRIxPHYSADDR ")\n",
|
||||||
fBounceBuffer->address, fBounceBuffer->physical_address);
|
fBounceBuffer->address, fBounceBuffer->physical_address);
|
||||||
kprintf(" bounce buffer size: %lu\n", fBounceBuffer->size);
|
kprintf(" bounce buffer size: %" B_PRIxPHYSADDR "\n", fBounceBuffer->size);
|
||||||
kprintf(" vecs: %lu\n", fVecCount);
|
kprintf(" vecs: %lu\n", fVecCount);
|
||||||
|
|
||||||
for (uint32 i = 0; i < fVecCount; i++) {
|
for (uint32 i = 0; i < fVecCount; i++) {
|
||||||
@@ -169,8 +169,10 @@ DMAResource::Init(const dma_restrictions& restrictions,
|
|||||||
fBounceBufferSize);
|
fBounceBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("DMAResource@%p: low/high %lx/%lx, max segment count %lu, align %lu, "
|
dprintf("DMAResource@%p: low/high %" B_PRIxGENADDR "/%" B_PRIxGENADDR
|
||||||
"boundary %lu, max transfer %lu, max segment size %lu\n", this,
|
", max segment count %" B_PRIu32 ", align %" B_PRIuGENADDR ", "
|
||||||
|
"boundary %" B_PRIuGENADDR ", max transfer %" B_PRIuGENADDR
|
||||||
|
", max segment size %" B_PRIuGENADDR "\n", this,
|
||||||
fRestrictions.low_address, fRestrictions.high_address,
|
fRestrictions.low_address, fRestrictions.high_address,
|
||||||
fRestrictions.max_segment_count, fRestrictions.alignment,
|
fRestrictions.max_segment_count, fRestrictions.alignment,
|
||||||
fRestrictions.boundary, fRestrictions.max_transfer_size,
|
fRestrictions.boundary, fRestrictions.max_transfer_size,
|
||||||
@@ -224,10 +226,14 @@ DMAResource::CreateBounceBuffer(DMABounceBuffer** _buffer)
|
|||||||
area_id area = -1;
|
area_id area = -1;
|
||||||
phys_size_t size = ROUNDUP(fBounceBufferSize, B_PAGE_SIZE);
|
phys_size_t size = ROUNDUP(fBounceBufferSize, B_PAGE_SIZE);
|
||||||
|
|
||||||
if (fRestrictions.alignment > B_PAGE_SIZE)
|
if (fRestrictions.alignment > B_PAGE_SIZE) {
|
||||||
dprintf("dma buffer restrictions not yet implemented: alignment %lu\n", fRestrictions.alignment);
|
dprintf("dma buffer restrictions not yet implemented: alignment %"
|
||||||
if (fRestrictions.boundary > B_PAGE_SIZE)
|
B_PRIuGENADDR "\n", fRestrictions.alignment);
|
||||||
dprintf("dma buffer restrictions not yet implemented: boundary %lu\n", fRestrictions.boundary);
|
}
|
||||||
|
if (fRestrictions.boundary > B_PAGE_SIZE) {
|
||||||
|
dprintf("dma buffer restrictions not yet implemented: boundary %"
|
||||||
|
B_PRIuGENADDR "\n", fRestrictions.boundary);
|
||||||
|
}
|
||||||
|
|
||||||
bounceBuffer = (void*)fRestrictions.low_address;
|
bounceBuffer = (void*)fRestrictions.low_address;
|
||||||
// TODO: We also need to enforce the boundary restrictions.
|
// TODO: We also need to enforce the boundary restrictions.
|
||||||
@@ -623,7 +629,7 @@ DMAResource::TranslateNext(IORequest* request, IOOperation* operation,
|
|||||||
// vec is a bounce buffer segment shorter than the block size. If so, we
|
// vec is a bounce buffer segment shorter than the block size. If so, we
|
||||||
// have to cut back the complete block and use a bounce buffer for it
|
// have to cut back the complete block and use a bounce buffer for it
|
||||||
// entirely.
|
// entirely.
|
||||||
if (diff == 0 && offset + dmaLength > requestEnd) {
|
if (diff == 0 && offset + (off_t)dmaLength > requestEnd) {
|
||||||
const generic_io_vec& dmaVec
|
const generic_io_vec& dmaVec
|
||||||
= dmaBuffer->VecAt(dmaBuffer->VecCount() - 1);
|
= dmaBuffer->VecAt(dmaBuffer->VecCount() - 1);
|
||||||
ASSERT(dmaVec.base >= dmaBuffer->PhysicalBounceBufferAddress()
|
ASSERT(dmaVec.base >= dmaBuffer->PhysicalBounceBufferAddress()
|
||||||
@@ -708,9 +714,10 @@ DMAResource::TranslateNext(IORequest* request, IOOperation* operation,
|
|||||||
operation->SetBuffer(dmaBuffer);
|
operation->SetBuffer(dmaBuffer);
|
||||||
operation->SetBlockSize(fBlockSize);
|
operation->SetBlockSize(fBlockSize);
|
||||||
operation->SetOriginalRange(originalOffset,
|
operation->SetOriginalRange(originalOffset,
|
||||||
min_c(offset + dmaLength, requestEnd) - originalOffset);
|
min_c(offset + (off_t)dmaLength, requestEnd) - originalOffset);
|
||||||
operation->SetRange(offset, dmaLength);
|
operation->SetRange(offset, dmaLength);
|
||||||
operation->SetPartial(partialBegin != 0, offset + dmaLength > requestEnd);
|
operation->SetPartial(partialBegin != 0,
|
||||||
|
offset + (off_t)dmaLength > requestEnd);
|
||||||
|
|
||||||
// If we don't need the bounce buffer, we put it back, otherwise
|
// If we don't need the bounce buffer, we put it back, otherwise
|
||||||
operation->SetUsesBounceBuffer(bounceLeft < fBounceBufferSize);
|
operation->SetUsesBounceBuffer(bounceLeft < fBounceBufferSize);
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
do_iterative_fd_io_finish(void* _cookie, io_request* request, status_t status,
|
do_iterative_fd_io_finish(void* _cookie, io_request* request, status_t status,
|
||||||
bool partialTransfer, size_t transferEndOffset)
|
bool partialTransfer, generic_size_t transferEndOffset)
|
||||||
{
|
{
|
||||||
iterative_io_cookie* cookie = (iterative_io_cookie*)_cookie;
|
iterative_io_cookie* cookie = (iterative_io_cookie*)_cookie;
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ do_synchronous_iterative_vnode_io(struct vnode* vnode, void* openCookie,
|
|||||||
|
|
||||||
for (uint32 i = 0; i < fileVecCount; i++) {
|
for (uint32 i = 0; i < fileVecCount; i++) {
|
||||||
const file_io_vec& fileVec = fileVecs[i];
|
const file_io_vec& fileVec = fileVecs[i];
|
||||||
size_t toTransfer = min_c(fileVec.length, length);
|
size_t toTransfer = min_c(fileVec.length, (off_t)length);
|
||||||
size_t transferred = toTransfer;
|
size_t transferred = toTransfer;
|
||||||
error = io.IO(fileVec.offset, vecBase, &transferred);
|
error = io.IO(fileVec.offset, vecBase, &transferred);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
@@ -327,7 +327,7 @@ synchronous_io(io_request* request, DoIO& io)
|
|||||||
TRACE_RIO("[%ld] I/O: offset: %lld, vecBase: %p, length: %lu\n",
|
TRACE_RIO("[%ld] I/O: offset: %lld, vecBase: %p, length: %lu\n",
|
||||||
find_thread(NULL), offset, vecBase, vecLength);
|
find_thread(NULL), offset, vecBase, vecLength);
|
||||||
|
|
||||||
generic_size_t transferred = vecLength;
|
size_t transferred = vecLength;
|
||||||
status_t error = io.IO(offset, vecBase, &transferred);
|
status_t error = io.IO(offset, vecBase, &transferred);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
TRACE_RIO("[%ld] I/O failed: %#lx\n", find_thread(NULL), error);
|
TRACE_RIO("[%ld] I/O failed: %#lx\n", find_thread(NULL), error);
|
||||||
@@ -382,8 +382,8 @@ vfs_synchronous_io(io_request* request,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
vfs_asynchronous_read_pages(struct vnode* vnode, void* cookie, off_t pos,
|
vfs_asynchronous_read_pages(struct vnode* vnode, void* cookie, off_t pos,
|
||||||
const generic_io_vec* vecs, size_t count, size_t numBytes, uint32 flags,
|
const generic_io_vec* vecs, size_t count, generic_size_t numBytes,
|
||||||
AsyncIOCallback* callback)
|
uint32 flags, AsyncIOCallback* callback)
|
||||||
{
|
{
|
||||||
IORequest* request = IORequest::Create((flags & B_VIP_IO_REQUEST) != 0);
|
IORequest* request = IORequest::Create((flags & B_VIP_IO_REQUEST) != 0);
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
@@ -408,8 +408,8 @@ vfs_asynchronous_read_pages(struct vnode* vnode, void* cookie, off_t pos,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
vfs_asynchronous_write_pages(struct vnode* vnode, void* cookie, off_t pos,
|
vfs_asynchronous_write_pages(struct vnode* vnode, void* cookie, off_t pos,
|
||||||
const generic_io_vec* vecs, size_t count, size_t numBytes, uint32 flags,
|
const generic_io_vec* vecs, size_t count, generic_size_t numBytes,
|
||||||
AsyncIOCallback* callback)
|
uint32 flags, AsyncIOCallback* callback)
|
||||||
{
|
{
|
||||||
IORequest* request = IORequest::Create((flags & B_VIP_IO_REQUEST) != 0);
|
IORequest* request = IORequest::Create((flags & B_VIP_IO_REQUEST) != 0);
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ dump_info(int argc, char **argv)
|
|||||||
kprintf(" [%ld] %Ld\n", i + 1, gCPU[i].active_time);
|
kprintf(" [%ld] %Ld\n", i + 1, gCPU[i].active_time);
|
||||||
|
|
||||||
// ToDo: Add page_faults
|
// ToDo: Add page_faults
|
||||||
kprintf("pages:\t\t%ld (%ld max)\n",
|
kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n",
|
||||||
vm_page_num_pages() - vm_page_num_free_pages(), vm_page_num_pages());
|
vm_page_num_pages() - vm_page_num_free_pages(), vm_page_num_pages());
|
||||||
|
|
||||||
kprintf("sems:\t\t%ld (%ld max)\n", sem_used_sems(), sem_max_sems());
|
kprintf("sems:\t\t%ld (%ld max)\n", sem_used_sems(), sem_max_sems());
|
||||||
|
|||||||
@@ -752,8 +752,8 @@ VMCache::InsertPage(vm_page* page, off_t offset)
|
|||||||
vm_page* otherPage = pages.Lookup(page->cache_offset);
|
vm_page* otherPage = pages.Lookup(page->cache_offset);
|
||||||
if (otherPage != NULL) {
|
if (otherPage != NULL) {
|
||||||
panic("VMCache::InsertPage(): there's already page %p with cache "
|
panic("VMCache::InsertPage(): there's already page %p with cache "
|
||||||
"offset %lu in cache %p; inserting page %p", otherPage,
|
"offset %" B_PRIuPHYSADDR " in cache %p; inserting page %p",
|
||||||
page->cache_offset, this, page);
|
otherPage, page->cache_offset, this, page);
|
||||||
}
|
}
|
||||||
#endif // KDEBUG
|
#endif // KDEBUG
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
inline vm_page* Previous(vm_page* page) const;
|
inline vm_page* Previous(vm_page* page) const;
|
||||||
inline vm_page* Next(vm_page* page) const;
|
inline vm_page* Next(vm_page* page) const;
|
||||||
|
|
||||||
inline uint32 Count() const { return fCount; }
|
inline phys_addr_t Count() const { return fCount; }
|
||||||
|
|
||||||
inline Iterator GetIterator() const;
|
inline Iterator GetIterator() const;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
const char* fName;
|
const char* fName;
|
||||||
spinlock fLock;
|
spinlock fLock;
|
||||||
uint32 fCount;
|
phys_addr_t fCount;
|
||||||
PageList fPages;
|
PageList fPages;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ VMTranslationMap::UnmapPages(VMArea* area, addr_t base, size_t size,
|
|||||||
addr_t end = address + size;
|
addr_t end = address + size;
|
||||||
#if DEBUG_PAGE_ACCESS
|
#if DEBUG_PAGE_ACCESS
|
||||||
for (; address != end; address += B_PAGE_SIZE) {
|
for (; address != end; address += B_PAGE_SIZE) {
|
||||||
addr_t physicalAddress;
|
phys_addr_t physicalAddress;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
if (Query(address, &physicalAddress, &flags) == B_OK
|
if (Query(address, &physicalAddress, &flags) == B_OK
|
||||||
&& (flags & PAGE_PRESENT) == 0) {
|
&& (flags & PAGE_PRESENT) == 0) {
|
||||||
@@ -85,7 +85,7 @@ VMTranslationMap::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
|||||||
addr_t end = address + area->Size();
|
addr_t end = address + area->Size();
|
||||||
#if DEBUG_PAGE_ACCESS
|
#if DEBUG_PAGE_ACCESS
|
||||||
for (; address != end; address += B_PAGE_SIZE) {
|
for (; address != end; address += B_PAGE_SIZE) {
|
||||||
addr_t physicalAddress;
|
phys_addr_t physicalAddress;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
if (Query(address, &physicalAddress, &flags) == B_OK
|
if (Query(address, &physicalAddress, &flags) == B_OK
|
||||||
&& (flags & PAGE_PRESENT) == 0) {
|
&& (flags & PAGE_PRESENT) == 0) {
|
||||||
|
|||||||
+13
-12
@@ -1303,8 +1303,8 @@ vm_create_anonymous_area(team_id team, const char* name, void** address,
|
|||||||
}
|
}
|
||||||
page = vm_lookup_page(physicalAddress / B_PAGE_SIZE);
|
page = vm_lookup_page(physicalAddress / B_PAGE_SIZE);
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
panic("looking up page failed for pa 0x%lx\n",
|
panic("looking up page failed for pa %#" B_PRIxPHYSADDR
|
||||||
physicalAddress);
|
"\n", physicalAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PAGE_ACCESS_START(page);
|
DEBUG_PAGE_ACCESS_START(page);
|
||||||
@@ -2934,8 +2934,8 @@ dump_caches(int argc, char** argv)
|
|||||||
: &cache_info_compare_committed);
|
: &cache_info_compare_committed);
|
||||||
}
|
}
|
||||||
|
|
||||||
kprintf("total committed memory: %lld, total used pages: %lu\n",
|
kprintf("total committed memory: %" B_PRIdOFF ", total used pages: %"
|
||||||
totalCommitted, totalPages);
|
B_PRIuPHYSADDR "\n", totalCommitted, totalPages);
|
||||||
kprintf("%lu caches (%lu root caches), sorted by %s per cache "
|
kprintf("%lu caches (%lu root caches), sorted by %s per cache "
|
||||||
"tree...\n\n", totalCount, rootCount,
|
"tree...\n\n", totalCount, rootCount,
|
||||||
sortByPageCount ? "page count" : "committed size");
|
sortByPageCount ? "page count" : "committed size");
|
||||||
@@ -3021,10 +3021,11 @@ dump_cache(int argc, char** argv)
|
|||||||
for (VMCachePagesTree::Iterator it = cache->pages.GetIterator();
|
for (VMCachePagesTree::Iterator it = cache->pages.GetIterator();
|
||||||
vm_page* page = it.Next();) {
|
vm_page* page = it.Next();) {
|
||||||
if (!vm_page_is_dummy(page)) {
|
if (!vm_page_is_dummy(page)) {
|
||||||
kprintf("\t%p ppn 0x%lx offset 0x%lx state %u (%s) "
|
kprintf("\t%p ppn %#" B_PRIxPHYSADDR " offset %#" B_PRIxPHYSADDR
|
||||||
"wired_count %u\n", page, page->physical_page_number,
|
" state %u (%s) wired_count %u\n", page,
|
||||||
page->cache_offset, page->State(),
|
page->physical_page_number, page->cache_offset,
|
||||||
page_state_to_string(page->State()), page->wired_count);
|
page->State(), page_state_to_string(page->State()),
|
||||||
|
page->wired_count);
|
||||||
} else {
|
} else {
|
||||||
kprintf("\t%p DUMMY PAGE state %u (%s)\n",
|
kprintf("\t%p DUMMY PAGE state %u (%s)\n",
|
||||||
page, page->State(), page_state_to_string(page->State()));
|
page, page->State(), page_state_to_string(page->State()));
|
||||||
@@ -3174,8 +3175,8 @@ dump_area_list(int argc, char** argv)
|
|||||||
static int
|
static int
|
||||||
dump_available_memory(int argc, char** argv)
|
dump_available_memory(int argc, char** argv)
|
||||||
{
|
{
|
||||||
kprintf("Available memory: %Ld/%lu bytes\n",
|
kprintf("Available memory: %" B_PRIdOFF "/%" B_PRIuPHYSADDR " bytes\n",
|
||||||
sAvailableMemory, vm_page_num_pages() * B_PAGE_SIZE);
|
sAvailableMemory, (phys_addr_t)vm_page_num_pages() * B_PAGE_SIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6071,8 +6072,8 @@ _user_set_memory_protection(void* _address, size_t size, uint32 protection)
|
|||||||
|
|
||||||
vm_page* page = vm_lookup_page(physicalAddress / B_PAGE_SIZE);
|
vm_page* page = vm_lookup_page(physicalAddress / B_PAGE_SIZE);
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
panic("area %p looking up page failed for pa 0x%lx\n", area,
|
panic("area %p looking up page failed for pa %#" B_PRIxPHYSADDR
|
||||||
physicalAddress);
|
"\n", area, physicalAddress);
|
||||||
map->Unlock();
|
map->Unlock();
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,11 +657,11 @@ dump_page(int argc, char **argv)
|
|||||||
if (!evaluate_debug_expression(argv[index], &value, false))
|
if (!evaluate_debug_expression(argv[index], &value, false))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
addr_t pageAddress = (addr_t)value;
|
uint64 pageAddress = value;
|
||||||
struct vm_page* page;
|
struct vm_page* page;
|
||||||
|
|
||||||
if (addressIsPointer) {
|
if (addressIsPointer) {
|
||||||
page = (struct vm_page *)pageAddress;
|
page = (struct vm_page *)(addr_t)pageAddress;
|
||||||
} else {
|
} else {
|
||||||
if (!physical) {
|
if (!physical) {
|
||||||
VMAddressSpace *addressSpace = VMAddressSpace::Kernel();
|
VMAddressSpace *addressSpace = VMAddressSpace::Kernel();
|
||||||
@@ -670,13 +670,15 @@ dump_page(int argc, char **argv)
|
|||||||
addressSpace = debug_get_debugged_thread()->team->address_space;
|
addressSpace = debug_get_debugged_thread()->team->address_space;
|
||||||
|
|
||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
|
phys_addr_t physicalAddress;
|
||||||
if (addressSpace->TranslationMap()->QueryInterrupt(pageAddress,
|
if (addressSpace->TranslationMap()->QueryInterrupt(pageAddress,
|
||||||
&pageAddress, &flags) != B_OK
|
&physicalAddress, &flags) != B_OK
|
||||||
|| (flags & PAGE_PRESENT) == 0) {
|
|| (flags & PAGE_PRESENT) == 0) {
|
||||||
kprintf("Virtual address not mapped to a physical page in this "
|
kprintf("Virtual address not mapped to a physical page in this "
|
||||||
"address space.\n");
|
"address space.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
pageAddress = physicalAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
page = vm_lookup_page(pageAddress / B_PAGE_SIZE);
|
page = vm_lookup_page(pageAddress / B_PAGE_SIZE);
|
||||||
@@ -685,9 +687,10 @@ dump_page(int argc, char **argv)
|
|||||||
kprintf("PAGE: %p\n", page);
|
kprintf("PAGE: %p\n", page);
|
||||||
kprintf("queue_next,prev: %p, %p\n", page->queue_link.next,
|
kprintf("queue_next,prev: %p, %p\n", page->queue_link.next,
|
||||||
page->queue_link.previous);
|
page->queue_link.previous);
|
||||||
kprintf("physical_number: %#lx\n", page->physical_page_number);
|
kprintf("physical_number: %#" B_PRIxPHYSADDR "\n",
|
||||||
|
page->physical_page_number);
|
||||||
kprintf("cache: %p\n", page->Cache());
|
kprintf("cache: %p\n", page->Cache());
|
||||||
kprintf("cache_offset: %ld\n", page->cache_offset);
|
kprintf("cache_offset: %" B_PRIuPHYSADDR "\n", page->cache_offset);
|
||||||
kprintf("cache_next: %p\n", page->cache_next);
|
kprintf("cache_next: %p\n", page->cache_next);
|
||||||
kprintf("state: %s\n", page_state_to_string(page->State()));
|
kprintf("state: %s\n", page_state_to_string(page->State()));
|
||||||
kprintf("wired_count: %d\n", page->wired_count);
|
kprintf("wired_count: %d\n", page->wired_count);
|
||||||
@@ -777,8 +780,9 @@ dump_page_queue(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
kprintf("queue = %p, queue->head = %p, queue->tail = %p, queue->count = %ld\n",
|
kprintf("queue = %p, queue->head = %p, queue->tail = %p, queue->count = %"
|
||||||
queue, queue->Head(), queue->Tail(), queue->Count());
|
B_PRIuPHYSADDR "\n", queue, queue->Head(), queue->Tail(),
|
||||||
|
queue->Count());
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
struct vm_page *page = queue->Head();
|
struct vm_page *page = queue->Head();
|
||||||
@@ -840,8 +844,10 @@ dump_page_stats(int argc, char **argv)
|
|||||||
page_run longestCachedRun = { 0, 0 };
|
page_run longestCachedRun = { 0, 0 };
|
||||||
|
|
||||||
for (page_num_t i = 0; i < sNumPages; i++) {
|
for (page_num_t i = 0; i < sNumPages; i++) {
|
||||||
if (sPages[i].State() > 7)
|
if (sPages[i].State() > 7) {
|
||||||
panic("page %li at %p has invalid state!\n", i, &sPages[i]);
|
panic("page %" B_PRIuPHYSADDR " at %p has invalid state!\n", i,
|
||||||
|
&sPages[i]);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 pageState = sPages[i].State();
|
uint32 pageState = sPages[i].State();
|
||||||
|
|
||||||
@@ -877,7 +883,7 @@ dump_page_stats(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
kprintf("page stats:\n");
|
kprintf("page stats:\n");
|
||||||
kprintf("total: %lu\n", sNumPages);
|
kprintf("total: %" B_PRIuPHYSADDR "\n", sNumPages);
|
||||||
|
|
||||||
kprintf("active: %" B_PRIuSIZE " (busy: %" B_PRIuSIZE ")\n",
|
kprintf("active: %" B_PRIuSIZE " (busy: %" B_PRIuSIZE ")\n",
|
||||||
counter[PAGE_STATE_ACTIVE], busyCounter[PAGE_STATE_ACTIVE]);
|
counter[PAGE_STATE_ACTIVE], busyCounter[PAGE_STATE_ACTIVE]);
|
||||||
@@ -898,11 +904,11 @@ dump_page_stats(int argc, char **argv)
|
|||||||
kprintf("unsatisfied page reservations: %" B_PRId32 "\n",
|
kprintf("unsatisfied page reservations: %" B_PRId32 "\n",
|
||||||
sUnsatisfiedPageReservations);
|
sUnsatisfiedPageReservations);
|
||||||
kprintf("mapped pages: %lu\n", gMappedPagesCount);
|
kprintf("mapped pages: %lu\n", gMappedPagesCount);
|
||||||
kprintf("longest free pages run: %" B_PRIuSIZE " pages (at %" B_PRIuSIZE
|
kprintf("longest free pages run: %" B_PRIuPHYSADDR " pages (at %"
|
||||||
")\n", longestFreeRun.Length(),
|
B_PRIuPHYSADDR ")\n", longestFreeRun.Length(),
|
||||||
sPages[longestFreeRun.start].physical_page_number);
|
sPages[longestFreeRun.start].physical_page_number);
|
||||||
kprintf("longest free/cached pages run: %" B_PRIuSIZE " pages (at %"
|
kprintf("longest free/cached pages run: %" B_PRIuPHYSADDR " pages (at %"
|
||||||
B_PRIuSIZE ")\n", longestCachedRun.Length(),
|
B_PRIuPHYSADDR ")\n", longestCachedRun.Length(),
|
||||||
sPages[longestCachedRun.start].physical_page_number);
|
sPages[longestCachedRun.start].physical_page_number);
|
||||||
|
|
||||||
kprintf("waiting threads:\n");
|
kprintf("waiting threads:\n");
|
||||||
@@ -914,19 +920,20 @@ dump_page_stats(int argc, char **argv)
|
|||||||
waiter->missing, waiter->dontTouch);
|
waiter->missing, waiter->dontTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
kprintf("\nfree queue: %p, count = %ld\n", &sFreePageQueue,
|
kprintf("\nfree queue: %p, count = %" B_PRIuPHYSADDR "\n", &sFreePageQueue,
|
||||||
sFreePageQueue.Count());
|
sFreePageQueue.Count());
|
||||||
kprintf("clear queue: %p, count = %ld\n", &sClearPageQueue,
|
kprintf("clear queue: %p, count = %" B_PRIuPHYSADDR "\n", &sClearPageQueue,
|
||||||
sClearPageQueue.Count());
|
sClearPageQueue.Count());
|
||||||
kprintf("modified queue: %p, count = %ld (%ld temporary, %lu swappable, "
|
kprintf("modified queue: %p, count = %" B_PRIuPHYSADDR " (%" B_PRId32
|
||||||
"inactive: %lu)\n", &sModifiedPageQueue, sModifiedPageQueue.Count(),
|
" temporary, %" B_PRIuPHYSADDR " swappable, " "inactive: %"
|
||||||
|
B_PRIuPHYSADDR ")\n", &sModifiedPageQueue, sModifiedPageQueue.Count(),
|
||||||
sModifiedTemporaryPages, swappableModified, swappableModifiedInactive);
|
sModifiedTemporaryPages, swappableModified, swappableModifiedInactive);
|
||||||
kprintf("active queue: %p, count = %ld\n", &sActivePageQueue,
|
kprintf("active queue: %p, count = %" B_PRIuPHYSADDR "\n",
|
||||||
sActivePageQueue.Count());
|
&sActivePageQueue, sActivePageQueue.Count());
|
||||||
kprintf("inactive queue: %p, count = %ld\n", &sInactivePageQueue,
|
kprintf("inactive queue: %p, count = %" B_PRIuPHYSADDR "\n",
|
||||||
sInactivePageQueue.Count());
|
&sInactivePageQueue, sInactivePageQueue.Count());
|
||||||
kprintf("cached queue: %p, count = %ld\n", &sCachedPageQueue,
|
kprintf("cached queue: %p, count = %" B_PRIuPHYSADDR "\n",
|
||||||
sCachedPageQueue.Count());
|
&sCachedPageQueue, sCachedPageQueue.Count());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,8 +1308,8 @@ mark_page_range_in_use(page_num_t startPage, page_num_t length, bool wired)
|
|||||||
startPage, length));
|
startPage, length));
|
||||||
|
|
||||||
if (sPhysicalPageOffset > startPage) {
|
if (sPhysicalPageOffset > startPage) {
|
||||||
dprintf("mark_page_range_in_use(%#" B_PRIxADDR ", %#" B_PRIxSIZE "): "
|
dprintf("mark_page_range_in_use(%#" B_PRIxPHYSADDR ", %#" B_PRIxPHYSADDR
|
||||||
"start page is before free list\n", startPage, length);
|
"): start page is before free list\n", startPage, length);
|
||||||
if (sPhysicalPageOffset - startPage >= length)
|
if (sPhysicalPageOffset - startPage >= length)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
length -= sPhysicalPageOffset - startPage;
|
length -= sPhysicalPageOffset - startPage;
|
||||||
@@ -1312,8 +1319,8 @@ mark_page_range_in_use(page_num_t startPage, page_num_t length, bool wired)
|
|||||||
startPage -= sPhysicalPageOffset;
|
startPage -= sPhysicalPageOffset;
|
||||||
|
|
||||||
if (startPage + length > sNumPages) {
|
if (startPage + length > sNumPages) {
|
||||||
dprintf("mark_page_range_in_use(%#" B_PRIxADDR ", %#" B_PRIxSIZE "): "
|
dprintf("mark_page_range_in_use(%#" B_PRIxPHYSADDR ", %#" B_PRIxPHYSADDR
|
||||||
"range would extend past free list\n", startPage, length);
|
"): range would extend past free list\n", startPage, length);
|
||||||
if (startPage >= sNumPages)
|
if (startPage >= sNumPages)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
length = sNumPages - startPage;
|
length = sNumPages - startPage;
|
||||||
@@ -1349,8 +1356,8 @@ mark_page_range_in_use(page_num_t startPage, page_num_t length, bool wired)
|
|||||||
case PAGE_STATE_CACHED:
|
case PAGE_STATE_CACHED:
|
||||||
default:
|
default:
|
||||||
// uh
|
// uh
|
||||||
dprintf("mark_page_range_in_use: page 0x%lx in non-free state %d!\n",
|
dprintf("mark_page_range_in_use: page %#" B_PRIxPHYSADDR
|
||||||
startPage + i, page->State());
|
" in non-free state %d!\n", startPage + i, page->State());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1539,7 +1546,7 @@ public:
|
|||||||
uint32 PageCount() const { return fPageCount; }
|
uint32 PageCount() const { return fPageCount; }
|
||||||
|
|
||||||
virtual void IOFinished(status_t status, bool partialTransfer,
|
virtual void IOFinished(status_t status, bool partialTransfer,
|
||||||
size_t bytesTransferred);
|
generic_size_t bytesTransferred);
|
||||||
private:
|
private:
|
||||||
PageWriterRun* fRun;
|
PageWriterRun* fRun;
|
||||||
struct VMCache* fCache;
|
struct VMCache* fCache;
|
||||||
@@ -1703,8 +1710,8 @@ PageWriteTransfer::AddPage(vm_page* page)
|
|||||||
phys_addr_t nextBase = fVecs[fVecCount - 1].base
|
phys_addr_t nextBase = fVecs[fVecCount - 1].base
|
||||||
+ fVecs[fVecCount - 1].length;
|
+ fVecs[fVecCount - 1].length;
|
||||||
|
|
||||||
if (page->physical_page_number << PAGE_SHIFT == nextBase
|
if ((phys_addr_t)page->physical_page_number << PAGE_SHIFT == nextBase
|
||||||
&& page->cache_offset == fOffset + fPageCount) {
|
&& (off_t)page->cache_offset == fOffset + fPageCount) {
|
||||||
// append to last iovec
|
// append to last iovec
|
||||||
fVecs[fVecCount - 1].length += B_PAGE_SIZE;
|
fVecs[fVecCount - 1].length += B_PAGE_SIZE;
|
||||||
fPageCount++;
|
fPageCount++;
|
||||||
@@ -1712,8 +1719,8 @@ PageWriteTransfer::AddPage(vm_page* page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nextBase = fVecs[0].base - B_PAGE_SIZE;
|
nextBase = fVecs[0].base - B_PAGE_SIZE;
|
||||||
if (page->physical_page_number << PAGE_SHIFT == nextBase
|
if ((phys_addr_t)page->physical_page_number << PAGE_SHIFT == nextBase
|
||||||
&& page->cache_offset == fOffset - 1) {
|
&& (off_t)page->cache_offset == fOffset - 1) {
|
||||||
// prepend to first iovec and adjust offset
|
// prepend to first iovec and adjust offset
|
||||||
fVecs[0].base = nextBase;
|
fVecs[0].base = nextBase;
|
||||||
fVecs[0].length += B_PAGE_SIZE;
|
fVecs[0].length += B_PAGE_SIZE;
|
||||||
@@ -1722,12 +1729,12 @@ PageWriteTransfer::AddPage(vm_page* page)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((page->cache_offset == fOffset + fPageCount
|
if (((off_t)page->cache_offset == fOffset + fPageCount
|
||||||
|| page->cache_offset == fOffset - 1)
|
|| (off_t)page->cache_offset == fOffset - 1)
|
||||||
&& fVecCount < sizeof(fVecs) / sizeof(fVecs[0])) {
|
&& fVecCount < sizeof(fVecs) / sizeof(fVecs[0])) {
|
||||||
// not physically contiguous or not in the right order
|
// not physically contiguous or not in the right order
|
||||||
uint32 vectorIndex;
|
uint32 vectorIndex;
|
||||||
if (page->cache_offset < fOffset) {
|
if ((off_t)page->cache_offset < fOffset) {
|
||||||
// we are pre-pending another vector, move the other vecs
|
// we are pre-pending another vector, move the other vecs
|
||||||
for (uint32 i = fVecCount; i > 0; i--)
|
for (uint32 i = fVecCount; i > 0; i--)
|
||||||
fVecs[i] = fVecs[i - 1];
|
fVecs[i] = fVecs[i - 1];
|
||||||
@@ -1783,7 +1790,7 @@ PageWriteTransfer::SetStatus(status_t status, size_t transferred)
|
|||||||
|
|
||||||
void
|
void
|
||||||
PageWriteTransfer::IOFinished(status_t status, bool partialTransfer,
|
PageWriteTransfer::IOFinished(status_t status, bool partialTransfer,
|
||||||
size_t bytesTransferred)
|
generic_size_t bytesTransferred)
|
||||||
{
|
{
|
||||||
SetStatus(status, bytesTransferred);
|
SetStatus(status, bytesTransferred);
|
||||||
fRun->PageWritten(this, fStatus, partialTransfer, bytesTransferred);
|
fRun->PageWritten(this, fStatus, partialTransfer, bytesTransferred);
|
||||||
@@ -2892,7 +2899,7 @@ vm_page_init(kernel_args *args)
|
|||||||
// reserve, but should be a few more pages, so we don't have to extract
|
// reserve, but should be a few more pages, so we don't have to extract
|
||||||
// a cached page with each allocation.
|
// a cached page with each allocation.
|
||||||
sFreePagesTarget = VM_PAGE_RESERVE_USER
|
sFreePagesTarget = VM_PAGE_RESERVE_USER
|
||||||
+ std::max((uint32)32, sNumPages / 1024);
|
+ std::max((page_num_t)32, sNumPages / 1024);
|
||||||
|
|
||||||
// The target of free + cached and inactive pages. On low-memory machines
|
// The target of free + cached and inactive pages. On low-memory machines
|
||||||
// keep things tight. free + cached is the pool of immediately allocatable
|
// keep things tight. free + cached is the pool of immediately allocatable
|
||||||
@@ -3342,7 +3349,7 @@ vm_page_allocate_page_run(uint32 flags, phys_addr_t base, page_num_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dprintf("vm_page_allocate_page_run(): Failed to allocate run of "
|
dprintf("vm_page_allocate_page_run(): Failed to allocate run of "
|
||||||
"length %" B_PRIuSIZE " in second iteration!", length);
|
"length %" B_PRIuPHYSADDR " in second iteration!", length);
|
||||||
|
|
||||||
freeClearQueueLocker.Unlock();
|
freeClearQueueLocker.Unlock();
|
||||||
vm_page_unreserve_pages(&reservation);
|
vm_page_unreserve_pages(&reservation);
|
||||||
|
|||||||
Reference in New Issue
Block a user