Return errors for Dcache funcs, correctly.

This commit is contained in:
Unknown W. Brackets 2013-01-05 15:30:31 -08:00
parent 3861ce0376
commit 17c1d3ce68
3 changed files with 18 additions and 4 deletions

View file

@ -32,7 +32,6 @@
#define CTRL_MODE_ANALOG 1
const int PSP_CTRL_ERROR_INVALID_MODE = 0x80000107;
const int PSP_CTRL_ERROR_INVALID_NUM_BUFFERS = 0x80000104;
const int PSP_CTRL_ERROR_INVALID_IDLE_PTR = 0x80000023;
const int NUM_CTRL_BUFFERS = 64;
@ -187,7 +186,7 @@ int __CtrlReadSingleBuffer(u32 ctrlDataPtr, bool negative)
int __CtrlReadBuffer(u32 ctrlDataPtr, u32 nBufs, bool negative, bool peek)
{
if (nBufs > NUM_CTRL_BUFFERS)
return PSP_CTRL_ERROR_INVALID_NUM_BUFFERS;
return SCE_KERNEL_ERROR_INVALID_SIZE;
int resetRead = ctrlBufRead;

View file

@ -249,8 +249,16 @@ void sceKernelGetGPI()
// textures, and in the future display lists, in some cases though.
int sceKernelDcacheInvalidateRange(u32 addr, int size)
{
if (size > 0 && addr != 0) {
gpu->InvalidateCache(addr, size);
if (size < 0 || (int) addr + size < 0)
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
if (size > 0)
{
if ((addr % 64) != 0 || (size % 64) != 0)
return SCE_KERNEL_ERROR_CACHE_ALIGNMENT;
if (addr != 0)
gpu->InvalidateCache(addr, size);
}
return 0;
}
@ -263,6 +271,9 @@ int sceKernelDcacheWritebackAll()
}
int sceKernelDcacheWritebackRange(u32 addr, int size)
{
if (size < 0)
return SCE_KERNEL_ERROR_INVALID_SIZE;
if (size > 0 && addr != 0) {
gpu->InvalidateCache(addr, size);
}
@ -270,6 +281,9 @@ int sceKernelDcacheWritebackRange(u32 addr, int size)
}
int sceKernelDcacheWritebackInvalidateRange(u32 addr, int size)
{
if (size < 0)
return SCE_KERNEL_ERROR_INVALID_SIZE;
if (size > 0 && addr != 0) {
gpu->InvalidateCache(addr, size);
}

View file

@ -26,6 +26,7 @@ enum
SCE_KERNEL_ERROR_OK = 0,
SCE_KERNEL_ERROR_OUT_OF_MEMORY = 0x80000022,
SCE_KERNEL_ERROR_INVALID_ID = 0x80000100,
SCE_KERNEL_ERROR_INVALID_SIZE = 0x80000104,
SCE_KERNEL_ERROR_INVALID_VALUE = 0x800001fe,
SCE_KERNEL_ERROR_INVALID_ARGUMENT = 0x800001ff,
SCE_KERNEL_ERROR_ERROR = 0x80020001,