由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 问几句汇编指令(assembly language)
相关主题
汇编的mov指令问个c++的弱问题
今天给c++震惊了关于数组
0 < -1 ? A c++ question(面试题) 给code挑毛病(updated with multiple choices)
string operator +问个函数指针指向操作符的问题
C++隐式类型转换的规则?C语言里面的register变量能否进行取地址操作? (转载)
overriding operator<<问个无厘头问题
C++命名空间和算子重载求教两个new - delete 问题, C++
面试问题member and friend
相关话题的讨论汇总
话题: ip话题: lsl话题: orr话题: r2话题: r4
进入Programming版参与讨论
1 (共1页)
e******r
发帖数: 623
1
在看一个callout的程序,有几句实在看不懂,请高人指点一下:
1. mov ip, #0x000000FF
orr ip, ip, #0x0000FF00
orr ip, ip, #0x00FF0000
orr ip, ip, #0xFF000000
这几句是在做什么?是把"0xFFFFFFFF"赋值给ip吗?为什么不能直接写成 mov ip, #
0xFFFFFFFF?
2. tst r1, r2, lsl r4
r1, r2和r4是寄存器,但是tst怎么有三个operands?
3. mov r2, r2, lsl r4
基本同上,怎么mov会有三个operands?这句指令是什么意思?
谢谢了,能提供答案的我会发包子
t****t
发帖数: 6806
2
all ur questions gets down to the "flexible operand 2" in ARM instructions
1. immediate values are 8bit long with optional shift. so it's really:
mov ip, #ff;
orr ip, ip, #ff lsl #8;
orr ip, ip, #ff lsl #16;
orr ip, ip, #ff lsl #24;
2. in "tst r1, r2, lsl r4", "r2, lsl r4" is the operand 2, meaning r2*2^r4
3. same as 2

【在 e******r 的大作中提到】
: 在看一个callout的程序,有几句实在看不懂,请高人指点一下:
: 1. mov ip, #0x000000FF
: orr ip, ip, #0x0000FF00
: orr ip, ip, #0x00FF0000
: orr ip, ip, #0xFF000000
: 这几句是在做什么?是把"0xFFFFFFFF"赋值给ip吗?为什么不能直接写成 mov ip, #
: 0xFFFFFFFF?
: 2. tst r1, r2, lsl r4
: r1, r2和r4是寄存器,但是tst怎么有三个operands?
: 3. mov r2, r2, lsl r4

t****t
发帖数: 6806
3
claim: i got the results from google. i do not guarantee the correctness.

【在 t****t 的大作中提到】
: all ur questions gets down to the "flexible operand 2" in ARM instructions
: 1. immediate values are 8bit long with optional shift. so it's really:
: mov ip, #ff;
: orr ip, ip, #ff lsl #8;
: orr ip, ip, #ff lsl #16;
: orr ip, ip, #ff lsl #24;
: 2. in "tst r1, r2, lsl r4", "r2, lsl r4" is the operand 2, meaning r2*2^r4
: 3. same as 2

e******r
发帖数: 623
4
谢谢,包子已发.能不能再帮忙解释一下第一个问题,为什么不能直接写成:
mov ip, #0xFFFFFFFF ?

【在 t****t 的大作中提到】
: claim: i got the results from google. i do not guarantee the correctness.
t****t
发帖数: 6806
5
did you read my post? i explained.

【在 e******r 的大作中提到】
: 谢谢,包子已发.能不能再帮忙解释一下第一个问题,为什么不能直接写成:
: mov ip, #0xFFFFFFFF ?

a******k
发帖数: 1552
6
我来排个队。
d***i
发帖数: 344
7
包子机?!真智能,吃包子都吃到老家来了

【在 a******k 的大作中提到】
: 我来排个队。
1 (共1页)
进入Programming版参与讨论
相关主题
member and friendC++隐式类型转换的规则?
有个SB interviewer和我说++i比i++好 (转载)overriding operator<<
指针的大小是 4 byte还是有赖于系统?C++命名空间和算子重载
请问关于overloading <<面试问题
汇编的mov指令问个c++的弱问题
今天给c++震惊了关于数组
0 < -1 ? A c++ question(面试题) 给code挑毛病(updated with multiple choices)
string operator +问个函数指针指向操作符的问题
相关话题的讨论汇总
话题: ip话题: lsl话题: orr话题: r2话题: r4