assembly

Exception handling

I was trying to write a code to handle exceptions, but overriding another exception handler, is it possible? I was developing an exe in asm to debug a dll, and detect some exceptions that are raised (access violation) but the dll has its own exception handling, so a normal SEH should not work, i would like to know if there is any kind o...

x86 opcode encoding: sib byte

Im currently trying to write a disassembler. I found the following list of opcodes and their meanings, so i decided to parse it at runtime: http://mprolab.teipir.gr/vivlio80X86/pentium.txt But i am stuck at the opcode 0x00: It is followed by a reg/modbyte. Parsing it was not much of a problem for me. But i'm having trouble with the Scal...

X86 Assembly - accessing a chip

Dear all, Lets say that my GPU includes a chip called ADT7473. I am interested in receiving information from this chip about the temperature of my card. My question is, how to access this chip? is that accomplished using the IN/OUT instructions? EDIT: I might add those lines found in the chip's documentation : Table 18. Temperatu...

whats this in the code????

I m developing a bootloader for which i have a bin file whose assembly is somewhat like this.. -u 0 200 141A:0000 CD20 INT 20 141A:0002 FF9F009A CALL FAR [BX+9A00] 141A:0006 EE OUT DX,AL 141A:0007 FE1D CALL FAR [...

Assembly at&t doubt

What's mean lea 0x4(%esp),%ecx in at&t assembly? What really is 0x4(%esp)? ...

order and barrier:what is the equivalent instruction on x86 for 'lwsync' on PowerPC?

My code is simple as below.I found rmb and wmb for read and write,but found no general one.lwsync is available on PowerPC,but what is the replacement for x86?Thanks in advance. #define barrier() __asm__ volatile ("lwsync") ... lock() if(!pInst); { T* temp=new T; barrier(); pInst=temp; } unlock...

Execute data as code?

My client asked me to write an custom encrypted executable to prevent easy cracking of the licensing system. Now, I understand that this is a false sense of security, but despite this he insisted on it. So, I dug up my knowledge of portable executables and came up with this idea: Encrypt the executable Stick this to the end of a loa...

Borland c++ inline asm problem with WORD PTR and string

Hello, I am writing small kernel for the 8086 processor (Working in BC3.1, on Windows XP as host operating system). Kernel is multithreaded, so I have problems when I use printf or cout for debugging (somewhere in code, printf sets InterruptEnable flag to 1, and my timer interrupt routine calls dispatch and my code breaks down). Becaus...

shifting left and then immediately shifting right in asm?

disclaimer : I'm an asm newbie. I probably need to review my 2s complement or something to fully comprehend :( I'm confused as to the purpose of the following: .... BL some_func MOV R3, R0,LSL#16 MOVS R3, R3,LSR#16 .... why the shift back? and the movs? ...

Patching Arm Executable?

Hi, I must patch an arm executable in my Pocket PC. I am dissassembling the ARM executable with IDA Pro. But I can not edit binary. As you know Ollydbg let us to edit binary / add assembly code (Right Click->Assemble) But it doesnt support ARM. So I dissassembly it with IDA Pro. But in IDA , I can not add my assembly code into my ARM E...

Assembly memory allocation

I am trying to learn assembly language and I need clarification on something. Please correct me if I am wrong on any of this since I don't know much about assembly. All the tutorials I watch have the variables of assembly programs assigned to a memory address like 0x0000, and I can understand that you must manually assign memory addres...

Learning PIC assembly language in order to learn 8086

Should I start learning 8086 assembly language by learning assembly language of a processor with a reduced instruction set like one of PIC family? ...

modulus in assembly

Hi, I am learning assembly language. Is there modulus operator in assembly? I know I can find the remainder using the formula Number= Divident * Divisor + Remainder. I have heard when we use the DIV syntax the remainder is stored in one of the register? Edit 1 : I am using Intel x86 Architecture and devloping it on Ubuntu. Thanks....

Logical error in prime numbers.

Hi, I am new to assembly language. I have written a program for taking an input and then displaying whether the number is prime or not. Here is my source code. .intel_syntax noprefix .include "console.i" .data Num: .long 0 .text ask: .asciz "Enter a +ve number : " ansp: .asciz " is prime." ...

where can i find the codes for the machine instructions...

i mean...nop is 90, push is 55 ...the others?any link?i google it but nothing came out... ...

Why spinlock in linux kernel is in the ".subsection 1" (or ".text.lock.smth")?

Hello In linux kernel in the implementation of spinlocks, e.g. http://lxr.linux.no/#linux+v2.6.18/include/asm-i386/semaphore.h#L97 97static inline void down(struct semaphore * sem) 98{ 99 might_sleep(); 100 __asm__ __volatile__( 101 "# atomic down operation\n\t" 102 LOCK_PREFIX "decl...

Linux Assembly reference

I am reading the book "Professional Assembly Language", with sample code written for Intel IA-32 processors. Assembler used is GNU Assembler. Where can I find this Assembly reference? For example, writing Assembly for Windows, I can find the reference in Intel WEB site. What about Linux and GNU Assembler? ...

Assembly language - More than one type?

I start university in a few weeks (software engineering degree) and know that one of the modules I'll be studying in the first year is 'fundamentals of architecture' or something similar; basically it's learning to program in 'assembly'. I'm wanting to do some background learning so I'm prepared for it (I've done the same on some other ...

Microchip's MPLAB IDE equivalent for 8086 assembly

I always wanted to learn 8086 assembly but was (and am) a little confused on where to start. We are learning PIC16F690 at the moment in school and I'm good at it. So I guess I can give 8086 a try. I'm wondering is there an IDE for 8086 like MPLAB IDE where in it you can write code and execute instructions line by line and watch memory, r...

Why Inline asm in C++/CLI creates horrible problem?

Hello, I am using Inline asm in C++/CLI. Horrible problem infact could be a bug I obsereved. I passed vector from one function call to another. If I comment the whole code snippet of _asm{....some assembly code here} inside the called function where vector used which are provided to it from other function, then no problem whole vector...