PowerPC linux Kernel

Status
Not open for further replies.

priestnot

New Member
Hi there...

I am trying to make a device driver (Kernel module) for a Virtex4 PowerPC, and i have a small problem...

The powerpc is byte addressable (little endian) but i my kernel functions as to return a int (32bit's) i already have a functional module but is not optimized

Code:
ssize_t fpga_write(struct file *filp, int *buf, size_t count, loff_t *f_pos) 
{
	void *add;
	int *kbuf;
    	kbuf = kmalloc(count, GFP_KERNEL);
	int ret = copy_from_user(kbuf, buf, count);
	int i;
	for(i = *f_pos/4; i < count/4 + *f_pos/4; i++)
	{
		
		add = io_base + (i*4);
		__raw_writel(kbuf[i - *f_pos], add);
	}
	kfree(kbuf);
  	return 1;

}

What i wold like to do is get a int without making the * and / (they take lot of CPU time). I think there is a way with some masks with FFFFFFFC using a AND. Is this possible i do not understand how it works...


does anyone have any ideas??
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…