I have some odd self modifying code, but at the root of it is a pretty simple problem: I want to be able to execute a jmp (or a call) and then from that arbitrary point throw an exception and have it caught by the try/catch block that contained the jmp/call.
But when I do this (in gcc 4.4.1 x86_64) the exception results in a terminate...
Can somebody explain me how the following code works?
# if defined(__ELF__)
# define __SECTION_FLAGS ", \"aw\" , @progbits"
/* writable flag needed for ld ".[cd]tors" sections bug workaround) */
# elif defined(__COFF__)
# define __SECTION_FLAGS ", \"dr\""
/* untested, may be writable flag needed */
# endif
asm
(
"....
I am playing around with x86 assembly for the first time and I can't figure out how to sort an array (via insertion sort).. I understand the algorithm, but assembly is confusing me as I primarily use Java & C++. Heres all I have so far
int ascending_sort( char arrayOfLetters[], int arraySize )
{
char temp;
__asm{
push eax
...
push word 0b800h
pop es
xor di, di
mov [es:di], word 441h
jmp $
times 510 - ($-$$) db 0
db 55h
db 0AAh
...
I really do not understand why this simple code works fine in the first attempt but when
putting it in a procedure an error shows:
NTVDM CPU has encountered an illegal instruction
CS:db22 IP:4de4 OP:f0 ff ff ff ff
The first code segment works just fine:
.model small
.stack 100h
.code
start:
mov ax,@data
mov ds,ax
mov es,ax
...
I've been trying to get a good hold on the x86 assembly language, and was wondering if there was a quick-and-short equivalent of movl $1, %eax. That's when I thought that a list of idioms used frequently in the language would perhaps be a good idea.
This could include the preferred use of xorl %eax, %eax as opposed to movl $0, %eax, or ...
i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication
obviously the file consists of two lines , the user name and the password how can i read the two lines seperately and compare them?
My attempt:
proc read_file
mov ah,3dh
lea dx,file_name
int 21h
mov bx, ax
xor si,si
...
I am messing around with assembly for the first time, and can't seem to change the index values of an array. Here's the method I am working on
int ascending_sort( char arrayOfLetters[], int arraySize )
{
char temp;
__asm
{
//???
}
}
And these are what I tried
mov temp, 'X'
mov al, temp
mov arrayOfLetters[0], al
...
I just handed in this function in an assignment. It is done (hence no homework tag). But I would like to see how this can be improved.
Essentially, the function sums the squares of all the integers between 1 and the given number, using the following formula:
n(n+1)(2n+1)/6
Where n is the maximum number.
The function below is made to...
I'm getting a link time error:
WARNING: /home/gulevich/development/camac-fedorov/camac/linux/k0607-lsi6/camac-k0607-lsi6.o (.ctors): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.
The code causing the error (assemb...
Hello,
I'm familiar with X86[-64] architecture & assembly. I want to start develop for an ARM processor. But unlike desktop processors, I don't have an actual ARM processor. I think I need an ARM simulator.
http://www.armtutorial.com/ say
An ARM assembly compiler will be required, the most accessible is the ARMulator.
I thought o...
Possible Duplicate:
how to write hello world in assembler under windows?
I've often heard of applications written using the language of the gods, assembly language. I've never tried though, and I don't even have a clue how to do it.
If I wanted to dabble, how would I go about doing it? I know absolutely nothing about what is ...
I have to rewrite and greatly modify parts of a legacy COBOL application. The COBOL source-code is available (around 100.000 lines of copy & pasted code mixed with GOTOs).
Some more details on the system: It is a general management system controlling transactions, bank management, customer data and employees of the company I work for. T...
Hi, i've had a go at converting this little bit of C code to ARM vfp assembler
can anyone see any problems with it or possible improvements
for(int j=0;j<count; j++)
{
output += array[j]*(*p++);
}
to this VFM assembly:
for(int j=0;j<count;j++){
asm volatile(
VFP_VECTOR_LENGTH(8)
...
I am on a Mac with Snow Leopard (10.6.3). I hear that the assembly language I work with has to be valid with the chipset that you use. I am completely new to this I have a basic background in C and Objective-C programming and an almost strong background in PHP. I have always wanted to see what assembly is all about.
The tutorial I'l...
Dear all,
Is there a way using C or assembler or maybe even C# to get an accurate measure of how long it takes to execute a ADD instruction?
...
Hi, I have written some gcc ARM inline assembly in iphone sdk 3.1.2
however the breakpoints don't get hit (infact anywhere in the c file that contains it). How can i debug it?
Thanks
...
I am an experienced C/C++ programmer and have worked with assembly and many other programing language and I want to start a project as a learning process. I want to try and run a simple custom os on the iphone or ipad. What knowledge would I need to do this, and how does the iphone or ipad bootloader load the os and how could I modify it...
I'm trying to learn this basic thing about processors that should be taught in every CS department of every university. Yet i can't find it on the net (Google doesn't help) and i can't find it in my class materials either.
Do you know any good resource on how addressing modes work on a physical level? I'm particularly interested in Inte...
I need to do a linear interpolation over time between two values on an 8 bit PIC microcontroller (Specifically 16F627A but that shouldn't matter) using PIC assembly language. Although I'm looking for an algorithm here as much as actual code.
I need to take an 8 bit starting value, an 8 bit ending value and a position between the two (Cu...