Supposed we have the following application,which consists of more than one
#define ADDRESS 0x9000000
ptr=(int)mmap(0,4096,PROT_READ | PROT_WRITE,MAP_SHARED,ADDRESS);
/ … some stuff here…*/
/…some more stuff here…/
extern int *ptr;
/*…function reads and writes to memory,defined by pointer ptr…/
Will the function be able to read and write to memory we wish,just by using
the ptr pointer,returned to the main by the shm_open and mmap calls??
If the function wants to read and write to the specific memory region,will
it have to call again these functions?
I am writing a device driver for a PCI network card.The function() is
supposed to do the required work,after an interrupt occurs.(the ISR
triggers the appropriate proxy,the main function checks the proxy’s pid and
then calls the respective function to do the work-in our case function().)My
purpose is to minimize the number of things to be done in the function(),so
that it’s job is very quickly done,before another interrupt occurs;that’s
why I’m trying to avoid reopening physical memory and remmaping it.Can this
be avoided?Any suggestions?
Thank you very much in advance!!