Baking Pi – Operating Systems Development
cl.cam.ac.uk
Baking Pi – Operating Systems Development
1–10 of 15 posts
Re: Baking Pi – Operating Systems Development
#2ldr r0,=0x20200000
Shouldn't the LDR be a MOV?
Re: Baking Pi – Operating Systems Development
#3So, I haven't written ARM assembly since I owned an Archimedes computer many years ago, but isn't there a mistake describing the very first assembly language instruction in lesson 1? ldr r0,=0x20200000 Shouldn't the LDR be a MOV?
Re: Baking Pi – Operating Systems Development
#4So, I haven't written ARM assembly since I owned an Archimedes computer many years ago, but isn't there a mistake describing the very first assembly language instruction in lesson 1? ldr r0,=0x20200000 Shouldn't the LDR be a MOV?
(http://www.woodmann.com/fravia/The%20ARM%20Processor.htm)
> The ARM assembler also supports a similar pseudo operation. The construct LDR rd,=value is used to load value into register rd. The LDR pseudo instruction uses the MOV or MOV instructions, or it places the constant in memory and uses program counter relative addressing to load the constant.
(http://sourceware.org/binutils/docs/as/ARM-Opcodes.html)
> If expression evaluates to a numeric constant then a MOV or MVN instruction will be used in place of the LDR instruction, if the constant can be generated by either of these instructions. Otherwise the constant will be placed into the nearest literal pool (if it not already there) and a PC relative LDR instruction will be generated.
Re: Baking Pi – Operating Systems Development
#5Re: Baking Pi – Operating Systems Development
#6Re: Baking Pi – Operating Systems Development
#7So, I haven't written ARM assembly since I owned an Archimedes computer many years ago, but isn't there a mistake describing the very first assembly language instruction in lesson 1? ldr r0,=0x20200000 Shouldn't the LDR be a MOV?
Example, using a simple input:
.globl _start
_start:
ldr r0, =0x20200000
Disassembles to: .globl _start
_start:
ldr r0, [pc, #-4]
.word 0x20200000Re: Baking Pi – Operating Systems Development
#8So, I haven't written ARM assembly since I owned an Archimedes computer many years ago, but isn't there a mistake describing the very first assembly language instruction in lesson 1? ldr r0,=0x20200000 Shouldn't the LDR be a MOV?
LDR is a pseudo instruction that uses MOVs to load a register. ( http://www.woodmann.com/fravia/The%20ARM%20Processor.htm ) > The ARM assembler also supports a similar pseudo operation. The construct LDR rd,=value is used to load value into register rd. The LDR pseudo instruction uses the MOV or MOV instructions, or it places the constant in memory and uses program counter relative addressing to load the constant. (…
Re: Baking Pi – Operating Systems Development
#9So, I haven't written ARM assembly since I owned an Archimedes computer many years ago, but isn't there a mistake describing the very first assembly language instruction in lesson 1? ldr r0,=0x20200000 Shouldn't the LDR be a MOV?
ARM instructions are 32 bit, so there is a problem when you want to load a 32 bit literal. The assembler will get around this by sticking literals in the text section and then fixup the load with the correct offset. Example, using a simple input: .globl _start _start: ldr r0, =0x20200000 Disassembles to: .globl _start _start: ldr r0, [pc, #-4] .word 0x20200000
Re: Baking Pi – Operating Systems Development
#10Earlier quoted context omitted.
ARM instructions are 32 bit, so there is a problem when you want to load a 32 bit literal. The assembler will get around this by sticking literals in the text section and then fixup the load with the correct offset. Example, using a simple input: .globl _start _start: ldr r0, =0x20200000 Disassembles to: .globl _start _start: ldr r0, [pc, #-4] .word 0x20200000
Not a MOV and an ADD?