flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > FASMARM v1.43 - Cross assembler for ARM CPUs

Goto page Previous  1, 2, 3 ... 7, 8, 9 ... 30, 31, 32  Next
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
hi, please, is there some "int3" alternative in ARM? i am using GDB to debug WinCE app, and want nice way to stop at given offset.

also, there are more imports than we have in list in CE. For example there is also a ascii version of GetProcAddress (eg. GetProcAddressA). Also there are some undocumented (GetProcByPtr, GetProcName)

here is another list: http://www.rainer-keuchel.de/wince/dllexports/j680-coredll.txt, but it also missess GetProcAddressA (maybe it is included only in newer CEs)
Post 22 Jun 2006, 13:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
Quote:
"int3" alternative in ARM
use BKPT
Quote:
ascii version of GetProcAddress
WinCE is all unicode.
Post 25 Jun 2006, 23:14
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
WinCE is all unicode.

nope, it isn't. Even strings in PE structure are still ASCII, so you would need too much conversion. Look at ROM images, they are freely downloadable from microsoft (Device Emulator ROM images), you can see exports there.
Post 26 Jun 2006, 15:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
Quote:
strings in PE structure are still ASCII
Sorry, I meant from a user program point of view that WinCE is unicode. From a system/hacker point of view then you will see some ascii stuff occasionally. The conversion is easy and fast anyway so you can write a small utility function to convert the strings as required. That is what WinCE will do anyway so you are not saving any time by using ascii/unicode mixture.
Post 27 Jun 2006, 00:37
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you didn't get me, i meant that if you look into ROM images, at COREDLL.DLL exports, you can see "GetProcAddressA" export, and other ascii exports there. I already have working code using GetProcAddressA.

Sorry, can't post it, it's company stuff, which shouldn't be realeased - you can look at UPX sources for another example. Can be downloaded at http://upx.sourceforge.net/#download. It's file upx-2.01-src\src\stub\l_armpea.S


btw, what is XOR equivalent in ARM?

thanks.
Post 28 Jun 2006, 10:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
http://en.wikipedia.org/wiki/FASM
http://en.wikipedia.org/wiki/List_of_assemblers

there should be a mention about FASMARM... it's quite big thing
Post 02 Jul 2006, 14:42
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
Quote:
what is XOR equivalent in ARM?
EOR. Do you have the ARM-ARM? There is a list of all the instructions in part A
Post 03 Jul 2006, 09:03
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
revolution: there were too many pdfs on the site, and right now i am on very slow connection Smile

could you please point few most needed (quick instruction reference, detailed instruction reference, something about protection mechanism)?
Post 04 Jul 2006, 04:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
Quote:
there were too many pdfs on the site, and right now i am on very slow connection
Sorry to hear about your slow connection. But check out some prevoius posts in this thread, there is a link to the precise PDF you will need. It was one of the first things discussed in this topic.
Quote:
could you please point few most needed (quick instruction reference, detailed instruction reference, something about protection mechanism)?
There is so much to cover and I would only be repeating what has been put in the ARM-ARM anyway. I think once you get the PDF you won't regret waiting for the download.
Post 04 Jul 2006, 13:27
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
hi, revolution

have you been thinking about ability to create ARM PE DLL file? It needs somewhat different relocations, i believe, otherwise it should be same.

of course i will do the testing, i can give you some example DLLs if you want. they are from MS visual C, but they use only one type of relocations (number 3), i don't know nothing about others.

btw: how about renaming this thread to "FASMARM"? It's FASMARM project anyway
Post 14 Aug 2006, 12:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
one more question: i need something like "bl r6", eg. call procedure whose address is in r6. best i could work out was this:

Code:
        bl      $+4
        add     lr, lr, 8
        mov     pc, r6
    


any better idea?

[edit]hehe, got it, solution by MazeGen (C)
Code:
mov lr, pc
mov pc, r6    
Post 14 Aug 2006, 12:37
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
vid wrote:
i need something like "bl r6"
Use this:
Code:
BLX R6    
vid wrote:
create ARM PE DLL
Currently the code does not support relocations. But it could be done of course. I presume you want a DLL for WinCE? I can help you (subject to free time). Post whatever info you have and I'll see what I can do.
Post 14 Aug 2006, 14:18
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i don't need it now, i just wanted to point this for completness.

Funny, it seems that current FASMARM's PE formater handles type-3 relocation properly. I don't know if there are some instructions that need to be relocated, seems.

i will try to make my own helloworld DLL, and then post it here as example for your FASMARM package.

Thanks for your willingness
Post 14 Aug 2006, 15:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
for some weird reason, the "relocation info stripped" flag is set even when it is present.

[edit]
revolution: please, fix this
Post 14 Aug 2006, 22:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
my FASMARM generated DLL is not working even after clearing that flag by hand, reports "bad exe format", and i believe it's formatter's problem.

MSVC also does set "size of code", "size of init data", "size of uninit data", "base of code", "base of data".

and MSVC-generated DLL contains unwind info (data 3), but i don't know how to create it. EXEs work without it.

there are also more minor differences between MSVC generated file and FASMARM-generated file.
Post 24 Aug 2006, 16:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
vid wrote:
for some weird reason, the "relocation info stripped" flag is set even when it is present.

[edit]
revolution: please, fix this
I just noticed that the latest "development" version of FASM 1.67 has broken with tradition and the previous "stable" version is no longer available for download, thus breaking the code in my attachment at post #1. So that means I have to update the attachment to be compatible with the current development version Sad Therefore I can also update the problem you have above. But I need clarification: for the flag you mention, should it always be "set" or "reset" or set only if condition XYZ? What is the condition?

vid wrote:
MSVC-generated DLL contains unwind info (data 3)
The is a post I made a while ago in this thread that has the macros to generate unwind info. It was the post where I first posted a trial PE. In later PE code I posted I removed the unwind info because it was not needed for the EXE's.
vid wrote:
there are also more minor differences between MSVC generated file and FASMARM-generated file.
Do you know the important differences, that is, the diferences that make one file work and the other not work? More information needed.
Post 25 Aug 2006, 05:42
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
"relocation info stripped" that flag should SET, when "fixups" data/section is NOT present.

oh, i forgot about those unwind data, yes, i recall they were there, thanks, i will try it.

Quote:
Do you know the important differences, that is, the diferences that make one file work and the other not work? More information needed.

There are many of them, i can list them, but i think problem was in those i mentioned, when we fix all these and it still doesn't work, we can try these. Problem is i still didn't manage to create working DLL for WinCE, after that it would be easy.

also don't forget to set "size of code", "size of init data", "size of uninit data", "base of code", "base of data" in optional header.

thanks for help
Post 25 Aug 2006, 10:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
vid wrote:
"relocation info stripped" that flag should SET, when "fixups" data/section is NOT present.
So that means that currently FASMARM does the correct thing by setting the flag, because relocs have been stripped from the file. Only when relocs are supported/included should the flag be cleared.

By the book the following flags should also be set: IMAGE_FILE_BYTES_REVERSED_LO and IMAGE_FILE_DEBUG_STRIPPED (0x0280). And for DLL of course the IMAGE_FILE_DLL flag needs to be set. Are these flags set for WinCE DLL files in the real world?

vid wrote:
don't forget to set "size of code", "size of init data", "size of uninit data", "base of code", "base of data" in optional header.
I strongly doubt that a standard EXE can be converted to a DLL without also including the relocation info. I think the above values can be easily done, but until the relocs are finalised they won't be much use to you.

One thing you might like to try is to place a "fake" relocation section (data fixups) and write the rest of the DLL using position independent code, clear the IMAGE_FILE_RELOCS_STRIPPED flag and test it. For certain Win32 doesn't use the 5 fields you mentioned.
Post 25 Aug 2006, 12:37
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
I strongly doubt that a standard EXE can be converted to a DLL without also including the relocation info. I think the above values can be easily done, but until the relocs are finalised they won't be much use to you.

relocations WORK... they are setted correctly in current FASMARM. Probably because they are same as in win32/x86 world. But it still doesn't work even if i set this flag myself

Quote:
So that means that currently FASMARM does the correct thing by setting the flag, because relocs have been stripped from the file. Only when relocs are supported/included should the flag be cleared.
but flag isn't set even when fixups are present, and assembled into file.

Quote:
By the book the following flags should also be set: IMAGE_FILE_BYTES_REVERSED_LO and IMAGE_FILE_DEBUG_STRIPPED (0x0280). And for DLL of course the IMAGE_FILE_DLL flag needs to be set. Are these flags set for WinCE DLL files in the real world?

what book?
in working dll i have from MS visual C, only these are set: executable image, 32bit machine expected, DLL. I don't know their names in C headers, sorry, but the value is 2102h so you can find easily. It has a 0x1C-sized tiny debug info... probably just an empty structure.
Post 25 Aug 2006, 13:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
setrodox



Joined: 16 May 2005
Posts: 6
setrodox
i have a problem with using fasm-arm on linux, the assembling worked without problems, but when using fasm-arm i get a "error: illegal instruction." for every instruction.

i tried it with the prebuilt windows binary with wine, and that worked flawlessy.

btw, nice work Smile
Post 26 Aug 2006, 23:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3 ... 7, 8, 9 ... 30, 31, 32  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.