Run Hello World on ARM emulator [on hold]











up vote
0
down vote

favorite












I'm trying to emulate a ARM-cpu at the moment. I read a lot about how to emulate a cpu. Right now I managed to write down all OpCodes, Registers etc and compiled a Hello World on a ARM-Maschine written in C, to get the assembler code (to test my emulator).



Assembler



    .arch armv8-a
.file "hello.c"
.section .text.startup, "ax", @progbits
.align 2
.p2align 3,,7
.global main
.type main, %function
main:
stp x29, x30, [sp, -16]!
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
add x29, sp, 0
bl __printf_chk
mov w0, 0
ldp x29, x30, [sp], 16
ret
.size main, .-main
.section .rodata.str1.8, "aMS", @progbits, 1
.align 3
.LC0:
.string "Hello World"
.ident "GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10)"
.section .note.GNU-stack, "", @progbits


I have to load the code from the ROM to my emulated RAM from which the code will be executed. But how do I load it to the RAM? I dont understand how to split the OpCodes and the Registers.



Summary



I want to emulate a ARM-CPU on a Intel CPU with Windows. To test my emulator I wrote a Hello World in C and compiled it to get the assembler code. The assembler code is written on a ARM-Maschine with Ubuntu 16.04. My question is how to fetch the assembler code with my emulator.










share|improve this question















put on hold as off-topic by Ramhound, DavidPostill Nov 20 at 21:29


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about computer hardware or software, within the scope defined in the help center." – Ramhound, DavidPostill

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Could you clarify: are you writing an emulator?
    – domen
    Nov 20 at 8:28










  • Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
    – Tailor
    Nov 20 at 8:33










  • You could hook bkpt with your emulator (like ARM semihosting).
    – domen
    Nov 20 at 8:38










  • isnt semihosting for embedded devices?
    – Tailor
    Nov 20 at 10:59















up vote
0
down vote

favorite












I'm trying to emulate a ARM-cpu at the moment. I read a lot about how to emulate a cpu. Right now I managed to write down all OpCodes, Registers etc and compiled a Hello World on a ARM-Maschine written in C, to get the assembler code (to test my emulator).



Assembler



    .arch armv8-a
.file "hello.c"
.section .text.startup, "ax", @progbits
.align 2
.p2align 3,,7
.global main
.type main, %function
main:
stp x29, x30, [sp, -16]!
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
add x29, sp, 0
bl __printf_chk
mov w0, 0
ldp x29, x30, [sp], 16
ret
.size main, .-main
.section .rodata.str1.8, "aMS", @progbits, 1
.align 3
.LC0:
.string "Hello World"
.ident "GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10)"
.section .note.GNU-stack, "", @progbits


I have to load the code from the ROM to my emulated RAM from which the code will be executed. But how do I load it to the RAM? I dont understand how to split the OpCodes and the Registers.



Summary



I want to emulate a ARM-CPU on a Intel CPU with Windows. To test my emulator I wrote a Hello World in C and compiled it to get the assembler code. The assembler code is written on a ARM-Maschine with Ubuntu 16.04. My question is how to fetch the assembler code with my emulator.










share|improve this question















put on hold as off-topic by Ramhound, DavidPostill Nov 20 at 21:29


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about computer hardware or software, within the scope defined in the help center." – Ramhound, DavidPostill

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Could you clarify: are you writing an emulator?
    – domen
    Nov 20 at 8:28










  • Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
    – Tailor
    Nov 20 at 8:33










  • You could hook bkpt with your emulator (like ARM semihosting).
    – domen
    Nov 20 at 8:38










  • isnt semihosting for embedded devices?
    – Tailor
    Nov 20 at 10:59













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to emulate a ARM-cpu at the moment. I read a lot about how to emulate a cpu. Right now I managed to write down all OpCodes, Registers etc and compiled a Hello World on a ARM-Maschine written in C, to get the assembler code (to test my emulator).



Assembler



    .arch armv8-a
.file "hello.c"
.section .text.startup, "ax", @progbits
.align 2
.p2align 3,,7
.global main
.type main, %function
main:
stp x29, x30, [sp, -16]!
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
add x29, sp, 0
bl __printf_chk
mov w0, 0
ldp x29, x30, [sp], 16
ret
.size main, .-main
.section .rodata.str1.8, "aMS", @progbits, 1
.align 3
.LC0:
.string "Hello World"
.ident "GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10)"
.section .note.GNU-stack, "", @progbits


I have to load the code from the ROM to my emulated RAM from which the code will be executed. But how do I load it to the RAM? I dont understand how to split the OpCodes and the Registers.



Summary



I want to emulate a ARM-CPU on a Intel CPU with Windows. To test my emulator I wrote a Hello World in C and compiled it to get the assembler code. The assembler code is written on a ARM-Maschine with Ubuntu 16.04. My question is how to fetch the assembler code with my emulator.










share|improve this question















I'm trying to emulate a ARM-cpu at the moment. I read a lot about how to emulate a cpu. Right now I managed to write down all OpCodes, Registers etc and compiled a Hello World on a ARM-Maschine written in C, to get the assembler code (to test my emulator).



Assembler



    .arch armv8-a
.file "hello.c"
.section .text.startup, "ax", @progbits
.align 2
.p2align 3,,7
.global main
.type main, %function
main:
stp x29, x30, [sp, -16]!
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
add x29, sp, 0
bl __printf_chk
mov w0, 0
ldp x29, x30, [sp], 16
ret
.size main, .-main
.section .rodata.str1.8, "aMS", @progbits, 1
.align 3
.LC0:
.string "Hello World"
.ident "GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10)"
.section .note.GNU-stack, "", @progbits


I have to load the code from the ROM to my emulated RAM from which the code will be executed. But how do I load it to the RAM? I dont understand how to split the OpCodes and the Registers.



Summary



I want to emulate a ARM-CPU on a Intel CPU with Windows. To test my emulator I wrote a Hello World in C and compiled it to get the assembler code. The assembler code is written on a ARM-Maschine with Ubuntu 16.04. My question is how to fetch the assembler code with my emulator.







cpu c arm emulator assembly






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 7:23

























asked Nov 20 at 7:01









Tailor

34




34




put on hold as off-topic by Ramhound, DavidPostill Nov 20 at 21:29


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about computer hardware or software, within the scope defined in the help center." – Ramhound, DavidPostill

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Ramhound, DavidPostill Nov 20 at 21:29


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about computer hardware or software, within the scope defined in the help center." – Ramhound, DavidPostill

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Could you clarify: are you writing an emulator?
    – domen
    Nov 20 at 8:28










  • Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
    – Tailor
    Nov 20 at 8:33










  • You could hook bkpt with your emulator (like ARM semihosting).
    – domen
    Nov 20 at 8:38










  • isnt semihosting for embedded devices?
    – Tailor
    Nov 20 at 10:59


















  • Could you clarify: are you writing an emulator?
    – domen
    Nov 20 at 8:28










  • Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
    – Tailor
    Nov 20 at 8:33










  • You could hook bkpt with your emulator (like ARM semihosting).
    – domen
    Nov 20 at 8:38










  • isnt semihosting for embedded devices?
    – Tailor
    Nov 20 at 10:59
















Could you clarify: are you writing an emulator?
– domen
Nov 20 at 8:28




Could you clarify: are you writing an emulator?
– domen
Nov 20 at 8:28












Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
– Tailor
Nov 20 at 8:33




Yes, I want to emulate the cpu. Without os, gui etc. Just the cpu with console output.
– Tailor
Nov 20 at 8:33












You could hook bkpt with your emulator (like ARM semihosting).
– domen
Nov 20 at 8:38




You could hook bkpt with your emulator (like ARM semihosting).
– domen
Nov 20 at 8:38












isnt semihosting for embedded devices?
– Tailor
Nov 20 at 10:59




isnt semihosting for embedded devices?
– Tailor
Nov 20 at 10:59















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]