Solved

ARM assembly language programming query

Posted on 2002-07-29
4
909 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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