linux - 使用 cmp x84 时出现段错误
问题描述
我是组装新手,我正在为学校做这个。它在第 16 行(cmpq)上出现段错误,尽管据我了解我这样做是正确的。提前致谢。
global transitions
.text
transitions:
push %rbp #Push old frame pointer to stack
movq %rsp, %rbp #Update rbp so that its pointing at the old rbp (which is the bottom of the new frame)
pushq %r12 #save r12
pushq %r13 #save r13
pushq %rax #save return value
movq $0, %r12 #set shift count to 0
movq $0, %rax #set transitions to 0
movq %r13, %rdi #copy perameter
shlq %r13 #Initialize carry flag
start:
incq %r12 #Increment shifts
cmpq %r12, 63 #See if shift count is greater than 63
jns end #Jump to end if true
shl %r14 #Shift left
jnc start #Jump to start if bit was 0
incq %r12 #Increment shifts
cmpq %r12, 63 #See if shift count is greater than 63
jns end #Jump to end if true
shl %r14 #Shift left
jnc found #See if sequence is found
jmp start#Jump to start
found:
incq %rax #increment transitions
end:
pop %r14
pop %rax
pop %r13
pop %r12
ret
编辑:在评论中向潜伏者和内特大喊。谢谢!
解决方案
推荐阅读
- reactjs - React Native Image 无法解析模块
- facebook - Facebook Live 视频突然停止工作,连 Facebook 团队都批准了权限?
- mongodb - Grails 3.1 - 域实例的空属性保存在 mongodb
- javascript - 点击时的Javascript文本循环
- word2vec - word2vec 中的词汇大小与向量大小
- python - 使用while循环检查文件中是否存在字符串
- javascript - 使用 chrome 扩展覆盖用户定义的函数以使用本机函数
- java - 使用springboot连接多个Kafka服务器
- javascript - 如何用 JavaScript 或 jQuery 中的值替换整个输入字段?
- vue.js - 与 Browserify 的单个文件组件分开包含 Vue 运行时