cwalls251 / iphone-dev

Automatically exported from code.google.com/p/iphone-dev
0 stars 0 forks source link

Missing Instructions #46

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The following instructions (and their conditionals) are missing causing our 
inline asm to fail:

swp*
mcr

Original issue reported on code.google.com by gro...@gmail.com on 19 Sep 2007 at 10:26

GoogleCodeExporter commented 8 years ago

Original comment by nightwat...@gmail.com on 23 Sep 2007 at 9:10

GoogleCodeExporter commented 8 years ago
nightwatch? are you on to this?
i'll take care of it once i figure out how to enhance arm-as.

even if they're not needed asap, it's good to have those instructions.

Original comment by onit...@gmail.com on 9 Oct 2007 at 3:58

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This adds swp/swpne etc.   This was used for building Mono.

Here was the test case:

#include <stdio.h>
static inline int InterlockedIncrement(volatile int *dest)    
{
   int a, b, c;
   __asm__ __volatile__ (  "0:\n\t"
                           "ldr %0, [%3]\n\t"
                           "add %1, %0, %4\n\t"
                           "swp %2, %1, [%3]\n\t"                            
                           "cmp %0, %2\n\t"
                           "swpne %1, %2, [%3]\n\t"
                           "bne 0b"
                           : "=&r" (a), "=&r" (b), "=&r" (c)
                           : "r" (dest), "r" (1)
                           : "cc", "memory");
   return b;
}

int main()
{
   int a = 3333;
   int b = 2222;
   int c = a + b;
   InterlockedIncrement(&c);
   printf("%d\n", c);
   return 0;
}

You should see 5556 as the output.

Note, I haven't beat on this much, so YMMV.

Original comment by czim...@gmail.com on 15 Oct 2007 at 4:03

Attachments:

GoogleCodeExporter commented 8 years ago
Comment 3 was deleted because somehow 'LCD' and 'soda' had been inserted into 
the
code for InterlockedIncrement().  While both are nice individually and 
together, I
suspect they may have caused problems in InterlockedIncrement().

Original comment by czim...@gmail.com on 15 Oct 2007 at 4:04

GoogleCodeExporter commented 8 years ago
patch fixed (the heading spaces were missing) and applied.

i compiled your test program and disassembled the result with 
arm-apple-darwin-otool.
here's the relevant code:
00001f30        e4930000        ldr r0, [r3], #0
00001f34        e0801004        add r1, r0, r4
00001f38        e1032091        swp r2, r1, [r3]
00001f3c        e1500002        cmp r0, r2
00001f40        11031092        swpne r1, r2, [r3]
00001f44        1afffff9        bne 0x00001f30

seems to work too, tried with -O0 and -O3.

patch committed.

Original comment by onit...@gmail.com on 15 Oct 2007 at 8:21

GoogleCodeExporter commented 8 years ago
a small concurrency here. nightwatch committed a swp and mcr patch just after i
applied the swp -> conflict.

what about mcrr/mrrc/mcr2/mrc2?
i encountered mcrr in some apple code i believe (64bit int stuff).

Original comment by onit...@gmail.com on 17 Oct 2007 at 1:04

GoogleCodeExporter commented 8 years ago
=*SJ99 - iPhone toolchain SDK v2.0.1*=

==Support Leopard & Snow Leopard (MAC OS 10.5.x & 10.6.x) Perfectly.==
==Support iPhone OS v3.x & 4.x==

Please open this link to view detail:  
http://www.sj99.com/toolchain.html

Usually, in order to develop iPhone toolchain applications, the beginners need 
to download several crosslink package and configure many complicated settings, 
it's very hard to config, complie, and link the toolchain successfully in a 
fews days. Almost 99% of the beginners will encounter several problems, and 
more than half them will gave up.

From now on, everything is easy. All you have to do is just buy/download this 
SJ99 iPhone Toolchain SDK, and install it on your Mac computer, only need to 
click the mouse several times.  It's a good news to all of the iPhone toolchain 
developers. 

[http://www.sj99.com/toolchain/TOOLCHAINSDK-en.png]

SJ99 - iPhone Toolchain SDK

Develop and Distribute Toolchain Application, General Flow:

 [http://www.sj99.com/toolchain/flow.jpg] 

SJ99 - iPhone Toolchain SDK, Installation Screen Snap:

[http://www.sj99.com/toolchain/sj99-iphone-toolchain-1.jpg]

After installed successfully, you can found all of the necessary dev-tools is 
ready on your computer:

There are some Demo Apps with source code that you can find them after 
installed the SDK. They are very easy to learn and test on the real iPhone.

For example, If you want to run one of the Demo App: testapp, just step into 
the source code folder, and run command line: $ make

After run make successfully, you can find the new executable program:test was 
created in the same folder.

Now let's run it on the real iPhone, it's very easy: 
1st. Config your iphone WIFI to link your Mac in a same local network, edit the 
iPhone_ip_address config file on your Mac
2nd. Run a simple command line: $ make up
OK, the script will upload the test program file onto your iPhone, and sign it 
automatically.

Example: You can find the executable file:test  in the /tmp folder on your 
iPhone:

Now you can run it by the terminal App on the iPhone:

This is just a very simple demo. You can use this SDK to develop powerful and 
fully functional iPhone applications.
In order to improve the dev efficiency, we recommend developers using Xcode to 
develop the UI and common functions, just leave all of the underlying/bottom 
functions to Toolchain SDK. It's very easy and suitable for the Xcode project 
to link the dylib file which was complied by Toolchain SDK.

The newest v2.1 version now is available. It has been optimized and support all 
of the XCODE versions, all of the iPhone OS versions, and all of the Apple 
iPhone SDK versions. The v2.1 contain more important demo project source code, 
include dylib project and Xcode UI project which can link and call the api that 
was implemented in a dylib library. 

Please open this link to view detail:  
http://www.sj99.com/toolchain.html

Copyright (C) 2010, SJ99.com Innovation for Dev&Art. Email: sj99com@gmail.com

Original comment by SJ99...@gmail.com on 5 Sep 2010 at 2:37