OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /amber/trunk/sw
    from Rev 33 to Rev 32
    Reverse comparison

Rev 33 → Rev 32

/mini-libc/libc_asm.S
112,20 → 112,6
_div:
stmdb sp!, {r4, lr}
 
@ set r4 to 1 if one of the two inputs is negative
and r2, r0, #0x80000000
and r3, r1, #0x80000000
eor r4, r2, r3
 
@ Invert negative numbers
tst r0, #0x80000000
mvnne r0, r0
addne r0, r0, #1
 
tst r1, #0x80000000
mvnne r1, r1
addne r1, r1, #1
 
@ divide r1 by r2, also use registers r0 and r4
mov r2, r1
mov r1, r0
188,11 → 174,6
bcc 2b @ If carry not clear, r3 has shifted
@ back to where it started, and we
@ can end
@ if one of the inputs is negetive then return a negative result
tst r4, #0x80000000
mvnne r0, r0
addne r0, r0, #1
3: ldmia sp!, {r4, pc}^
 
 
205,12 → 186,12
.globl strcpy
strcpy:
stmdb sp!, {r4-r7, lr}
@ Use r6 to process the destination pointer.
@ At the end of the function, r0 is returned, so need to preserve it
mov r6, r0
@ get relative alignment of strings
and r2, r6, #3
and r3, r1, #3
@ only if both strings are zero-aligned use the fast 'aligned' algorithm
orr r2, r6, r1
ands r2, r2, #3
orrs r2, r3
bne strcpy_slow
 
strcpy_fast:
468,7 → 449,13
mov pc, lr
 
 
.globl times
times:
@ TODO
mov r0, #0
mov pc, lr
 
 
/* strncpy: String copy function */
@ r0 points to destination
@ r1 points to source string
478,11 → 465,13
stmdb sp!, {r4, lr}
cmp r2, #0
beq 2f
add r4, r0, r2 @ set r4 to the address of the last byte copied
mov r4, #0
1: ldrb r3, [r1], #1
strb r3, [r0], #1
add r4, r4, #1
cmp r2, r4
bne 1b
beq 2f
b 1b
2: ldmia sp!, {r4, pc}^
 
/mini-libc/printf.c
203,7 → 203,7
 
 
/* Printf an integer */
int printi(char** dst, int i, int b, int sg, int width, int pad, int letbase)
int printi(char** dst, unsigned long i, int b, int sg, int width, int pad, int letbase)
{
char print_buf[PRINT_BUF_LEN];
char *s;
/mini-libc/stdio.h
48,7 → 48,7
int sprintf (char* dst, const char *format, ...);
int print (char** dst, const char *format, unsigned long *varg);
int prints (char** dst, const char *string, int width, int pad);
int printi (char** dst, int i, int b, int sg, int width, int pad, int letbase);
int printi (char** dst, unsigned long i, int b, int sg, int width, int pad, int letbase);
 
 
/* ===== Memory Function Prototypes =================== */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.