00001 00015 #ifndef __QOS_L_I386_H__ 00016 #define __QOS_L_I386_H__ 00017 00018 #ifndef __i386__ 00019 # error "This module only works for i386 architectures" 00020 #endif 00021 00022 #include <linux/types.h> 00023 00041 #define l_shl_div(num, SHF, den) ({ \ 00042 __volatile__ __s32 _ul_num = (num); \ 00043 __volatile__ __s32 _ul_den = (den); \ 00044 __volatile__ __s32 _ul_res; \ 00045 __asm__ __volatile__("\n" \ 00046 " cdq \n" \ 00047 " shldl %2, %%eax, %%edx \n" \ 00048 " shll %2, %%eax \n" \ 00049 " idivl %3 \n" \ 00050 : "=a" (_ul_res) \ 00051 : "0" (_ul_num), "I" ((SHF)), "r" (_ul_den) \ 00052 : "%edx"); \ 00053 _ul_res; \ 00054 }) 00055 00056 00072 #define l_mul_div(x, num, den) ({ \ 00073 __volatile__ __s32 _ul_x = (x); \ 00074 __volatile__ __s32 _ul_num = (num); \ 00075 __volatile__ __s32 _ul_den = (den); \ 00076 __volatile__ __s32 _ul_res; \ 00077 __asm__ __volatile__("\n" \ 00078 " imull %%edx \n" \ 00079 " idivl %3 \n" \ 00080 : "=a" (_ul_res) \ 00081 : "0" (_ul_x), "d" (_ul_num), "r" (_ul_den)); \ 00082 _ul_res; \ 00083 }) 00084 00085 00105 #define l_mul_shr(x, y, SHF) ({ \ 00106 __volatile__ __s32 _ul_x = (x); \ 00107 __volatile__ __s32 _ul_y = (y); \ 00108 __volatile__ __s32 _ul_res; \ 00109 __asm__ __volatile__ ("\n" \ 00110 " imull %%edx \n" \ 00111 " shrdl %2, %%edx, %%eax \n" \ 00112 : "=a" (_ul_res) \ 00113 : "0" (_ul_x), "I" ((SHF)), "d" (_ul_y)); \ 00114 _ul_res; \ 00115 }) 00116 00117 #endif