Solved

ARM assembly language programming query

Posted on 2002-07-29
4
911 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Deploying our service is a grudge match between customer benefits and customer pain. In one corner, rolling out fixes (yay!) and delivering new features (double yay!). In the other corner, training on new features (boo – sounds like work), and chan…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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