I want to do 32 bytes transaction to/from PCIe device inside the Linux driver. Compiling Intel AVX instrinsics for Linux Device Driver with GCC
Code:
base_4 = ioremap(bar_data->bar_paddr[4], bar_data->bar_len[4]);
test_ptr = kmalloc(128, GFP_KERNEL);
if (!test_ptr) {
printk("test_ptr : kmalloc failed \n");
return -ENOMEM;
}
memset (test_ptr, 1, 128);
kernel_fpu_begin();
_mm256_storeu_si256((__m256i*)base_4, *(((__m256i*)test_ptr) + 0));
_mm_mfence();
kernel_fpu_end();
Building the file gives error:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/mm_malloc.h:27:20: fatal error: stdlib.h: No such file or directory
#include <stdlib.h>
^
compilation terminated.
Makefile:
obj-m += memsule.o
ccflags-y := -mavx -mmmx -msse -mpreferred-stack-boundary=4
KDIR = /lib/modules/$(shell uname -r)/build
all:
make -C $(KDIR) M=$(shell pwd) modules
clean:
make -C $(KDIR) M=$(shell pwd) clean
Is there any other method How to use the assembly instruction vmovdqa m256, ymm
?
I tried this way
asm volatile("vmovdqa base_4,test_ptr");
but got error:
Error: too many memory references for `vmovdqa'
How to use the assembly code in C properly?