I am trying to dump the memory of process and distinguish the different part, such as code page, guard page, stack, and heap. I can dump the process memory by call a adding system call, and in this system call I use memmove to dump the process memory to my buffer. Then print the buffer in my user level function. But I can not figure out the different part of this memory. Now my embryonic idea is to find some special pointers that point the boundary of these parts. But I am confused what pointers can do this? Or I should try to compute the size of these part, and print (Next part is Code/Guard Page)? I can make sure that there will be a 4k page table for guard page table, but I do not know how to get size of other parts, like code page or stack.
I also want to let my user level function can dump other process's memory by giving the pid as parameter But I am confused how to start. How can I find other process's page table and entry them in my kernel level dump function?