svm: calc base address on AArch64 based on autodetected VA space size
[vpp.git] / src / svm / svm.c
index f187fbf..2cbc0d7 100644 (file)
@@ -79,16 +79,15 @@ svm_get_global_region_base_va ()
       unformat (&input, "%llx-%llx", &start, &end);
       unformat_skip_line (&input);
     }
+  unformat_free (&input);
+  close (fd);
 
   count_leading_zeros (bits, end);
-  bits = 64 - bits;
+  bits = 64 - (bits + 1);
   if (bits >= 36 && bits <= 48)
     return ((1ul << bits) / 4) - (2 * SVM_GLOBAL_REGION_SIZE);
   else
     clib_unix_error ("unexpected va bits '%u'", bits);
-
-  unformat_free (&input);
-  close (fd);
 #endif
 
   /* default value */