mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 07:38:05 -04:00
get rid of custom memcpy funcs
not used for anything important, just a maintenance burden
This commit is contained in:
parent
ba11a48115
commit
fdcfd32374
9 changed files with 7 additions and 198 deletions
45
pico/misc.c
45
pico/misc.c
|
@ -87,35 +87,6 @@ const unsigned char hcounts_32[] = {
|
|||
|
||||
|
||||
#ifndef _ASM_MISC_C
|
||||
typedef struct
|
||||
{
|
||||
int b0;
|
||||
int b1;
|
||||
int b2;
|
||||
int b3;
|
||||
int b4;
|
||||
int b5;
|
||||
int b6;
|
||||
int b7;
|
||||
} intblock;
|
||||
|
||||
PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count)
|
||||
{
|
||||
if ((((long)dest | (long)src) & 3) == 0)
|
||||
{
|
||||
if (count >= 32) {
|
||||
memcpy32((int *)dest, (int *)src, count/2);
|
||||
count&=1;
|
||||
} else {
|
||||
for (; count >= 2; count -= 2, dest+=2, src+=2)
|
||||
*(int *)dest = *(int *)src;
|
||||
}
|
||||
}
|
||||
while (count--)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
|
||||
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count)
|
||||
{
|
||||
unsigned char *src_ = src;
|
||||
|
@ -125,22 +96,6 @@ PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count)
|
|||
}
|
||||
|
||||
#ifndef _ASM_MISC_C_AMIPS
|
||||
PICO_INTERNAL_ASM void memcpy32(void *dest_in, const void *src_in, int count)
|
||||
{
|
||||
const intblock *bs = (intblock *) src_in;
|
||||
intblock *bd = (intblock *) dest_in;
|
||||
const int *src;
|
||||
int *dest;
|
||||
|
||||
for (; count >= sizeof(*bd)/4; count -= sizeof(*bd)/4)
|
||||
*bd++ = *bs++;
|
||||
|
||||
dest = (int *)bd; src = (const int *)bs;
|
||||
while (count--)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
|
||||
PICO_INTERNAL_ASM void memset32(void *dest_in, int c, int count)
|
||||
{
|
||||
int *dest = dest_in;
|
||||
|
|
|
@ -101,78 +101,4 @@ ms32u_return:
|
|||
nop
|
||||
|
||||
|
||||
.globl memcpy32 # int *dest, int *src, int count
|
||||
|
||||
memcpy32:
|
||||
mc32_aloop:
|
||||
andi $t0, $a0, 0x3f
|
||||
beqz $t0, mc32_bloop_prep
|
||||
nop
|
||||
lw $t1, 0($a1)
|
||||
addiu $a2, -1
|
||||
sw $t1, 0($a0)
|
||||
beqz $a2, mc32_return
|
||||
addiu $a0, 4
|
||||
j mc32_aloop
|
||||
addiu $a1, 4
|
||||
|
||||
mc32_bloop_prep:
|
||||
srl $t0, $a2, 4 # we will do 64 bytes per iteration (cache line)
|
||||
beqz $t0, mc32_bloop_end
|
||||
|
||||
mc32_bloop:
|
||||
addiu $t0, -1
|
||||
cache 0x18, ($a0) # create dirty exclusive
|
||||
lw $t2, 0x00($a1)
|
||||
lw $t3, 0x04($a1)
|
||||
lw $t4, 0x08($a1)
|
||||
lw $t5, 0x0c($a1)
|
||||
lw $t6, 0x10($a1)
|
||||
lw $t7, 0x14($a1)
|
||||
lw $t8, 0x18($a1)
|
||||
lw $t9, 0x1c($a1)
|
||||
sw $t2, 0x00($a0)
|
||||
sw $t3, 0x04($a0)
|
||||
sw $t4, 0x08($a0)
|
||||
sw $t5, 0x0c($a0)
|
||||
sw $t6, 0x10($a0)
|
||||
sw $t7, 0x14($a0)
|
||||
sw $t8, 0x18($a0)
|
||||
sw $t9, 0x1c($a0)
|
||||
lw $t2, 0x20($a1)
|
||||
lw $t3, 0x24($a1)
|
||||
lw $t4, 0x28($a1)
|
||||
lw $t5, 0x2c($a1)
|
||||
lw $t6, 0x30($a1)
|
||||
lw $t7, 0x34($a1)
|
||||
lw $t8, 0x38($a1)
|
||||
lw $t9, 0x3c($a1)
|
||||
sw $t2, 0x20($a0)
|
||||
sw $t3, 0x24($a0)
|
||||
sw $t4, 0x28($a0)
|
||||
sw $t5, 0x2c($a0)
|
||||
sw $t6, 0x30($a0)
|
||||
sw $t7, 0x34($a0)
|
||||
sw $t8, 0x38($a0)
|
||||
sw $t9, 0x3c($a0)
|
||||
addiu $a0, 0x40
|
||||
bnez $t0, mc32_bloop
|
||||
addiu $a1, 0x40
|
||||
|
||||
mc32_bloop_end:
|
||||
andi $a2, $a2, 0x0f
|
||||
beqz $a2, mc32_return
|
||||
|
||||
mc32_cloop:
|
||||
lw $t1, 0($a1)
|
||||
addiu $a2, -1
|
||||
addiu $a1, 4
|
||||
sw $t1, 0($a0)
|
||||
bnez $a2, mc32_cloop
|
||||
addiu $a0, 4
|
||||
|
||||
mc32_return:
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
# vim:filetype=mips
|
||||
|
|
|
@ -6,44 +6,6 @@
|
|||
* See COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
.global memcpy16 @ unsigned short *dest, unsigned short *src, int count
|
||||
|
||||
memcpy16:
|
||||
eor r3, r0, r1
|
||||
tst r3, #2
|
||||
bne mcp16_cant_align
|
||||
|
||||
tst r0, #2
|
||||
ldrneh r3, [r1], #2
|
||||
subne r2, r2, #1
|
||||
strneh r3, [r0], #2
|
||||
|
||||
subs r2, r2, #4
|
||||
bmi mcp16_fin
|
||||
|
||||
mcp16_loop:
|
||||
ldmia r1!, {r3,r12}
|
||||
subs r2, r2, #4
|
||||
stmia r0!, {r3,r12}
|
||||
bpl mcp16_loop
|
||||
|
||||
mcp16_fin:
|
||||
tst r2, #2
|
||||
ldrne r3, [r1], #4
|
||||
strne r3, [r0], #4
|
||||
ands r2, r2, #1
|
||||
bxeq lr
|
||||
|
||||
mcp16_cant_align:
|
||||
ldrh r3, [r1], #2
|
||||
subs r2, r2, #1
|
||||
strh r3, [r0], #2
|
||||
bne mcp16_cant_align
|
||||
|
||||
bx lr
|
||||
|
||||
|
||||
|
||||
@ 0x12345678 -> 0x34127856
|
||||
@ r4=temp, lr=0x00ff00ff
|
||||
.macro bswap reg
|
||||
|
@ -52,7 +14,6 @@ mcp16_cant_align:
|
|||
orr \reg, \reg, r4, lsl #8
|
||||
.endm
|
||||
|
||||
|
||||
@ dest must be halfword aligned, src can be unaligned
|
||||
.global memcpy16bswap @ unsigned short *dest, void *src, int count
|
||||
|
||||
|
@ -121,37 +82,6 @@ mcp16bs_cant_align2:
|
|||
bx lr
|
||||
|
||||
|
||||
|
||||
.global memcpy32 @ int *dest, int *src, int count
|
||||
|
||||
memcpy32:
|
||||
stmfd sp!, {r4,lr}
|
||||
|
||||
subs r2, r2, #4
|
||||
bmi mcp32_fin
|
||||
|
||||
mcp32_loop:
|
||||
ldmia r1!, {r3,r4,r12,lr}
|
||||
subs r2, r2, #4
|
||||
stmia r0!, {r3,r4,r12,lr}
|
||||
bpl mcp32_loop
|
||||
|
||||
mcp32_fin:
|
||||
tst r2, #3
|
||||
ldmeqfd sp!, {r4,pc}
|
||||
tst r2, #1
|
||||
ldrne r3, [r1], #4
|
||||
strne r3, [r0], #4
|
||||
|
||||
mcp32_no_unal1:
|
||||
tst r2, #2
|
||||
ldmneia r1!, {r3,r12}
|
||||
ldmfd sp!, {r4,lr}
|
||||
stmneia r0!, {r3,r12}
|
||||
bx lr
|
||||
|
||||
|
||||
|
||||
.global memset32 @ int *dest, int c, int count
|
||||
|
||||
memset32:
|
||||
|
|
|
@ -287,7 +287,7 @@ static void FinalizeLine8bitM4(int line)
|
|||
if (!(PicoOpt & POPT_DIS_32C_BORDER))
|
||||
pd += 32;
|
||||
|
||||
memcpy32((int *)pd, (int *)(Pico.est.HighCol+8), 256/4);
|
||||
memcpy(pd, Pico.est.HighCol + 8, 256);
|
||||
}
|
||||
|
||||
void PicoDrawSetOutputMode4(pdso_t which)
|
||||
|
|
|
@ -825,9 +825,7 @@ unsigned char PicoVideoRead8HV_L(void);
|
|||
extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask);
|
||||
|
||||
// misc.c
|
||||
PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count);
|
||||
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count);
|
||||
PICO_INTERNAL_ASM void memcpy32(void *dest, const void *src, int count); // 32bit word count
|
||||
PICO_INTERNAL_ASM void memset32(void *dest, int c, int count);
|
||||
|
||||
// eeprom.c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue