Added a test for MUIA_Listview_SelectChange.
[AROS.git] / arch / arm-efika / boot / support.c
blobca744d0787dd142f572bb5c4515e57b143008f9a
1 /*
2 Copyright © 2010-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "boot.h"
8 #include <sys/types.h>
10 static unsigned char __tmpspace[BOOT_TMP_SIZE];
11 static unsigned char *first_free = &__tmpspace[0];
12 static unsigned long free_memory = BOOT_TMP_SIZE;
14 void arm_flush_cache(uint32_t addr, uint32_t length)
16 while (length)
18 __asm__ __volatile__("mcr p15, 0, %0, c7, c14, 1"::"r"(addr));
19 addr += 32;
20 length -= 32;
22 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
25 void arm_icache_invalidate(uint32_t addr, uint32_t length)
27 while (length)
29 __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 1"::"r"(addr));
30 addr += 32;
31 length -= 32;
33 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
36 void arm_dcache_invalidate(uint32_t addr, uint32_t length)
38 while (length)
40 __asm__ __volatile__("mcr p15, 0, %0, c7, c6, 1"::"r"(addr));
41 addr += 32;
42 length -= 32;
44 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
47 void *malloc(size_t size)
49 void *ret = NULL;
51 size = (size + 15) & ~15;
53 if (size <= free_memory)
55 ret = first_free;
57 first_free += size;
58 free_memory -= size;
61 return ret;
64 size_t mem_avail()
66 return free_memory;
69 size_t mem_used()
71 return BOOT_TMP_SIZE - free_memory;
74 int32_t strlen(const char *c)
76 int32_t result = 0;
77 while (*c++)
78 result++;
80 return result;
83 const char *remove_path(const char *in)
85 const char *p = &in[strlen(in)-1];
86 while (p > in && p[-1] != '/' && p[-1] != ':') p--;
87 return p;