M68K: drop the custom C arch_cpu_user_mem*() for the default impl

I didn't notice there was a C++ version that didn't require writing asm.

I'll have to write them anyway for speed someday.
This commit is contained in:
François Revol
2016-07-20 21:57:19 +02:00
parent 169349c98f
commit 02283e080c
2 changed files with 2 additions and 89 deletions
@@ -13,6 +13,8 @@
#ifdef __x86_64__
# include <arch/generic/user_memory.h>
#elif defined(__M68K__)
# include <arch/generic/user_memory.h>
#else
extern "C" {
-89
View File
@@ -171,95 +171,6 @@ arch_cpu_user_TLB_invalidate(void)
}
// TODO: all functions that use fault handlers need to be implemented
// in assembly due to problems passing in label addresses in gcc4.
status_t
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
addr_t *faultHandler)
{
char *tmp = (char *)to;
char *s = (char *)from;
addr_t oldFaultHandler = *faultHandler;
// TODO: This doesn't work correctly with gcc 4 anymore!
if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
goto error;
while (size--)
*tmp++ = *s++;
*faultHandler = oldFaultHandler;
return 0;
error:
*faultHandler = oldFaultHandler;
return B_BAD_ADDRESS;
}
/** \brief Copies at most (\a size - 1) characters from the string in \a from to
* the string in \a to, NULL-terminating the result.
*
* \param to Pointer to the destination C-string.
* \param from Pointer to the source C-string.
* \param size Size in bytes of the string buffer pointed to by \a to.
*
* \return strlen(\a from).
*/
ssize_t
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHandler)
{
int from_length = 0;
addr_t oldFaultHandler = *faultHandler;
// TODO: This doesn't work correctly with gcc 4 anymore!
if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
goto error;
if (size > 0) {
to[--size] = '\0';
// copy
for ( ; size; size--, from_length++, to++, from++) {
if ((*to = *from) == '\0')
break;
}
}
// count any leftover from chars
while (*from++ != '\0')
from_length++;
*faultHandler = oldFaultHandler;
return from_length;
error:
*faultHandler = oldFaultHandler;
return B_BAD_ADDRESS;
}
status_t
arch_cpu_user_memset(void *s, char c, size_t count, addr_t *faultHandler)
{
char *xs = (char *)s;
addr_t oldFaultHandler = *faultHandler;
// TODO: This doesn't work correctly with gcc 4 anymore!
if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
goto error;
while (count--)
*xs++ = c;
*faultHandler = oldFaultHandler;
return 0;
error:
*faultHandler = oldFaultHandler;
return B_BAD_ADDRESS;
}
status_t
arch_cpu_shutdown(bool reboot)
{