Solved

ARM assembly language programming query

Posted on 2002-07-29
4
895 Views
Last Modified: 2012-05-04
I am making an Application to run an x86 exe file on an ARM  machine. I read the hex code of exe file and have implemented ARM assembly instructions simulating the coreesponding x86 instruction.I am implementing ARM code for all posible hex Codes of x86 instructions .

The problem arises in

1.) To implement Auxillary Flags of x86 in ARM. ARM does not have a Auxillary flag. I have implemented Parity flag my calculating the number of 1's in the result of an operation like arithmetic, logical or shift/rotate instruction. Auxillary flags hav to  implemented for nibbles of data. This changes the whole Approach i have taken till now. Can u give me an idea which calculates if the operation resulted in Auxillary flag to be set. This idea or method cannot be specific to different instructions but same for all kinds of x86 instructions.

2.) In implementing stacks, memory offsets etc, how can i be sure that addresess give by x86 exe file map to such addresses in ARM machine that they attempt donot overwrite other programs memory space.    

I am open to any kind of instructions and will be thankful for any idea
0
Comment
Question by:VIkram_Mehta
  • 2
4 Comments
 
LVL 9

Expert Comment

by:BeyondWu
ID: 7192503
How you implement the jxx and other instructions which will depend on EFLAGS register?
0
 

Author Comment

by:VIkram_Mehta
ID: 7193473
HI BeyondWu
Implementing flags is a big issue for us too.
we have used six bytes to simulate flags of x86 machine.(Six bytes so that we avoid masking different bits)
We implement the sign and zero flags by getting the status of N and Z flags of the ARM processor just after our operation like ADD, OR etc when done in  ARM code.

For Parity flag we put have put logic to check wether the number of ones is even or odd in the result of our operation. ARM does not have a parity flag

For overflow and ADD flag we put logic for 8 bit and 16 bit data as ARM will set its overflow and Carry  flags only when the result exceeds 32 bits.

 
For Auxillary flags we still have to work a logic.
Direction flag is changed only by its commands and not as byproducts of other commands so it is also not a problem.


We would appreciate your ideas in implementing x86 flags too.

The problem of memory management is solved because this applicaton runs befor an Operating system is  loaded. So the whole memory is ours.

How do we implement int10 and int16 services of x86 in ARM as we will encounter these instructions in our x86 exe file ?

Thanx
Vikram
0
 
LVL 9

Accepted Solution

by:
BeyondWu earned 50 total points
ID: 7195015
>>Auxillary flags? DO you means Auxiliary Carry Flag?
If so, you need to do the arithmetic operation again (with only low 4 bits) to check if the bit3 has a carry.
e.g.
     OP reg1, reg2
     tmp1 = reg1 & 0x0F
     tmp2 = reg2 & 0x0F
     OP tmp1, tmp2
     if tmp1 > 0xF   // assume the result is put into temp1
        AF = 1
     else
        AF = 0

For intXX, I think you need to implement a Interrupt Vector Table at the beginning of memory(How do you implement memory managment?Is there a seg:offset style?), some programs will modify the IVT, I think you need to implement all the functionality for it. When you encounter these instructions, you can call the function which resides in IVT(which should be interpreted to ARM opcode), then call your implemented function(implemented with native ARM opcode to simulate the default function, needn't interpret.).

How do you implement int21 or other service of DOS?
It seems you only want to support 16bit DOS program, is it ture?Do you think it's possible to support and compatible with any DOS program?
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7712773
Question abandoned; force-accepted.

Netminder
EE Admin
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
A procedure for exporting installed hotfix details of remote computers using powershell
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now