first attempt to write inline ASM in C#, failed due to proteted ram

This commit is contained in:
Nitload
2023-04-22 03:40:36 +08:00
parent 906becc265
commit 1cb78e9e8f
78 changed files with 9595 additions and 56 deletions
Binary file not shown.
Binary file not shown.
+10 -9
View File
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Asm", "Asm.vcxproj", "{396B053C-CE3C-40A1-AC57-F25F0EEDE910}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Asm", "Asm.vcxproj", "{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,18 +13,19 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Debug|x64.ActiveCfg = Debug|x64
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Debug|x86.ActiveCfg = Debug|Win32
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Debug|x86.Build.0 = Debug|Win32
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Release|x64.ActiveCfg = Release|x64
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Release|x64.Build.0 = Release|x64
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Release|x86.ActiveCfg = Release|Win32
{396B053C-CE3C-40A1-AC57-F25F0EEDE910}.Release|x86.Build.0 = Release|Win32
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Debug|x64.ActiveCfg = Debug|x64
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Debug|x64.Build.0 = Debug|x64
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Debug|x86.ActiveCfg = Debug|Win32
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Debug|x86.Build.0 = Debug|Win32
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Release|x64.ActiveCfg = Release|x64
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Release|x64.Build.0 = Release|x64
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Release|x86.ActiveCfg = Release|Win32
{F75765EF-DFF3-4A7A-A7CB-F05993AEE84F}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {74D9C0A1-8196-4FFA-BCF9-EBC39FA657DB}
SolutionGuid = {27162E4C-F467-4555-865D-560856AEF3CD}
EndGlobalSection
EndGlobal
+3 -2
View File
@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{396b053c-ce3c-40a1-ac57-f25f0eede910}</ProjectGuid>
<ProjectGuid>{f75765ef-dff3-4a7a-a7cb-f05993aee84f}</ProjectGuid>
<RootNamespace>Asm</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
@@ -81,6 +81,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EntryPointSymbol>main</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -129,7 +130,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<MASM Include="源.asm" />
<MASM Include="test.asm" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+1 -1
View File
@@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<MASM Include="源.asm">
<MASM Include="test.asm">
<Filter>源文件</Filter>
</MASM>
</ItemGroup>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\Asm\|
Binary file not shown.
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
.code ; 代码段
main proc frame
mov rax, 1235321532151111
mov rax, 0000000000000000
mov rax, 1111451111451111
sub rsp, 20h ; 分配32字节的栈空间,保证16字节对齐
mov rax,rsp
mov dword ptr [rax], 25 ; 将25存储在栈顶,作为p的低32位
movdqu xmm0, [rax] ; 将栈顶的16字节加载到xmm0,作为p的值
movdqu xmm1, [rax]
movdqu xmm1, [rsp]
sqrtss xmm0, xmm0 ; 计算xmm0的低32位的平方根,并存储在xmm1的低32位
movdqu [rax], xmm0
movdqu [rax], xmm1
movdqu [rsp+16], xmm1 ; 将xmm1的值存储在栈顶+16字节的位置,作为q的值
; 此时,q的值就在[rsp+16]处,可以用其他指令进行操作或返回
add rsp, 32 ; 恢复栈指针
.endprolog
ret
main endp
end
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-9
View File
@@ -1,9 +0,0 @@
.code;代码段
main proc;a函数开始
mov rax,120
add rax,34
sub rax,130
;movhpd xmm0,12
ret
main endp;a函数结束
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.