blob: 678735d954dd7049f58e8d4e6fdb87f124ae40ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#![no_std]
mod alloc_sys;
use self::alloc_sys::*;
use core::alloc::{GlobalAlloc, Layout};
const KMRS_TAG: u32 = 0x4B4D5253; // 'KMRS'
pub struct KernelAlloc;
unsafe impl GlobalAlloc for KernelAlloc {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
ExAllocatePoolWithTag(POOL_TYPE::PagedPool, layout.size(), KMRS_TAG)
}
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
ExFreePoolWithTag(ptr, KMRS_TAG);
}
}
|