[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Placing data section to fix address



Hi,

Our board has 64K NVRAM on CSR0, the our driver has mmap functionality,
and the user program can mmap the nvram content to user space.
The mmap() is working, but I need to access nvram via general variables,
(which placed to special section .protected), not via mmap returned pointer.

My question is:
How can I place to entire .protected section to any FIX address?
The fix address is needed, because the nvram contains buffers and
it's pointers too.

#define	PROTADDR	0x<any fix address>

struct	bboxprop	Bbox	__atribute__ ((section(".protected")));
...
static	int	handle;

void	nvramset(void)
{
	void	*p;

	handle = open("/dev/nvram", O_RDWR);
	p = mmap((void*)PROTADDR, 0x10000, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, handle, 0);
}

Any suggestions?

Thx:
Tibor Bodolai
BBOX