add page cache with read-ahead and dirty writeback, file-backed and anonymous mmap with CoW, VAD-based virtual memory replacing the old user region model, PFN database with eviction and reclaim, file identity for cross-open section sharing, FAT32 path cache and per-file cluster chain cache, serial.sys for COM1 keyboard input, xHCI MSI with INTx and polled fallback, PciEnableMsiAuto, waitable input queue, KeWaitForAnyEvent, per-process thread info syscall, expanded kernel stats (PFN/PTE/VAD/file-cache/disk), pool allocation tags, async I/O user buffer locking, file flush on close, add docs.md.
This commit is contained in:
1 parent
61ec2442eb
commit
2c4a68a75f
114 files changed
+18069
-2620
No files matched your search
@@ -210,6 +210,29 @@ void* _calloc(size_t count, size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
// Returns the usable payload size of an allocation made by this heap.
|
||||
size_t _malloc_usable_size(const void* ptr) {
|
||||
if (!ptr) return (size_t)-1;
|
||||
|
||||
HeapLock();
|
||||
HEAP_SEGMENT* seg = SegmentForPointer((void*)ptr);
|
||||
if (!seg) {
|
||||
HeapUnlock();
|
||||
return (size_t)-1;
|
||||
}
|
||||
|
||||
HEAP_BLOCK* block = PayloadBlock((void*)ptr);
|
||||
if (block->Magic != USER_HEAP_MAGIC || block->Free) {
|
||||
HeapUnlock();
|
||||
return (size_t)-1;
|
||||
}
|
||||
|
||||
size_t size = block->Size;
|
||||
HeapUnlock();
|
||||
return size;
|
||||
}
|
||||
|
||||
// Implements the realloc operation.
|
||||
void* _realloc(void* ptr, size_t newSize) {
|
||||
if (!ptr) return _malloc(newSize);
|
||||
|
||||
Reference in new issue
Block a user