assembly

How to add assembly code in Linux

I am writing a Linux kernel module on Fedora core 6 and I am wondering if anyone could tell me how to add the assembly code shown below to my program. The assembly code was written for Windows and I have no idea how to convert to Linux kernel program. #ifdef _MSC_VER unsigned char lookKbits(char k) { _asm { mov dl, k ...

Using SSE instructions

I have a loop written in C++ which is executed for each element of a big integer array. Inside the loop, I mask some bits of the integer and then find the min and max values. I heard that if I use SSE instructions for these operations it will run much faster compared to a normal loop written using bitwise AND , and if-else conditions. M...

Switching to assembly in gdb

Is there is any way to switch to assembly when debugging a C or C++ program in gdb ? (Given that all source files and their corresponding assembly files are available) ...

equivalent number of instruction

Hi everybody, I've a question (just like me)... but...if I've a choosen algorithm written in C or C++ or whatever code you want...fixed a compiler I can determine the number of instructions but these intructions are different each other: x ADD, y MUL, z MOV, f FADD, t FMUL (F stands for FLOATING)...Is there a methodology or equation or ...

Transition between processors.

I'm writing mostly embedded code at work. We have a big long-term project that's been developed, and has several generations, and now the processor for which it was written is being discontinued and it might be impossible even to continue using processors from the same manufacturer. (The transition will be probably from TI to Renesas FPU...

can we modify the int 0x80 routine

how does linux 2.6 differ from 2.4? can we modify the source kernel ? can we modify the int 0x80 service routine? ...

How can I best pass a Global Offset Table (GOT) for my language on x86?

I'm writing a small program loader for my language because I gave up on understanding ELF format (and while doing this, I may eventually understand it better). I mmap the files on the memory and tux rejoices whatever.. I don't want to hinder the sharing of the program by doing any changes on it. Therefore I end up doing the same as C an...

Numerical optimization...

Hi there I was wondering which Integer or Float types are the fastest.. i was thinking byte is faster than integer because it has a smaller range. Some people told me .. that in some cases integer is faster than a byte. second question : The GPU is on his way to World Domination .. so i asked myself : Can a Double "be faster" than a I...

Finding a function in a disassembly.

I'm busy following a tutorial where the author uses DUMPBIN to list exports, and OllyDbg to get the assembly code for an exported function. How would I find the functions code in the complete disassemly, given that the export tables RVA's don't correspond to real addresses in the disassembly. ...

Reading Program Counter directly

Can the program counter on Intel CPU's can be read directly (that is without 'tricks') in kernel mode or some other mode? Thanks :-). ...

What is anulled branch different from regular branch instructions?

For SPARC Assembly particularly, how are anulled branches different from regular branches? I always thought that anulling branch instructions is required when I need to fill the nop delay slot for branch instructions. However, I don't think I'm correct on this part, because you can fill the nop without anulling the branch. ...

Programming graphics in assembler?

I've developed a running Super Mario Sprite using Visual C++ 6.0 and DirectX. But this isn't very satisfying to me (raping a 3D-Multimedia-framework for displaying a 2D sprite only), so I would like to be able to program an animated sprite using C and assembler only. So, when looking to old games (Wolfenstein, for example) it looks that...

D function using the x86 CMPXCHG Compare-and-swap

I'm looking for a function that presents a high level D interface to an atomic CAS on Intel x86. I know I can do it with inline ASM (and if needed I will), but I'd rather just grab code from someone else if I can. ...

Why is memory area $1020 unwriteable on M68HC12 with staa?

I have the following asm code: org $1000 ;Table Origin is at $1000 fcb $02,$04,$06,$08 ; values of table from $1001 - $1004 fcb $0a,$0c,$0e,$10 ; values of table from $1005 - $1009 org $400 ; Program Start lds #$4000 ; Set Stack Pointer at value (#) $4000 ldy #$1000 ; ...

what is wrong with my version of _bittestandset

I am new to assembly language. It seems that gcc doesn't have _bittestandset function in intrin.h like MSVC does, so I implemented a new one. This one works fine in linux, but it goes wrong with mingw in winVista machine, the code is: inline unsigned char _bittestandset(unsigned long * a, unsigned long b) { __asm__ ( "bts %1, %[b]" ...

Which x86 assembler do you use?

For anyone who works with x86 assembly, I'm curious which assembler you use. Preferably, the name should be an acronym and end in "ASM" =) ...

How to find a method in assembly code

From a memory leak log I have the following info: TestApp.exe! + 2238ch Let us say this means that method at offset '2238c' (hex value) is leaking. How can I locate the corresponding method in my source code? I have the linker map (testapp.map) but not sure how to use it. This is a C++ application compiled in VS2008. ...

Translating Java bytecode into other representations and programming languages

I'm looking for ways/tools/projects to translate Java bytecode into other programming languages or, failing that, at least into a structured representation (like XML). Ideally open source, naturally. I've looked at ASM, the "bytecode manipulation and analysis framework". It doesn't support translation to other representations, but looks...

Copying and calling Functions in x86 AT&T-Assembler in gcc

I wrote the following code in AT&T Assembler Syntax for gcc .global main .section .data to_gen_inner: #x f, implicit n pushl %ebp movl %esp, %ebp movl $0xFF00FF00, %eax call printregs lret .set to_gen_inner_len, . - to_gen_inner .section .text main: pushl %ebp movl %esp, %ebp ...

How do I know if gcc agrees that something is volatile?

Consider the following: volatile uint32_t i; How do I know if gcc did or did not treat i as volatile? It would be declared as such because no nearby code is going to modify it, and modification of it is likely due to some interrupt. I am not the world's worst assembly programmer, but I play one on TV. Can someone help me to understan...