Solved

ARM assembly language programming query

Posted on 2002-07-29
4
898 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mathematics for Computer Science 25 446
Bufbomb Phase 2: Firecracker 13 8,959
Creating EXE from Assembly Code 13 753
Learning ARM system and assembly language with a Raspberry pi 2 83
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

22 Experts available now in Live!

Get 1:1 Help Now