x86

How does Windows switch to supervisor mode during a system call?

How does Windows switch to supervisor mode during a system call? I heard something about a "trap 0", but that doesn't even seem like an x86 instruction. I stepped through some system calls, but I can't find any. Do a lot of Windows system calls run in user mode? Which DO run in supervisor mode? ...

Fastest way to convert binary to decimal?

I've got four unsigned 32-bit integers representing an unsigned 128-bit integer, in little endian order: typedef struct { unsigned int part[4]; } bigint_t; I'd like to convert this number into its decimal string representation and output it to a file. Right now, I'm using a bigint_divmod10 function to divide the number by 10, kee...

Translate a FOR to assembler

Hi everyone, I need to translate what is commented within the method, to assembler. I have a roughly idea, but can't. Anyone can help me please? Is for an Intel x32 architecture: int secuencia ( int n, EXPRESION * * o ) { int a, i; //--- Translate from here ... for ( i = 0; i < n; i++ ){ a = evaluarExpresion( *o ); o++; ...

How to translate "pushl 2000" from AT&T asm to Intel syntax on i386

I'm trying to translate the following from AT&T assembly to Intel assembly: pushl 2000 Now this compiles down to: ff 35 d0 07 00 00 pushl 0x7d0 But no matter what I try, I cannot get the same in Intel synax, I've tried: intel asm disassembly after compiling to at&t push 2000 68 d0 07 00 00 push $0x7d0 push [200...

Left Shift Overflow on 68k/x86?

I heard that the Motorola 68000 and Intel x86 architectures handle overflow from left shifting differently. Specifically the 68k LSL vs. the Intel SAL/SHL assembly instructions. Does anyone know the specifics of this? Do they set different flags, or set them differently? I tried to look this up in the reference manuals, but I don't see ...

32bit application access to 64bit registry

I have an OS Shell written in 32bit that is replacing the Explorer.exe of a Vista machine. I run a utility which is also written in 32bit, which allows to switch between the Explorer shell and My shell. With some of the machines being 64bit based I can not Alter the HKLM\Microsoft\current\shell Key (short formed reg key). I end up gettin...

x86 Assembly: What's the main prologue and epilogue?

Hello, I'm following this tutorial on x86 assembly. Every example so far uses what the author calls a "c-driver" program, compiled with the assembly module, for means of some "initialization". Something like: int main(void) { int ret = asm_main(); return ret; } And then the asm_main function is written normally, using a C calling...

save inline asm register value to C pointer, can get it on GCC but not VC

hi there, for the sake of simplicity ill just paste an example instead of my entire code which is a bit huge. while im porting my code to VC++ instead of using GCC i need to rewrite a few inline assembly functions that receive pointers and save values on those pointers. imagine cpuid for example: void cpuid( int* peax, int* pebx, int* ...

Disassemble into x86_64 on OSX10.6 (But with _Intel_ Syntax)

I know of otool -tv, but I would much rather use the Intel syntax rather than AT&Ts, mainly to easily follow along in a book and not have to look over thousands of %'s and $'s. I'd also appreciate any tips to where I might find gdb's config file. EDIT: I forgot: I'm running a 64bit processor, but was wondering if it would be possible...

Differences Between ARM Assembly and x86 Assembly

Hello, I'm now going to learn ARM Assembly, to develop for my Windows Mobile 5 iPAQ, but I have some questions: What Are The Main Differences Between ARM Assembly and x86 Assembly? Is Any Differences In The Interrupts(New Types)? Which Are They And What Is The Meaning Of They? Best Assembler To Compile And Where To Get It? Where ...

How do I disassemble raw x86 code?

I'd like to disassemble the MBR (first 512 bytes) of a bootable x86 disk that I have. I have copied the MBR to a file using dd if=/dev/my-device of=mbr bs=512 count=1 Any suggestions for a Linux utility that can disassemble the file mbr? ...

Which assemblers currently support the AVX instruction set?

I'd like to start and play with some AVX (advanced vector extension) instructions. I know Intel provides an emulator to test software containing these instructions (see this question), but since I don't want to manually write hex code, the question arises as to which assemblers currently know the AVX instruction set? I would be most in...

Illegal instruction in ASM: lock cmpxchg dest, src

I've been messing around with some x86 assembly as its come up in a number of my classes. In particular, I've wanted to expose compare-and-swap (CAS) as a user function. This is with the intent that I can implement my own locks. I'm using Linux 2.6.31 with GCC 4.1.1 on an Intel CPU. I have the following: // int cmpxchg(int *dest, int ...

LOOP, LOOPE, LOOPNE?

Can anyone please explain me the difference between the assembly instructions LOOP, LOOPE and LOOPNE. Thanks. ...

Utilizing the LDT (Local Descriptor Table)

I am trying to do some experiments using different segments besides the default code and data user and kernel segments. I hope to achieve this through use of the local descriptor table and the modify_ldt system call. Through the system call I have created a new entry in LDT which is a segment descriptor with a base address of a global va...

Assembly and System Calls

Im having a bit of trouble understanding the more complex system calls in assembly. I wrote a exec system call and it worked great .bss .text .globl _start _start: #exit(0) system call movl $1, %rax movl $0, %rbx int $0X80 Though I am a bit insure and have not been able to find info pertaining to how you...

x86 asm instruction set: Any _searchable_ offline reference?

I'm somewhat new to assembly and have to look up the x86 instructions every now and then. Searching the web for every other opcode gets annoying after a while. Then there are the Intel Reference Manuals, but the contents page doesn't have direct links to the various sections in the pdf file, and doesn't list the 'true' page name but inst...

Is there a complete x86 assembly language reference that uses AT&T syntax?

Ideally there would be a version of Intel's Software Developer's Manuals written in AT&T syntax, but I would be happy to find anything that is close enough. ...

How is the x64 architecture different from x86

I need to mess around with the stacks on these architecture and am really a n00b here. Any pointers to reading topics/google searches that i can do. I am looking for how these architectures are fundamentally different from each other. something more than the wikipedia article on this topic http://en.wikipedia.org/wiki/X64 ...

MASM32 What does 'default code distance mean'?

Dear All, This symbol used in MASM32: @CodeSize Returns an integer representing the default code distance. I'm trying to understand what 'default code distance' means? Tony ...