All Questions
Tagged with assembly inline-assembly
1,184
questions
1
vote
1
answer
54
views
gnu inline assembly constraint `i` for memory address
Recetly, this function rip_rel_ptr has been added to Linux kernel.
https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/asm.h#L118.
I can compile the kernel, but when I copy this ...
2
votes
1
answer
79
views
how do I turn AT&T syntax into intel syntax?
In AT&T syntax you can do something like asm("mov %%eax, %0\n\t":"=r" (a[0])); but not in intel syntax.
I want to translate this AT&T syntax to intel syntax, it gets the ...
-1
votes
3
answers
94
views
Code in assembler, which must calculate the scalar product
Im new with an assembler.Couldn't find the solution in the ethernet so asking here. This code outputs wrong numbers and i can't get why.
#include <iostream>
long DotProduct(short int* vec1, ...
0
votes
1
answer
93
views
error: ‘asm’ operand has impossible constraints
I want to calculate length of the word, but I have error. I don't understand why.
int new_strlen(char* word)
{
int len = 0;
__asm__ ("mov ecx, 100\n\t"
&...
2
votes
0
answers
85
views
ASM register-variable from existing register-value in clang
I'm having slight issues with trying to use register-variables in clang-cl, on windows. I'm trying to declare a variable that simply reuses a (non-volatile) register that has been setup by a prior ...
1
vote
1
answer
46
views
where could there be a mistake in my assembly language code
I have a program written using assembler insertion in c++ visual studio. I want to arrange it as an assembler procedure in visual studio. And I can't understand why I'm counting incorrectly. I think ...
2
votes
1
answer
101
views
How to get PC of first instruction of inline asm block (C)?
I am writing code for a RISCV microcontroller.
I am searching for a trick to get the program counter (PC) of an extended inline asm block, from a file different from the inline asm itself. Note: this ...
0
votes
0
answers
100
views
Program in C++ that calculates the sum of unsigned char array of 80 elements using MMX instructions through inline assembly programming
`I am trying a program in C++ that declares an unsigned char array of 80 elements and initializes every element with "1." The program then calculates the sum of these 80 elements using MMX ...
0
votes
1
answer
162
views
Why is this inline ASM function adding the first input operand twice? [duplicate]
I'm a beginner to assembly and a novice programmer in general. I'm trying to wrap my head around the basics of assembly by writing some basic inline asm functions in C++. I'm compiling with GNU g++, ...
1
vote
0
answers
89
views
Issues when using extended asm in C on Mac M1
I'm trying to use extended assembly on MacOS (Apple M1). I run into a very un-understandable issue, here is my code :
#include <stdio.h>
int main(void)
{
int a = 1;
int b = 0;
...
1
vote
1
answer
263
views
SIGSYS Bad System Call (Android)
I am writing some inline assembly code for Android and while stepping through the code using GDB in an x64 Android emulator, I see the syscall I tried to execute got a SIGSYS Bad System Call error. I ...
2
votes
0
answers
249
views
How to write _start function to call the main function in C
By using inline assembly asm volatile, how can I implement _start function in C which can call the main function
int main(int argc, char *argv[], char *envp[])
I tried alot, but it didn't work at all,...
4
votes
2
answers
263
views
How to mix c code and asm in a c-function?
I like to do some optimisation and so I like to substitute a line of c code with 2 lines of assembler.
rb->am += N
the ringbuffer struct rb gets incremented by an variable N
I am struggling to get ...
1
vote
1
answer
88
views
Cannot specify the operands when using inline asm outside a function
My code is
unsigned long user_stack_pointer;
__asm__(
".global exception_handling_entry\n"
"exception_handling_entry:\n"
"add %0, sp, x0\n"
: "=r&...
-1
votes
1
answer
125
views
Can somebody translate this ASM instruction code for Cortex M7?
" mrs %0, ipsr " : "=r" (reg_tmp)
I need to translate this ASM code out-of-curiosity, it is for ARMV7 specifically cortex-M7 executing in privileged mode. I know MRS instruction ...