Write the following code in ARM 64 bit assembly. Be sure to follow C calling conventions.
Part 1
long strlen(char *s) {
long len = 0;
while (*s) {
++len;
++s;
}
return len;
}
Part 2
char toupper(char ch) {
if (ch >= 'a' && ch <= 'z')
return ch - 'a' + 'A';
return ch;
}
char *toupper_s(char *s) {
char *ret = s;
while (*s) {
*s = toupper(*s);
++s;
}
return ret;
}
Submission link
Dos and Dont's
- DO follow ARM calling conventions
- DO NOT just compile the code with a C compiler and turn that in. That is cheating :(
- DO check your work. Download an ARM gcc/gas tool chain and make sure your code works.