=== modified file 'uspace/Makefile.common'
|
|
|
205 | 205 | ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y) |
206 | 206 | OPTIMIZATION = s |
207 | 207 | else |
208 | | OPTIMIZATION = 3 |
| 208 | OPTIMIZATION = 0 |
209 | 209 | endif |
210 | 210 | |
211 | 211 | # PCUT-based unit tests |
=== modified file 'uspace/app/fdisk/fdisk.c'
|
|
|
1031 | 1031 | |
1032 | 1032 | int main(int argc, char *argv[]) |
1033 | 1033 | { |
1034 | | service_id_t svcid; |
| 1034 | service_id_t svcid = 0; |
1035 | 1035 | fdisk_dev_t *dev; |
1036 | 1036 | int rc; |
1037 | 1037 | |
=== modified file 'uspace/lib/c/generic/io/log.c'
|
|
|
242 | 242 | if (message_buffer == NULL) |
243 | 243 | return; |
244 | 244 | |
245 | | vsnprintf(message_buffer, MESSAGE_BUFFER_SIZE, fmt, args); |
| 245 | int cnt; |
| 246 | |
| 247 | cnt = vsnprintf(message_buffer, MESSAGE_BUFFER_SIZE, fmt, args); |
| 248 | |
| 249 | assert(cnt <= MESSAGE_BUFFER_SIZE); |
246 | 250 | logger_message(logger_session, ctx, level, message_buffer); |
247 | 251 | free(message_buffer); |
248 | 252 | } |
=== modified file 'uspace/lib/c/generic/libc.c'
|
|
|
138 | 138 | |
139 | 139 | void abort(void) |
140 | 140 | { |
| 141 | *(int *)0x123 = 0x456; |
141 | 142 | __SYSCALL1(SYS_TASK_EXIT, true); |
142 | 143 | |
143 | 144 | /* Unreachable */ |
=== modified file 'uspace/lib/c/generic/malloc.c'
|
|
|
296 | 296 | head->area = area; |
297 | 297 | head->magic = HEAP_BLOCK_HEAD_MAGIC; |
298 | 298 | |
| 299 | if (free) |
| 300 | memset((void *) &head[1], 0xee, NET_SIZE(size)); |
| 301 | |
299 | 302 | heap_block_foot_t *foot = BLOCK_FOOT(head); |
300 | 303 | |
301 | 304 | foot->size = size; |
… |
… |
|
311 | 314 | * @param addr Address of the block. |
312 | 315 | * |
313 | 316 | */ |
| 317 | #include <io/kio.h> |
314 | 318 | static void block_check(void *addr) |
315 | 319 | { |
316 | 320 | heap_block_head_t *head = (heap_block_head_t *) addr; |
… |
… |
|
320 | 324 | heap_block_foot_t *foot = BLOCK_FOOT(head); |
321 | 325 | |
322 | 326 | malloc_assert(foot->magic == HEAP_BLOCK_FOOT_MAGIC); |
| 327 | if (head->size != foot->size) { |
| 328 | kio_printf("head=%p, foot=%p, foot-head=%u, head->size=%u, foot->size=%u\n", head, foot, (void *) foot - (void *) head, head->size, foot->size); |
| 329 | } |
323 | 330 | malloc_assert(head->size == foot->size); |
324 | 331 | } |
325 | 332 | |
… |
… |
|
353 | 360 | /* Align the heap area size on page boundary */ |
354 | 361 | size_t asize = ALIGN_UP(size, PAGE_SIZE); |
355 | 362 | void *astart = as_area_create(AS_AREA_ANY, asize, |
356 | | AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE); |
| 363 | AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE | AS_AREA_GUARD); |
357 | 364 | if (astart == AS_MAP_FAILED) |
358 | 365 | return false; |
359 | 366 | |
… |
… |
|
394 | 401 | */ |
395 | 402 | static bool area_grow(heap_area_t *area, size_t size) |
396 | 403 | { |
| 404 | return false; |
397 | 405 | if (size == 0) |
398 | 406 | return true; |
399 | 407 | |
… |
… |
|
792 | 800 | */ |
793 | 801 | size_t gross_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN)); |
794 | 802 | |
| 803 | #if 0 |
795 | 804 | /* Try the next fit approach */ |
796 | 805 | heap_block_head_t *split = next_fit; |
797 | 806 | |
… |
… |
|
815 | 824 | if (addr != NULL) |
816 | 825 | return addr; |
817 | 826 | } |
| 827 | #endif |
818 | 828 | |
819 | 829 | /* Finally, try to grow heap space and allocate in the new area. */ |
820 | 830 | return heap_grow_and_alloc(gross_size, falign); |
… |
… |
|
851 | 861 | { |
852 | 862 | heap_lock(); |
853 | 863 | void *block = malloc_internal(size, BASE_ALIGN); |
| 864 | memset(block, 0xde, size); |
854 | 865 | heap_unlock(); |
855 | 866 | |
856 | 867 | return block; |
… |
… |
|
874 | 885 | |
875 | 886 | heap_lock(); |
876 | 887 | void *block = malloc_internal(size, palign); |
| 888 | memset(block, 0xde, size); |
877 | 889 | heap_unlock(); |
878 | 890 | |
879 | 891 | return block; |
… |
… |
|
891 | 903 | { |
892 | 904 | if (addr == NULL) |
893 | 905 | return malloc(size); |
894 | | |
895 | 906 | heap_lock(); |
896 | 907 | |
897 | 908 | /* Calculate the position of the header. */ |
… |
… |
|
908 | 919 | malloc_assert((void *) head < area->end); |
909 | 920 | |
910 | 921 | void *ptr = NULL; |
911 | | bool reloc = false; |
912 | | size_t real_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN)); |
| 922 | // bool reloc = false; |
| 923 | // size_t real_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN)); |
913 | 924 | size_t orig_size = head->size; |
| 925 | #if 0 |
914 | 926 | |
915 | 927 | if (orig_size > real_size) { |
916 | 928 | /* Shrink */ |
… |
… |
|
949 | 961 | reloc = true; |
950 | 962 | } |
951 | 963 | |
| 964 | #endif |
952 | 965 | heap_unlock(); |
953 | | |
954 | | if (reloc) { |
| 966 | // if (reloc) { |
955 | 967 | ptr = malloc(size); |
956 | 968 | if (ptr != NULL) { |
957 | 969 | memcpy(ptr, addr, NET_SIZE(orig_size)); |
958 | 970 | free(addr); |
959 | 971 | } |
960 | | } |
| 972 | // } |
961 | 973 | |
962 | 974 | return ptr; |
963 | 975 | } |
=== modified file 'uspace/srv/devman/devtree.c'
|
|
|
43 | 43 | |
44 | 44 | static inline size_t handle_key_hash(void *key) |
45 | 45 | { |
46 | | devman_handle_t handle = *(devman_handle_t*)key; |
| 46 | devman_handle_t handle = *((devman_handle_t *) key); |
47 | 47 | return handle; |
48 | 48 | } |
49 | 49 | |
… |
… |
|
61 | 61 | |
62 | 62 | static bool devman_devices_key_equal(void *key, const ht_link_t *item) |
63 | 63 | { |
64 | | devman_handle_t handle = *(devman_handle_t*)key; |
| 64 | devman_handle_t handle = *((devman_handle_t *) key); |
65 | 65 | dev_node_t *dev = hash_table_get_inst(item, dev_node_t, devman_dev); |
66 | 66 | return dev->handle == handle; |
67 | 67 | } |
68 | 68 | |
69 | 69 | static bool devman_functions_key_equal(void *key, const ht_link_t *item) |
70 | 70 | { |
71 | | devman_handle_t handle = *(devman_handle_t*)key; |
| 71 | devman_handle_t handle = *((devman_handle_t *) key); |
72 | 72 | fun_node_t *fun = hash_table_get_inst(item, fun_node_t, devman_fun); |
73 | 73 | return fun->handle == handle; |
74 | 74 | } |
75 | 75 | |
76 | 76 | static inline size_t service_id_key_hash(void *key) |
77 | 77 | { |
78 | | service_id_t service_id = *(service_id_t*)key; |
| 78 | service_id_t service_id = *((service_id_t *) key); |
79 | 79 | return service_id; |
80 | 80 | } |
81 | 81 | |
… |
… |
|
87 | 87 | |
88 | 88 | static bool loc_functions_key_equal(void *key, const ht_link_t *item) |
89 | 89 | { |
90 | | service_id_t service_id = *(service_id_t*)key; |
| 90 | service_id_t service_id = *((service_id_t *) key); |
91 | 91 | fun_node_t *fun = hash_table_get_inst(item, fun_node_t, loc_fun); |
92 | 92 | return fun->service_id == service_id; |
93 | 93 | } |