github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/test/leatest.c (about)

     1  #include "stdio.h"
     2  
     3  
     4  int main(int an, char** av)
     5  {
     6      int i;
     7      long long int array[10]= {
     8          1,2,3,4,5,6,7,8,9,10
     9      };
    10      long long int* ptr1;
    11      long long int* ptr2;
    12      long long int* ptr3;
    13  
    14      asm volatile (
    15      "\tmovq     %[array], %%rsi\n"
    16      "\tmovq     $1, %%rdx\n"
    17      "\tleaq     (%%rsi, %%rdx, 8), %%rdi\n"
    18      "\tmovq     %%rdi,%[ptr1]\n"
    19      "\tmovq     $3, %%rdx\n"
    20      "\tleaq     (%%rsi, %%rdx, 8), %%rdi\n"
    21      "\tmovq     %%rdi,%[ptr2]\n"
    22      "\tmovq     $6, %%rdx\n"
    23      "\tleaq     (%%rsi, %%rdx, 8), %%rdi\n"
    24      "\tmovq     %%rdi,%[ptr3]\n"
    25      : [ptr1] "=m" (ptr1), [ptr2] "=m" (ptr2), [ptr3] "=m" (ptr3)
    26      : [array] "g" (array)
    27      : "%rdi", "%rsi", "%rdx");
    28  
    29      printf("ptr1: 0x%08x, ptr2: 0x%08x, ptr3: 0x%08x\n",
    30              (unsigned int)*ptr1, (unsigned int)*ptr2, (unsigned int)*ptr3);
    31  
    32      return 0;
    33  }
    34