1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-28 05:06:08 +00:00

Actually don't use memcpy in sdmmc

This commit is contained in:
TuxSH 2018-05-19 03:10:06 +02:00
parent 2a98e2e3b8
commit 64cdd2e63f
2 changed files with 10 additions and 4 deletions

View file

@ -1278,7 +1278,7 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
// Handle unaligned buffers
uint32_t w;
uint8_t *data = (uint8_t *)buffer;
memcpy(&w, data, 4);
w = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
mmc->regs->buffer = w;
} else {
mmc->regs->buffer = *buffer;
@ -1288,7 +1288,10 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
// Handle unaligned buffers
uint32_t w = mmc->regs->buffer;
uint8_t *data = (uint8_t *)buffer;
memcpy(&w, data, 4);
data[0] = w & 0xFF;
data[1] = (w >> 8) & 0xFF;
data[2] = (w >> 16) & 0xFF;
data[3] = (w >> 24) & 0xFF;
} else {
*buffer = mmc->regs->buffer;
}

View file

@ -1278,7 +1278,7 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
// Handle unaligned buffers
uint32_t w;
uint8_t *data = (uint8_t *)buffer;
memcpy(&w, data, 4);
w = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
mmc->regs->buffer = w;
} else {
mmc->regs->buffer = *buffer;
@ -1288,7 +1288,10 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
// Handle unaligned buffers
uint32_t w = mmc->regs->buffer;
uint8_t *data = (uint8_t *)buffer;
memcpy(&w, data, 4);
data[0] = w & 0xFF;
data[1] = (w >> 8) & 0xFF;
data[2] = (w >> 16) & 0xFF;
data[3] = (w >> 24) & 0xFF;
} else {
*buffer = mmc->regs->buffer;
}