如何在汇编语言中运行独立的代码

如何在汇编语言中运行独立的代码,第1张

概述如何在汇编语言运行独立的代码

我有一个windows 10电脑和Visual Studio 2017我的C / C + +开发。

我正在阅读“代码优化:有效的内存使用” ,作者build议运行下面的代码来捕获各种代码的准确运行时间。

XOR EAX,EAX ;cpuID command is called to ensure all preceding commands cpuID ;have left the pipeline,hence,not influencing measurement results RDTSC ;This returns to the EAX register the lower DWord of current ;value of time stamp counter MOV [clock],EAX ; the obtained result is save to the clock variable //... //profiled code ; here the profiled code is run //--- XOR EAX,EAX ; the cpuID command is executed again to ensure all preceding cpuID ;instructions have left the pipeline RDTSC ; read the new value of the time stamp counter SUB EAX,[clock] ; calculate the difference to capture actual time to execute code fragment

我可以理解上面的汇编代码在做什么。 但是我到底在哪里input这个在windows中,并观察结果? 我应该在Visual Studio中将其保存为.asm文件,然后在其中运行它? 我应该创build一个C文件,然后在其中包含此汇编指令? 或者,我应该远离Visual Studio,并使用独立的汇编语言编译器/deBUGging器?

在linux 64位处理命令行

下面的x86程序端口到mips32

gdb不会接受用户input

assembly计数程序

linux上的Masm32:为什么mov ,ax工作,但mov ,bx(或mov ,al)不?

在windows 7中捕获删除 *** 作(首选)

AVR汇编程序在linux中

为什么在存储超过BSS的末尾时没有出现分段错误?

使用单字节指令开始x64function是否合法?

“呼叫0x80482f0 <puts @ plt>”? 只需要在x86汇编的“hello world”程序中澄清一行代码即可

总结

以上是内存溢出为你收集整理的如何在汇编语言中运行独立的代码全部内容,希望文章能够帮你解决如何在汇编语言中运行独立的代码所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1284197.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存