Skip to content

Commit

Permalink
sparcv8leon3: fix strncpy implementation
Browse files Browse the repository at this point in the history
JIRA: RTOS-693
  • Loading branch information
lukileczo authored and agkaminski committed Nov 29, 2023
1 parent 0ff64df commit a8ac6ed
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions arch/sparcv8leon3/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,23 @@ char *strncpy(char *dest, const char *src, size_t n)
__asm__ volatile
(" \
cmp %2, %%g0; \
be 2f; \
be 3f; \
1: \
ldub [%1], %%g1; \
inc %1; \
stb %%g1, [%0]; \
deccc %2; \
bz 3f; \
inc %0; \
cmp %%g1, %%g0; \
bne 1b; \
nop; \
2: \
stb %%g0, [%0]; \
deccc %2; \
bnz 1b; \
inc %1; \
2: "
bnz 2b; \
inc %0; \
3: "
: "+r"(p), "+r"(src), "+r"(n)
:
: "%g1", "memory", "cc");
Expand Down

0 comments on commit a8ac6ed

Please sign in to comment.