[haiku-gsoc] Re: Implementation Queries

  • From: Vivek Roy <vivekroyandroid@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Wed, 28 Jun 2017 04:42:29 +0530

Okay, so I was trying to allocate physically non-contiguous memory. I was
looking at Kernel Kit's create_area() to be used in place of kzalloc.

A few things I noted (please let me know if I am wrong):
1. A call to kzalloc expects the memory to be zero-ed out. create_area
doesn't have any such flag so it has to be done by making a call to memset
(We can use memset on the memory returned from create_area right?)
2. I am using the B_ANY_KERNEL_ADDRESS constant for addr_spec parameter of
create_area
3. The size alllocated has to be a multiple of B_PAGE_SIZE. So for
allocating sizeof(kobj) bytes, I will have to allocate [(sizeof(kobj)
+ B_PAGE_SIZE
- 1) / B_PAGE_SIZE] bytes of memory.
4. For locking constant I think B_LAZY_LOCK should be okay
5. Protection is B_READ_AREA | B_WRITE_AREA

Thanks

Other related posts: