git-svn: trunk@2818
Trog authored on 2007/02/20 22:54:21... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Feb 20 11:53:47 GMT 2007 (trog) |
|
2 |
+----------------------------------- |
|
3 |
+ * libclamav/unrar: allow for sparc aligned access requirements (bb#304) |
|
4 |
+ |
|
1 | 5 |
Mon Feb 19 18:28:52 CET 2007 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* libclamav/sis.c: improve debug messages |
... | ... |
@@ -113,6 +113,10 @@ static int sub_allocator_start_sub_allocator(sub_allocator_t *sub_alloc, int sa_ |
113 | 113 |
} |
114 | 114 |
sub_allocator_stop_sub_allocator(sub_alloc); |
115 | 115 |
alloc_size = t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE; |
116 |
+#if defined(__sparc) || defined(sparc) || defined(__sparcv9) |
|
117 |
+ /* Allow for aligned access requirements */ |
|
118 |
+ alloc_size += UNIT_SIZE; |
|
119 |
+#endif |
|
116 | 120 |
if ((sub_alloc->heap_start = (uint8_t *) cli_malloc(alloc_size)) == NULL) { |
117 | 121 |
cli_dbgmsg("sub_alloc start failed\n"); |
118 | 122 |
return FALSE; |
... | ... |
@@ -134,6 +138,12 @@ static void sub_allocator_init_sub_allocator(sub_allocator_t *sub_alloc) |
134 | 134 |
real_size2 = size2/FIXED_UNIT_SIZE*UNIT_SIZE; |
135 | 135 |
size1 = sub_alloc->sub_allocator_size - size2; |
136 | 136 |
real_size1 = size1/FIXED_UNIT_SIZE*UNIT_SIZE+size1%FIXED_UNIT_SIZE; |
137 |
+#if defined(__sparc) || defined(sparc) || defined(__sparcv9) |
|
138 |
+ /* Allow for aligned access requirements */ |
|
139 |
+ if (size1%FIXED_UNIT_SIZE != 0) { |
|
140 |
+ real_size1 += UNIT_SIZE - size1%FIXED_UNIT_SIZE; |
|
141 |
+ } |
|
142 |
+#endif |
|
137 | 143 |
sub_alloc->hi_unit = sub_alloc->heap_start + sub_alloc->sub_allocator_size; |
138 | 144 |
sub_alloc->lo_unit = sub_alloc->units_start = sub_alloc->heap_start + real_size1; |
139 | 145 |
sub_alloc->fake_units_start = sub_alloc->heap_start + size1; |