当我尝试boo.exe从网络共享(映射到驱动器)运行.NET程序集()时,它失败,因为它只是部分信任:
Unhandled Exception: System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at BooCommandLine..ctor()
at Program..ctor()
at ProgramModule.Main(String[] argv)
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
boo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///H:/boo-svn/bin/boo.exe
Run Code Online (Sandbox Code Playgroud)
根据博客文章的说明,我向.NET配置添加了一个策略,完全信任所有程序集file:///H:/*作为其URL.我通过在.NET配置中file:///H:/boo-svn/bin/boo.exe的Evaluate Assembly …
我的C代码片段获取参数的地址并将其存储在易失性存储器位置(预处理代码):
void foo(unsigned int x) {
*(volatile unsigned int*)(0x4000000 + 0xd4) = (unsigned int)(&x);
}
int main() {
foo(1);
while(1);
}
Run Code Online (Sandbox Code Playgroud)
我使用SVN版本的GCC来编译这段代码.在函数结束时,foo我希望将值1存储在堆栈中,并且在0x40000d4指向该值的地址处.当我使用标志进行编译时没有进行优化时-O0,我得到了预期的ARM7TMDI程序集输出(为方便起见而注释):
.align 2
.global foo
.type foo, %function
foo:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
sub sp, sp, #8
str r0, [sp, #4] @ 3. Store the argument on the stack …Run Code Online (Sandbox Code Playgroud)