diff options
author | David Johnson <davijoh3@cisco.com> | 2018-12-14 14:53:41 -0500 |
---|---|---|
committer | David Johnson <davijoh3@cisco.com> | 2019-01-02 10:55:55 -0500 |
commit | d9818dd68c162079f3ddb5443a78d0d91d55d0fe (patch) | |
tree | 71a597e8fb2c9c7ebd70870ae78091872591e216 /src/svm | |
parent | d6897c1597c4f0904d5956f7d794e3f001d52f72 (diff) |
Fixes for buliding for 32bit targets:
* u32/u64/uword mismatches
* pointer-to-int fixes
* printf formatting issues
* issues with incorrect "ULL" and related suffixes
* structure alignment and padding issues
Change-Id: I70b989007758755fe8211c074f651150680f60b4
Signed-off-by: David Johnson <davijoh3@cisco.com>
Diffstat (limited to 'src/svm')
-rw-r--r-- | src/svm/ssvm.c | 2 | ||||
-rw-r--r-- | src/svm/ssvm.h | 4 | ||||
-rw-r--r-- | src/svm/svm_common.h | 12 | ||||
-rw-r--r-- | src/svm/svm_fifo_segment.c | 10 | ||||
-rw-r--r-- | src/svm/svm_fifo_segment.h | 4 | ||||
-rw-r--r-- | src/svm/test_svm_fifo1.c | 2 |
6 files changed, 21 insertions, 13 deletions
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c index 73517aeb443..3e617097d26 100644 --- a/src/svm/ssvm.c +++ b/src/svm/ssvm.c @@ -177,7 +177,7 @@ map_it: return SSVM_API_ERROR_SLAVE_TIMEOUT; re_map_it: - ssvm->requested_va = (u64) sh->ssvm_va; + ssvm->requested_va = sh->ssvm_va; ssvm->ssvm_size = sh->ssvm_size; munmap (sh, MMAP_PAGESIZE); diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 5b2bf0d202d..59b582ecc42 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -64,9 +64,9 @@ typedef struct void *heap; /* Segment must be mapped at this address, or no supper */ - u64 ssvm_va; + uword ssvm_va; /* The actual mmap size */ - u64 ssvm_size; + uword ssvm_size; u32 master_pid; u32 slave_pid; u8 *name; diff --git a/src/svm/svm_common.h b/src/svm/svm_common.h index e523da50db6..ce07c37b24e 100644 --- a/src/svm/svm_common.h +++ b/src/svm/svm_common.h @@ -66,7 +66,7 @@ typedef struct svm_map_region_args_ { const char *root_path; /* NULL means use the truly global arena */ const char *name; - u64 baseva; + uword baseva; u64 size; u64 pvt_heap_size; uword flags; @@ -77,6 +77,16 @@ typedef struct svm_map_region_args_ int gid; } svm_map_region_args_t; +/* + * Memory mapped to high addresses for session/vppcom/vcl/etc... + */ +#if __WORDSIZE == 64 +#define HIGH_SEGMENT_BASEVA (8ULL << 30) /* 8GB */ +#elif __WORDSIZE == 32 +#define HIGH_SEGMENT_BASEVA (3584UL << 20) /* 3.5GB */ +#else +#error "unknown __WORDSIZE" +#endif /* * Memory shared across all router instances. Packet buffers, etc diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c index c72de406633..6897e0c2d51 100644 --- a/src/svm/svm_fifo_segment.c +++ b/src/svm/svm_fifo_segment.c @@ -575,8 +575,8 @@ svm_fifo_segment_num_free_fifos (svm_fifo_segment_private_t * fifo_segment, } void -svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, - u64 * size) +svm_fifo_segment_info (svm_fifo_segment_private_t * seg, char **address, + size_t * size) { if (ssvm_type (&seg->ssvm) == SSVM_SEGMENT_PRIVATE) { @@ -587,14 +587,12 @@ svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, heap_header = mheap_header (seg->ssvm.sh->heap); *size = heap_header->max_size; #else - mspace_get_address_and_size (seg->ssvm.sh->heap, - (unsigned long long *) address, - (unsigned long long *) size); + mspace_get_address_and_size (seg->ssvm.sh->heap, address, size); #endif } else { - *address = seg->ssvm.sh->ssvm_va; + *address = (char *) seg->ssvm.sh->ssvm_va; *size = seg->ssvm.ssvm_size; } } diff --git a/src/svm/svm_fifo_segment.h b/src/svm/svm_fifo_segment.h index a7695549d1c..caa95443b0a 100644 --- a/src/svm/svm_fifo_segment.h +++ b/src/svm/svm_fifo_segment.h @@ -116,8 +116,8 @@ u32 svm_fifo_segment_index (svm_fifo_segment_main_t * sm, u32 svm_fifo_segment_num_fifos (svm_fifo_segment_private_t * fifo_segment); u32 svm_fifo_segment_num_free_fifos (svm_fifo_segment_private_t * fifo_segment, u32 fifo_size_in_bytes); -void svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, - u64 * size); +void svm_fifo_segment_info (svm_fifo_segment_private_t * seg, char **address, + size_t * size); svm_fifo_segment_private_t * svm_fifo_segment_segments_pool (svm_fifo_segment_main_t * sm); diff --git a/src/svm/test_svm_fifo1.c b/src/svm/test_svm_fifo1.c index 0a09916f3bf..1e63f805f6b 100644 --- a/src/svm/test_svm_fifo1.c +++ b/src/svm/test_svm_fifo1.c @@ -281,7 +281,7 @@ test_ssvm_fifo1 (unformat_input_t * input) int verbose = 0; int test_id = 0; - svm_fifo_segment_main_init (sm, 0x200000000ULL, 20); + svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { |