Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use vpush/vpop in kernel code?

I was trying to add some asm code in ko module, simply:

asm volatile("vpush {d8}")

Error occurs while compiling:

Error: selected processor does not support ARM mode `vpush {d8}'

Is this expected? Thanks.

like image 220
Bill Randerson Avatar asked Aug 30 '26 10:08

Bill Randerson


1 Answers

Floating points are not used in kernel development in general. Not every hardware supports FP, some platforms may have advanced power features and can turn on and off FP unit at times. Handling all these is quite cumbersome and you can always find another way to solve your issue.

Robert Love's "Linux Kernel Development"

No (Easy) Use of Floating Point

... Using a floating point inside the kernel requires manually saving and restoring the floating point registers, among other possible chores. The short answer is: Don’t do it! Except in the rare cases, no floating-point operations are in the kernel.

And more... https://stackoverflow.com/a/13886805/1163019

It is that your compiler invocation doesn't specify any mfpu directives in compliance to above, so you get that error message.

like image 142
auselen Avatar answered Sep 02 '26 03:09

auselen