Write an ARM assembly language program (string_cmp.s) to implement the following C function.
If you use any registers other than r0-r3, you need to save them in the stack. (for example, using
instructions push {r4-r7} -- to save registers r4, r5, r6, and r7; using pop {r4-r7} -- the instruction
to restore them and restore them when it returns from the function.)
C source code of stringcmp.c
int8_t stringcmp (const uint8_t *s1, const uint8_t *s2)
{
while ((*s1 != '\0') && (*s2 != '\0'))
{
if (*s1 != *s2)
{
break;
}
else
{
s1++;
s2++;
}
}
return (int8_t) ((int16_t)*s1 - (int16_t)*s2);
}