Date: Thu, 26 Dec 2002 17:54:20 +0300 From: Tony Zelenoff <fbsd@antonz-hpvl400.mcd.ru> To: freebsd-hackers@freebsd.org Subject: How to lock kernel malloc'ed memory ? Message-ID: <47163800993.20021226175420@antonz-hpvl400.mcd.ru>
next in thread | raw e-mail | index | archive | help
Hello freebsd-hackers, So, I have FreeBSD 4.5 and write a driver for special software, that needs a lot of kernel memory. First of all i set VM_KMEM_SIZE (i386/include/vmparam.h) to a biggest value (~200 Mb) and recompile the kernel ( also i disabled PSE ). Then in driver i malloc memory ( lot of memory.. ~50-60 Mb ), but not in one piece. Mmap some of malloc'ed memory to user space (mmap works successfully ) and get pages indexes to the pages arrays. I do it like this - page_arr[i] = kvtop(vaddr+i*PAGE_SIZE)>>12. After it i create my own address space (without kernel help) with my own GDT, IDT, LDT, TSS, PDE, PTE and so on ( i need phys pages addresses from filled page arrays for this ). After i try to enter into my own address space i have an interesting thing - some of the pages is not present (i think). When i try to read smth from them in kernel space with disabled ints i have "kernel trap 9 with disabled ints". And in my address space when i try to read smth i have a double fault. (PageFault and second PageFault, because IDT page not present too). I try to print addresses of physical pages and see, that kernel allocates already allocate phys pages (i.e. this pages swapped out from physical address space), but i read that kernel malloc return non pageable and not swappable memory. So, question is how to lock physical pages in memory or how to allocate non-swappable memory ? -- Best regards, Tony mailto:fbsd@antonz-hpvl400.mcd.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47163800993.20021226175420>