So, I started building programming. It's pretty simple in my Ubuntu field: using NASMamd GNU ld, I was able to write more or less complex HelloWorld-style programs in half an hour. But when it comes to the iPhone, it is so complicated. First of all, I have JB'en iPhone 3G on firmware 4.2.1, which means that I am using the Darwin v10 core ARM port. Secondly. I have to use GNU since there is no NASM for iPhone: the built-in toolchain (both Xcode on Mac OS X and openware tooolchain on Linux) uses GCC. Therefore, I gathered basic information about: - how to write an assembly in GNU as a language; - What are the basic ARM instructions, registers, memory access.
But even HelloWorld requires kernel calls to write to stdout. My question is: which kernel should be used and how (which arguments go there); I have to use the swi # ARM instruction, right?
So, can you post any info / links to tutorials or anyone with ARM Darwin Hello world asm code?
Currently I can do this:
;Hello World for Linux and NASM
section data
hello db "Hello World"
helloLen equ $ - hello
section text
global _start
_start:
mov eax, 4 ; sys_write
mov ebx, 1 ; to stdout
mov ecx, hello ; address of string
mov edx, helloLen ; value (because of eq!!!) of strLen
int 0x80 ; call awesome Linux kernel
mov eax, 1 ; sys_exit
mov ebx, 0 ; "return 0; " if you like C
int 0x80 ; call kernel to end program
on ARM, however, I could only do this:
.text
start:
mov r0,
mov r1,
add r2, r0, r1
@all mov and add and other stuff works fine
swi
@all that I get is Bad system call error
So, anyone?
source
share