Issue in printing the virtual address, physical address, size of the text, data, stack segments in Minix3.1.0

83 views
Skip to first unread message

anush2...@gmail.com

unread,
Sep 18, 2016, 11:28:07 AM9/18/16
to minix3

In order to print the details of the memory map of a process allocated by pm(process manager). I followed the following link:http://www.cis.syr.edu/~wedu/seed/Documentation/Minix3/How_to_add_system_call.pdf

But when i pass the pid of any process the same set of values get printed as shown below:

Screenshot from 2016-09-18 20-55-14.png (313K)
Remove Screenshot from 2016-09-18 20-55-14.png
Screenshot from 2016-09-18 20-56-05.png (290K)
Remove Screenshot from 2016-09-18 20-56-05.png
Screenshot from 2016-09-18 20-56-59.png (215K)
Remove Screenshot from 2016-09-18 20-56-59.png
Screenshot from 2016-09-18 20-57-23.png (203K)
Remove Screenshot from 2016-09-18 20-57-23.png
Screenshot from 2016-09-18 20-57-48.png (190K)
Remove Screenshot from 2016-09-18 20-57-48.png
Screenshot from 2016-09-18 20-58-04.png (306K)
Remove Screenshot from 2016-09-18 20-58-04.png
Screenshot from 2016-09-18 20-58-28.png (285K)
Remove Screenshot from 2016-09-18 20-58-28.png



Screenshot from 2016-09-18 20-55-14.png
Screenshot from 2016-09-18 20-56-05.png
Screenshot from 2016-09-18 20-56-59.png
Screenshot from 2016-09-18 20-57-23.png
Screenshot from 2016-09-18 20-57-48.png
Screenshot from 2016-09-18 20-58-04.png
Screenshot from 2016-09-18 20-58-28.png

Antoine LECA

unread,
Sep 19, 2016, 9:13:10 AM9/19/16
to min...@googlegroups.com
On 18/09/2016 15:28Z, anush2...@gmail.com wrote:
> In order to print the details of the memory map of a process allocated by
> pm(process manager). I followed the following link:
> http://www.cis.syr.edu/~wedu/seed/Documentation/Minix3/How_to_add_system_call.pdf

... but you did not explain how printing a map is related to system
calls, or which system call you actually tried to implement.

> But when i pass the pid of any process the same set of values get printed

What your code does is sorting the free-hole list, then printing it, on
each call to alloc_mem(); since probably the request is for more memory,
the list keep being unchanged, and the results are consistent.

Please also refer to FAQ "Can you help me [...]"

Antoine

Anush Narayanan

unread,
Sep 25, 2016, 4:11:14 AM9/25/16
to min...@googlegroups.com
reply for the comment:  but you did not explain how printing a map is related to system

calls, or which system call you actually tried to implement.


in the new system call i'm trying to write, i want to print the stack, text, data segment's virtual address and physical address  for a given process id this is what i want to achieve in the system call that i would like to write.


--
You received this message because you are subscribed to a topic in the Google Groups "minix3" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/minix3/AuuhX8Bf2qE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to minix3+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antoine LECA

unread,
Sep 26, 2016, 4:14:21 AM9/26/16
to min...@googlegroups.com
On 25/09/2016 08:11, Anush Narayanan wrote:
> in the new system call i'm trying to write, i want to print the stack,
> text, data segment's virtual address and physical address for a given
> process id this is what i want to achieve in the system call that i would
> like to write.

Thanks. Furthermore, according to the reference you added, I understand
you want to create a new "POSIX API call" in PM.
<Sidenote>
There are two levels of system calls in MINIX: "POSIX" calls are what
user programs calls, and are served by MINIX services like PM or (V)FS;
on the other hand, "kernel system calls" or the "kernel API" is used by
services calling the kernel for micro-kernel activities, like for
example allocating new processes, using sys_fork()/SYS_FORK.
</Sidenote>

You should follow the instructions in the PDF you linked to, including
adding a new handler, new entries in table.c of both servers, creating
the library wrapper for the messages. I assume this have been done and
that the handler in PM is named do_printmap(), that the process to be
printed is given in m_in.pid and the relevant process entry has been
localized in mproc[] and asserted to exist, permitted to print etc.

As you can read in mproc.h, once you get your hand at the mproc[] entry
of the process, you have the memory map in the first member mp->mp_seg[]

Printing the actual stack is a bit more difficult: first you need to
learn the value of the current stack pointer: there is a utility
subroutine for that, get_stack_ptr(); then you need to use kernel's
sys_umap() to transfer some bytes from the address space of the process
to a private buffer in PM, then printing that buffer.

And the code you showed last week bore no similarity with that.


Antoine
Reply all
Reply to author
Forward
0 new messages