extern "C" int main(int argc, char *argv[]) {
	checkpointNext("Normal (FIFO):");
	{
		SceUID fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, 0, 0x100, 1, NULL);
		void *data;
		sceKernelAllocateFpl(fpl, &data, NULL);
		FplWaitThread wait1("waiting thread 1", fpl, NO_TIMEOUT, 300, 0x30);
		FplWaitThread wait2("waiting thread 2", fpl, NO_TIMEOUT, 300, 0x34);
		FplWaitThread wait3("waiting thread 3", fpl, NO_TIMEOUT, 300, 0x31);
		sceKernelFreeFpl(fpl, data);
		schedfFpl(fpl);
		sceKernelDelayThread(200000);
		sceKernelDeleteFpl(fpl);
	}

	checkpointNext("Priority:");
	{
		SceUID fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, PSP_FPL_ATTR_PRIORITY, 0x100, 1, NULL);
		void *data;
		sceKernelAllocateFpl(fpl, &data, NULL);
		FplWaitThread wait1("waiting thread 1", fpl, NO_TIMEOUT, 300, 0x30);
		FplWaitThread wait2("waiting thread 2", fpl, NO_TIMEOUT, 300, 0x34);
		FplWaitThread wait3("waiting thread 3", fpl, NO_TIMEOUT, 300, 0x31);
		sceKernelFreeFpl(fpl, data);
		schedfFpl(fpl);
		sceKernelDelayThread(200000);
		sceKernelDeleteFpl(fpl);
	}
	return 0;
}
extern "C" int main(int argc, char *argv[]) {
	SceUID fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, 0, 0x10, 8, NULL);
	void *temp;
	sceKernelAllocateFpl(fpl, &temp, NULL);

	checkpointNext("Objects:");
	testFree("  Normal", fpl, &temp);
	testFree("  NULL", 0, &temp);
	testFree("  Invalid", 0xDEADBEEF, &temp);
	sceKernelDeleteFpl(fpl);
	testFree("  Deleted", fpl, &temp);
	
	fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, 0, 0x10, 8, NULL);
	sceKernelAllocateFpl(fpl, &temp, NULL);
	checkpointNext("Pointers:");
	testFree("  Normal", fpl, temp);
	testFree("  NULL", fpl, NULL);
	testFree("  Invalid", fpl, (void *)0xDEADBEEF);
	testFree("  Already free", fpl, temp);
	sceKernelDeleteFpl(fpl);

	return 0;
}
Exemple #3
0
void *fpl_wait_alloc(const char *threadname, int fpl)
{
    int result;
    void *addr = (void*)-1;

    printf("[%s] sceKernelAllocateFpl wait alloc...\n", threadname);
    result = sceKernelAllocateFpl(fpl, &addr, 0x0);
    printf("[%s] sceKernelAllocateFpl result=%08x addr=%p\n", threadname, result, addr);
    printMem();

    if (result != 0)
        addr = 0;

    return addr;
}
Exemple #4
0
void *fpl_alloc(int fpl)
{
    int result;
    unsigned int timeout = 1000000;
    void *addr = (void*)-1;

    result = sceKernelAllocateFpl(fpl, &addr, &timeout);
    printf("sceKernelAllocateFpl result=%08x addr=%p timeout=%d\n", result, addr, timeout);
    printMem();

    if (result != 0)
        addr = 0;

    return addr;
}
Exemple #5
0
int main(int argc, char **argv) {
	int n;
	int fplid;
	int *fpl;
	int ko;
	
	fplid = sceKernelCreateFpl("BSS_NO_OVERLAP", 2, 0, sizeof(bss), 1, NULL);
	sceKernelAllocateFpl(fplid, (void**)&fpl, NULL);
	
	for (n = 0; n < lengthof(bss); n++) bss[n] = BSS_VALUE;
	for (n = 0; n < lengthof(bss); n++) fpl[n] = FPL_VALUE;

	ko = 0;
	for (n = 0; n < lengthof(bss); n++) {
		if (bss[n] != BSS_VALUE) ko++;
		if (fpl[n] != FPL_VALUE) ko++;
	}
	printf("KO: %d\n", ko);

	return 0;
}
Exemple #6
0
int sceKernelStartModulePatched(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option)
{
	SceModule2 *mod = sceKernelFindModuleByUID660(modid);
	if(mod)
	{
		if(!plugins_started)
		{
			if(strcmp(mod->modname, "sceMediaSync") == 0)
			{
				plugins_started = 1;

				SceUID fd = -1;

				char path[64];

				int type = sceKernelInitKeyConfig();
				if(type == PSP_INIT_KEYCONFIG_GAME)
				{
					sprintf(path, "%s/GAME.TXT", rebootex_config.savedata_path);
					fd = sceIoOpen(path, PSP_O_RDONLY, 0);
				}
				else if(type == PSP_INIT_KEYCONFIG_POPS)
				{
					sprintf(path, "%s/POPCORN.PRX", rebootex_config.savedata_path);
					LoadStartModule(path);

					sprintf(path, "%s/POPS.TXT", rebootex_config.savedata_path);
					fd = sceIoOpen(path, PSP_O_RDONLY, 0);
				}

				if(fd >= 0)
				{
					SceUID fpl = sceKernelCreateFpl("", PSP_MEMORY_PARTITION_KERNEL, 0, 1024, 1, NULL);
					if(fpl >= 0)
					{
						char *buffer;
						sceKernelAllocateFpl(fpl, (void *)&buffer, NULL);
						int size = sceIoRead(fd, buffer, 1024);
						char *p = buffer;

						int res = 0;
						char plugin[64];

						do
						{
							int activated = 0;
							memset(plugin, 0, sizeof(plugin));

							res = GetPlugin(p, size, plugin, &activated);

							if(res > 0)
							{
								if(activated) LoadStartModule(plugin);
								size -= res;
								p += res;
							}
						} while(res > 0);

						sceIoClose(fd);

						if(buffer)
						{
							sceKernelFreeFpl(fpl, buffer);
							sceKernelDeleteFpl(fpl);
						}
					}
				}
			}
		}
	}

	return sceKernelStartModule660(modid, argsize, argp, status, option);
}