Main Page | Directories | File List | Globals

math64.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/chips/cpu.h>
#include <agnix/console.h>

Include dependency graph for math64.c:

Go to the source code of this file.

Functions

void add_64_reg (u32 *value, u32 *op1, u32 *op2)
void add_64_xmm2 (u32 *value, u32 *op1, u32 *op2)
void add_64_64 (u32 *value, u32 *op1, u32 *op2)
void add_64_32 (u32 *value, u32 *op1, u32 op2)
void sub_64_reg (u32 *value, u32 *op1, u32 *op2)
void sub_64_xmm2 (u32 *value, u32 *op1, u32 *op2)
void sub_64_64 (u32 *value, u32 *op1, u32 *op2)
void sub_64_32 (u32 *value, u32 *op1, u32 op2)
void div_64_32 (u32 *value, u32 *op1, u32 op2)
void mul_32_32 (u32 *value, u32 op1, u32 op2)


Function Documentation

void add_64_32 u32 value,
u32 op1,
u32  op2
 

Definition at line 50 of file math64.c.

References __asm__().

Referenced by counter_64_bit_inc(), and timeval_to_jiffies().

00051 {
00052     __asm__ (
00053     "  addl %%eax, %%ebx\t\n"
00054     "  adcl $0, %%ecx\t\n"
00055     "  movl %%ebx, (%0)\t\n"
00056     "  movl %%ecx, 4(%0)\t\n"
00057     :
00058     :"r"(value), "a"(op2), "b"(*op1), "c"(*(op1 + 1))
00059     );
00060 }

Here is the call graph for this function:

void add_64_64 u32 value,
u32 op1,
u32 op2
 

Definition at line 42 of file math64.c.

References add_64_reg(), add_64_xmm2(), and cpu_capable().

Referenced by counter_64_bit_add().

00043 {
00044     if (cpu_capable(X86_FEATURE_XMM2))
00045         add_64_xmm2(value, op1, op2);
00046     else
00047         add_64_reg(value, op1, op2); 
00048 }

Here is the call graph for this function:

void add_64_reg u32 value,
u32 op1,
u32 op2
 

Definition at line 18 of file math64.c.

References __asm__().

Referenced by add_64_64().

00019 {
00020     __asm__ (
00021     "  addl (%1), %%ebx\t\n"
00022     "  adcl 4(%1), %%ecx\t\n"
00023     "  movl %%ebx, (%0)\t\n"
00024     "  movl %%ecx, 4(%0)\t\n"
00025     :
00026     :"r"(value), "r"(op2), "b"(*op1), "c"(*(op1 + 4))
00027     );
00028 }

Here is the call graph for this function:

void add_64_xmm2 u32 value,
u32 op1,
u32 op2
 

Definition at line 30 of file math64.c.

References __asm__().

Referenced by add_64_64().

00031 {
00032     __asm__ __volatile__ (
00033     "  movq (%1), %%mm0\t\n"
00034     "  movq (%2), %%mm1\t\n"
00035     "  paddq %%mm0, %%mm1\t\n"
00036     "  movq %%mm0, (%0)"
00037     :
00038     :"r"(value), "r"(op1), "r"(op2)
00039     );
00040 }

Here is the call graph for this function:

void div_64_32 u32 value,
u32 op1,
u32  op2
 

Definition at line 109 of file math64.c.

References __asm__().

00110 {
00111     __asm__ __volatile__ (
00112     
00113     "  divl %%ecx"
00114     
00115     :"=a"(*value)
00116     :"a"(op1[0]), "d"(op1[1]), "c"(op2)
00117     );
00118 }

Here is the call graph for this function:

void mul_32_32 u32 value,
u32  op1,
u32  op2
 

Definition at line 121 of file math64.c.

References __asm__().

Referenced by timeval_to_jiffies().

00122 {
00123     __asm__ __volatile__ (
00124     "  mull %%ecx"
00125     :"=a"(value[0]), "=d"(value[1])
00126     :"a"(op1), "c"(op2)
00127     );
00128 }

Here is the call graph for this function:

void sub_64_32 u32 value,
u32 op1,
u32  op2
 

Definition at line 96 of file math64.c.

References __asm__().

Referenced by counter_64_bit_dec().

00097 {
00098     __asm__ (
00099     "  subl %%eax, %%ebx\t\n"
00100     "  sbbl $0, %%ecx\t\n"
00101     "  movl %%ebx, (%0)\t\n"
00102     "  movl %%ecx, 4(%0)\t\n"
00103     :
00104     :"r"(value), "a"(op2), "b"(*op1), "c"(*(op1 + 1))
00105     );
00106 }

Here is the call graph for this function:

void sub_64_64 u32 value,
u32 op1,
u32 op2
 

Definition at line 88 of file math64.c.

References cpu_capable(), sub_64_reg(), and sub_64_xmm2().

Referenced by counter_64_bit_sub(), cpu_get_cache_latency(), and tsc_get_speed().

00089 {
00090     if (cpu_capable(X86_FEATURE_XMM2))
00091         sub_64_xmm2(value, op1, op2);
00092     else
00093         sub_64_reg(value, op1, op2); 
00094 }

Here is the call graph for this function:

void sub_64_reg u32 value,
u32 op1,
u32 op2
 

Definition at line 62 of file math64.c.

References __asm__().

Referenced by sub_64_64().

00063 {
00064     __asm__ (
00065     "  subl (%1), %%ebx\t\n"
00066     "  sbbl 4(%1), %%ecx\t\n"
00067     "  movl %%ebx, (%0)\t\n"
00068     "  movl %%ecx, 4(%0)\t\n"
00069     :
00070     :"r"(value), "r"(op2), "b"(*op1), "c"(*(op1 + 1))
00071     );
00072 }

Here is the call graph for this function:

void sub_64_xmm2 u32 value,
u32 op1,
u32 op2
 

Definition at line 74 of file math64.c.

References __asm__().

Referenced by sub_64_64().

00075 {
00076     __asm__ __volatile__ (
00077     
00078     "  movq (%1), %%mm0\t\n"
00079     "  movq (%2), %%mm1\t\n"
00080     "  psubq %%mm0, %%mm1\t\n"
00081     "  movq %%mm0, (%0)"
00082     
00083     :"=r"(value)
00084     :"r"(op1), "r"(op2)
00085     );
00086 }

Here is the call graph for this function:

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix