Skip to content
MarekBykowski edited this page Feb 11, 2021 · 63 revisions

Welcome to the readme wiki!

Floating-point in Linux Kernel

http://porterchen-note.blogspot.com/2011/03/linux-kernel-and-floating-point.html

/* 
 * Goal here is to save needless saving/storing the NEON context at each task switch
 * as NEON is used rarely. To server it we need to know: 
 * - for each task what CPU it used last time. If NULL then it was a kernel
 * - for each CPU (per-cpu) what task it served lastly 
 * 
 * If the two are in sync/the same then we save/store the context. If not we leave it as-is.
 */
kernel_neon_begin();                       
xor_block_neon_inner.do_2(bytes, p1, p2);  
kernel_neon_end();                         

Set/clear bit

#define NTH_BIT 4                                                              
                                                                               
unsigned int addr = 0xffffffff;                                        
enum flags { clear, set };                                             
                                                                               
addr &= ~(1<<NTH_BIT);                                                 
printf("mb: clearing %dth bit %x of %x\n", NTH_BIT, addr, 0xffffffff); 
                                                                               
addr |= (1<<NTH_BIT);                                                  
printf("mb: setting %dth bit %x\n", NTH_BIT, addr);                    

Clone this wiki locally