Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ARM assembly language programming query

Posted on 2002-07-29
4
Medium Priority
?
931 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 200 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

916 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