Skip to content

Commit 6d07ec3

Browse files
committed
Initial version
1 parent 2dd6400 commit 6d07ec3

37 files changed

+3586
-0
lines changed

.gitignore

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Object files
5+
*.o
6+
*.ko
7+
*.obj
8+
*.elf
9+
10+
# Linker output
11+
*.ilk
12+
*.map
13+
*.exp
14+
15+
# Precompiled Headers
16+
*.gch
17+
*.pch
18+
19+
# Libraries
20+
*.lib
21+
*.la
22+
*.lo
23+
24+
# Shared objects (inc. Windows DLLs)
25+
*.dll
26+
*.so
27+
*.so.*
28+
*.dylib
29+
30+
# Executables
31+
*.exe
32+
*.out
33+
*.app
34+
*.i*86
35+
*.x86_64
36+
*.hex
37+
38+
# Debug files
39+
*.dSYM/
40+
*.su
41+
*.idb
42+
*.pdb
43+
44+
# Kernel Module Compile Results
45+
*.mod*
46+
*.cmd
47+
.tmp_versions/
48+
modules.order
49+
Module.symvers
50+
Mkfile.old
51+
dkms.conf
52+
53+
# VDS
54+
*.vs
55+
eboot.bin
56+
eboot2.bin
57+
param.sfo
58+
param2.sfo
59+
PSVita_Debug
60+
PSVita_Release
61+
RES_RCO_TMP

PSVshellPlus.sln

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.1525
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSVshellPlus_Shell", "PSVshellPlus_Shell\PSVshellPlus_Shell.vcxproj", "{F84FFBB6-2013-43F2-985E-C94E0ADF711D}"
7+
ProjectSection(ProjectDependencies) = postProject
8+
{F54C8C2B-86B4-4DC3-A858-F19136590E83} = {F54C8C2B-86B4-4DC3-A858-F19136590E83}
9+
EndProjectSection
10+
EndProject
11+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSVshellPlus_Kernel", "PSVshellPlus_Kernel\PSVshellPlus_Kernel.vcxproj", "{F54C8C2B-86B4-4DC3-A858-F19136590E83}"
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|PSVita = Debug|PSVita
16+
Release|PSVita = Release|PSVita
17+
EndGlobalSection
18+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19+
{F84FFBB6-2013-43F2-985E-C94E0ADF711D}.Debug|PSVita.ActiveCfg = Debug|PSVita
20+
{F84FFBB6-2013-43F2-985E-C94E0ADF711D}.Debug|PSVita.Build.0 = Debug|PSVita
21+
{F84FFBB6-2013-43F2-985E-C94E0ADF711D}.Release|PSVita.ActiveCfg = Release|PSVita
22+
{F84FFBB6-2013-43F2-985E-C94E0ADF711D}.Release|PSVita.Build.0 = Release|PSVita
23+
{F54C8C2B-86B4-4DC3-A858-F19136590E83}.Debug|PSVita.ActiveCfg = Debug|PSVita
24+
{F54C8C2B-86B4-4DC3-A858-F19136590E83}.Debug|PSVita.Build.0 = Debug|PSVita
25+
{F54C8C2B-86B4-4DC3-A858-F19136590E83}.Release|PSVita.ActiveCfg = Release|PSVita
26+
{F54C8C2B-86B4-4DC3-A858-F19136590E83}.Release|PSVita.Build.0 = Release|PSVita
27+
EndGlobalSection
28+
GlobalSection(SolutionProperties) = preSolution
29+
HideSolutionNode = FALSE
30+
EndGlobalSection
31+
GlobalSection(ExtensibilityGlobals) = postSolution
32+
SolutionGuid = {9EC2EDAB-F25A-47F5-9B8C-B7326D89CADF}
33+
EndGlobalSection
34+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|PSVita">
5+
<Configuration>Debug</Configuration>
6+
<Platform>PSVita</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|PSVita">
9+
<Configuration>Release</Configuration>
10+
<Platform>PSVita</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="clock.c" />
15+
<ClCompile Include="info.c" />
16+
<ClCompile Include="main.c" />
17+
</ItemGroup>
18+
<ItemGroup>
19+
<CustomBuild Include="lib.emd">
20+
<FileType>Document</FileType>
21+
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/armlibgen.exe" %(Filename).emd --entry-src "$(IntDir)%(Filename).s"
22+
"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/psp2snc.exe" "$(IntDir)%(Filename).s" -c -o "$(IntDir)%(Filename).o"</Command>
23+
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">$(IntDir)%(Filename).s;%(Outputs)</Outputs>
24+
<Command Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/armlibgen.exe" %(Filename).emd --entry-src "$(IntDir)%(Filename).s"
25+
"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/psp2snc.exe" "$(IntDir)%(Filename).s" -c -o "$(IntDir)%(Filename).o"</Command>
26+
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">$(IntDir)%(Filename).s;%(Outputs)</Outputs>
27+
</CustomBuild>
28+
</ItemGroup>
29+
<ItemGroup>
30+
<ClInclude Include="clock.h" />
31+
<ClInclude Include="common.h" />
32+
<ClInclude Include="info.h" />
33+
</ItemGroup>
34+
<PropertyGroup Label="Globals">
35+
<ProjectGuid>{F54C8C2B-86B4-4DC3-A858-F19136590E83}</ProjectGuid>
36+
</PropertyGroup>
37+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
38+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'" Label="Configuration">
39+
<ConfigurationType>DynamicLibrary</ConfigurationType>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'" Label="Configuration">
42+
<ConfigurationType>DynamicLibrary</ConfigurationType>
43+
</PropertyGroup>
44+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
45+
<PropertyGroup Condition="'$(DebuggerFlavor)'=='PSVitaDebugger'" Label="OverrideDebuggerDefaults">
46+
<!--LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand-->
47+
<!--LocalDebuggerReboot>false</LocalDebuggerReboot-->
48+
<!--LocalDebuggerCommandArguments></LocalDebuggerCommandArguments-->
49+
<!--LocalDebuggerTarget></LocalDebuggerTarget-->
50+
<!--LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory-->
51+
<!--LocalMappingFile></LocalMappingFile-->
52+
<!--LocalRunCommandLine></LocalRunCommandLine-->
53+
</PropertyGroup>
54+
<ImportGroup Label="ExtensionSettings">
55+
</ImportGroup>
56+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">
57+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
58+
</ImportGroup>
59+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<PropertyGroup Label="UserMacros" />
63+
<PropertyGroup />
64+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">
65+
<ClCompile>
66+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);</PreprocessorDefinitions>
67+
<GenerateDebugInformation>true</GenerateDebugInformation>
68+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
69+
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\kernel;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
70+
</ClCompile>
71+
<Link>
72+
<AdditionalOptions>--prx-no-runtime-support "$(ProjectDir)$(IntDir)lib.o"</AdditionalOptions>
73+
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
74+
<AdditionalDependencies>-lSceDebugForDriver_stub
75+
;-lSceSysmemForDriver_stub
76+
;-lSceThreadmgrForDriver_stub
77+
;-lSceSysclibForDriver_stub
78+
;-lScePowerForDriver_stub
79+
;-lSceDisplayForDriver_stub
80+
;-lSceProcessmgrForDriver_stub;-lSceSysrootForKernel_stub;-ltaihenForKernel_stub;-ltaihenModuleUtils_stub;%(AdditionalDependencies)</AdditionalDependencies>
81+
</Link>
82+
<PostBuildEvent>
83+
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)_$(TargetName).skprx"
84+
"$(SCE_PSP2_SDK_DIR)\host_tools\build\bin\armlibgen.exe" --dump lib.emd --stub-archive</Command>
85+
</PostBuildEvent>
86+
</ItemDefinitionGroup>
87+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
88+
<ClCompile>
89+
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);</PreprocessorDefinitions>
90+
<OptimizationLevel>Level3</OptimizationLevel>
91+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
92+
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\kernel;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
93+
</ClCompile>
94+
<Link>
95+
<AdditionalOptions>--prx-no-runtime-support "$(ProjectDir)$(IntDir)lib.o"</AdditionalOptions>
96+
<InfoStripping>StripSymsAndDebug</InfoStripping>
97+
<DataStripping>StripFuncsAndData</DataStripping>
98+
<DuplicateStripping>true</DuplicateStripping>
99+
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
100+
<AdditionalDependencies>-lSceDebugForDriver_stub
101+
;-lSceSysmemForDriver_stub
102+
;-lSceThreadmgrForDriver_stub
103+
;-lSceSysclibForDriver_stub
104+
;-lScePowerForDriver_stub
105+
;-lSceDisplayForDriver_stub
106+
;-lSceProcessmgrForDriver_stub;-lSceSysrootForKernel_stub;-ltaihenForKernel_stub;-ltaihenModuleUtils_stub;%(AdditionalDependencies)</AdditionalDependencies>
107+
</Link>
108+
<PostBuildEvent>
109+
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --compress "$(LocalDebuggerCommand)" "$(OutDir)_$(TargetName).skprx"
110+
"$(SCE_PSP2_SDK_DIR)\host_tools\build\bin\armlibgen.exe" --dump lib.emd --stub-archive</Command>
111+
</PostBuildEvent>
112+
</ItemDefinitionGroup>
113+
<Import Condition="'$(ConfigurationType)' == 'Makefile' and Exists('$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets')" Project="$(VCTargetsPath)\Platforms\$(Platform)\SCE.Makefile.$(Platform).targets" />
114+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
115+
<ImportGroup Label="ExtensionTargets">
116+
</ImportGroup>
117+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cxx;cc;s;asm</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hpp</Extensions>
11+
</Filter>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="main.c">
15+
<Filter>Source Files</Filter>
16+
</ClCompile>
17+
<ClCompile Include="clock.c">
18+
<Filter>Source Files</Filter>
19+
</ClCompile>
20+
<ClCompile Include="info.c">
21+
<Filter>Source Files</Filter>
22+
</ClCompile>
23+
</ItemGroup>
24+
<ItemGroup>
25+
<ClInclude Include="clock.h">
26+
<Filter>Header Files</Filter>
27+
</ClInclude>
28+
<ClInclude Include="common.h">
29+
<Filter>Header Files</Filter>
30+
</ClInclude>
31+
<ClInclude Include="info.h">
32+
<Filter>Header Files</Filter>
33+
</ClInclude>
34+
</ItemGroup>
35+
<ItemGroup>
36+
<CustomBuild Include="lib.emd" />
37+
</ItemGroup>
38+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

PSVshellPlus_Kernel/clock.c

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#include <kernel.h>
2+
#include <taihen.h>
3+
4+
#include "clock.h"
5+
#include "common.h"
6+
7+
#define PSVS_LOCKED_PID_MAX_COUNT 16
8+
9+
int scePowerSetArmClockFrequency(int clock);
10+
int scePowerSetGpuClockFrequencyInternal(int corefreq, int mpfreq);
11+
int scePowerSetGpuXbarClockFrequency(int clock);
12+
int scePowerSetBusClockFrequency(int clock);
13+
14+
int scePowerGetArmClockFrequencyProc(ScePID pid);
15+
int scePowerGetGpuClockFrequencyProc(ScePID pid);
16+
int scePowerGetGpuXbarClockFrequencyProc(ScePID pid);
17+
int scePowerGetBusClockFrequencyProc(ScePID pid);
18+
19+
int scePowerGetArmClockFrequency(void);
20+
int scePowerGetGpuClockFrequencyInternal(SceInt32 *corefreq, SceInt32 *mpfreq);
21+
int scePowerGetBusClockFrequency(void);
22+
int scePowerGetGpuXbarClockFrequency(void);
23+
24+
SceInt32 psvsClockFrequencyLockProc(ScePID pid, PsvsLockDevice type)
25+
{
26+
PSVSKPLS *kpls = NULL;
27+
SceInt32 ret = sceKernelGetRemoteKPLS(pid, g_psvsKpls, &kpls, SCE_TRUE);
28+
if (ret == SCE_OK && kpls != NULL) {
29+
kpls->lock |= type;
30+
}
31+
32+
return ret;
33+
}
34+
35+
SceInt32 psvsClockFrequencyUnlockProc(ScePID pid, PsvsLockDevice type)
36+
{
37+
PSVSKPLS *kpls = NULL;
38+
SceInt32 ret = sceKernelGetRemoteKPLS(pid, g_psvsKpls, &kpls, SCE_TRUE);
39+
if (ret == SCE_OK && kpls != NULL) {
40+
kpls->lock &= ~type;
41+
}
42+
43+
return ret;
44+
}
45+
46+
SceBool psvsClockFrequencyIsLockedProc(ScePID pid, PsvsLockDevice type)
47+
{
48+
PSVSKPLS *kpls = NULL;
49+
SceInt32 ret = sceKernelGetRemoteKPLS(pid, g_psvsKpls, &kpls, SCE_TRUE);
50+
if (ret == SCE_OK && kpls != NULL) {
51+
return kpls->lock & type;
52+
}
53+
54+
return SCE_FALSE;
55+
}
56+
57+
SceInt32 psvsSetArmClockFrequency(SceInt32 clock)
58+
{
59+
SYSCALL_ENTER
60+
clock += PSVS_CLOCK_MAGIC;
61+
SceInt32 ret = scePowerSetArmClockFrequency(clock);
62+
SYSCALL_EXIT
63+
return ret;
64+
}
65+
66+
SceInt32 psvsSetGpuClockFrequency(SceInt32 clock)
67+
{
68+
SYSCALL_ENTER
69+
clock += PSVS_CLOCK_MAGIC;
70+
SceInt32 corefreq = clock;
71+
SceInt32 mpfreq = clock;
72+
SceInt32 ret = scePowerSetGpuClockFrequencyInternal(corefreq, mpfreq);
73+
SYSCALL_EXIT
74+
return ret;
75+
}
76+
77+
SceInt32 psvsSetGpuXbarClockFrequency(SceInt32 clock)
78+
{
79+
SYSCALL_ENTER
80+
clock += PSVS_CLOCK_MAGIC;
81+
SceInt32 ret = scePowerSetGpuXbarClockFrequency(clock);
82+
SYSCALL_EXIT
83+
return ret;
84+
}
85+
86+
SceInt32 psvsSetBusClockFrequency(SceInt32 clock)
87+
{
88+
SYSCALL_ENTER
89+
clock += PSVS_CLOCK_MAGIC;
90+
SceInt32 ret = scePowerSetBusClockFrequency(clock);
91+
SYSCALL_EXIT
92+
return ret;
93+
}
94+
95+
SceInt32 psvsGetClockFrequency(PSVSClockFrequency *clocks)
96+
{
97+
SceInt32 ret = 0;
98+
SceInt32 unused;
99+
if (!clocks)
100+
return SCE_KERNEL_ERROR_INVALID_ARGUMENT;
101+
102+
SYSCALL_ENTER
103+
104+
PSVSClockFrequency kclocks;
105+
kclocks.cpu = scePowerGetArmClockFrequency();
106+
if (psvsClockFrequencyIsLockedProc(psvsGetClockingPid(), PSVS_500_MHZ_KEY))
107+
kclocks.cpu = 500;
108+
scePowerGetGpuClockFrequencyInternal(&kclocks.gpu, &unused);
109+
kclocks.xbar = scePowerGetGpuXbarClockFrequency();
110+
kclocks.bus = scePowerGetBusClockFrequency();
111+
112+
ret = sceKernelCopyToUser(clocks, &kclocks, sizeof(PSVSClockFrequency));
113+
114+
SYSCALL_EXIT
115+
return ret;
116+
}

0 commit comments

Comments
 (0)