Assembly Questions
Ad
const variables in local and global scope in assembly
I've compiled the following c code in compiler exporer to see how it handles
Example of a static vs automatic variable in assembly
In c, we can use the following two examples to show the difference between a static and non-static variable: for (int i = 0; i <
Do I need an atomic if a value is only written?
Suppose i have several threads accessing the same memory location. and, if at all, they all write the same value and none of them reads it. after
Protostar Stack6 - Segfault for no reason?
So i am doing the protostar challenges from exploit
Default value of _start
Let's say i have the following assembly program: .globl _start _start: mov $1, %eax int $0x80 and i
Return values in main vs _start
Note, this question already has similar answers here, which i want to point out to:
ASM inline assembly bubble sort; constant value required, garbage at end of line
I have an arduino mega program written in c that populates an array with random integers, then calls a bubble sort algorithm written in asm inline
set a bit with inline asm without btsl instruction
I want to set a bit at position p without using btsl instruction with inline asm gcc c code. using btsl instruction is simple: int
The x86 disassembly for C code generates: orq $0x0, %(rsp)
I have written the following c code:
Ad
Is there a difference between the address operator and a pointer in assembly?
Does the compiler translate the address operator any different than a pointer? i'm wondering because the decompiler sometimes shows me:
Question about memory process and function sharing
1)why cant we use virtual address in c instead variable for example instead writing int x ; we may create a pointer to the first address in the
Port React app to Blazor app with JavaScript library imported using JavaScript interop
I currently have a react app that i'm trying to convert to a blazor webassembly app. the react app has a component that imports a javascript
How to use adress returned from call
Everybody! i'm trying to make some project using assembly functions, which call from c. in c, i use errno.h. so i want to write errors,
How to prove that AND instruction is faster than IDIV on a commodity Intel x86
To the best of my understanding, on intel x86 (e.g., ice lake micro-architecture) i could expect and for two unsigned integers to be
EM_JS: How to convert int argc, char **argv to a JS array of strings?
I'm trying to call js function from c/c++ with an array of strings as an argument. here's my example code:
How to find out the value of an inline constant while debugging a C program with GDB?
Assume i have a compiled binary program, without debug symbols, with a source code similar to this in c: char code[] =
function returns address of local variable, but it still compile in c, why?
Even i get an warning a function returns an address from local variable, it compiles. isn't it then ub of compiler? the generated
`clflush` of large memory area doesn't flush?
I want to try to measure timing differences of memory accesses, when accessed from the cache and when accessed from the main memory.
Running address of an application, followed by heap and stack expansions
I have an m.c: extern void a(char*); int main(int ac, char **av){ static char string [] = "hello ,
How to get bits of specific xmm registers?
So i want to get the value or state of specific xmm registers. this is primarily for a crash log or just to see the state of the registers for
Ad
How to run each "function" in a code section?
I want to be able to declare function so that they are added to a specific code section and then they are all executed before my start function.
Understanding some cc1 parameters
Running $ gcc -v results in the first command being a cc1 command. first of all, where can i find what all the
How do I get the assembler output from a C file in VS2005
I think the file that is produced is an .asm file, any idea how to produce this in visual studio when you do a build?
why callees don't use caller saved registers first?
We know that by x86-64 convention, registers %rbx, %rbp, and %r12–%r15 are classified as
How to declare local variables in macro asm of gas like decalaring it in macro asm with %local in macro asm of nasm or local in macro asm of masm?
The way to declare local variables in macro asm of nasm is like:%local old_ax:word,and the way to declare local variables in macro asm of masm is
LinkError: WebAssembly.instantiate() function import requires a callable
I am practicing webassembly at
Having trouble outputting both strings on my printf made with syscalls
Working on an college - assembly language c course -assignment where i need to create a basic printf function using only system calls. whenever
What happens at CPU-Level if you dereference a null pointer?
Suppose i have following program: #include <signal.h> #include <stddef.h> #include <stdlib.h> static void
How to call WASI functions directly in C using wasi-sdk (import module problem)
I'm trying to call a wasi function (fd_write) directly in a c program using
Fastest way to take the average of two signed integers in x86 assembly?
Suppose we have two register-length2 signed1 integers, say a and b. we want to compute the value
GCC error: Cannot apply offsetof to member function MyClass::MyFunction
After trying to replace the offset keyword with __offsetof while trying to compile with apple gcc
Ad
Blazor Cannot provide a value for property 'ScopeFactory' on type 'MyComponent' because the property has no setter
I'm writing blazor wasm app in .net 6. the app works as it should in debug when running from visual studio 2022, but when i
Error while modifying mallocated string in a C struct with asm function
I would like to modify a string inside a c structure with an asm function but it is not working properly... let say that i have this type
Why does static_cast conversion speed up my integer division function?
...or rather, why does not static_cast-ing slow down my function? consider the function below, which performs integer
Register allocation rules in code generated by major C/C++ compilers
I remember some rules from a time ago (pre-32bit intel processors), when was quite frequent (at least for me) having to analyze the assembly
Why is there not a register that contains the higher bytes of EAX?
%ax = (%ah + %al) so why not %eax = (%some_register + %ax) for some register %some_register?
Why can't I change the value of a segment register? (MASM)
I decided to teach myself assembly language. i have realized that my program will not compile if i attempt to change the value of any
GCC inline assembler, mixing register sizes (x86)
Does anyone know how i can get rid of the following assembler warning? code is x86, 32 bit: int test (int x) { int y;
WASM&C: Cant find function
File hierarchy: src: main.c main.html main.js out: main.wasm -> compiled file main.c:
x86_64 Inline Assembly ; Copying 64-bit register directly to 64-bit memory location
I am running the code below and suffering from two problems: 1) the moment i change movl (to copy values from registers) to movq i face
"Error: attempt to move .org backwards" using Xtensa XCC, GCC works fine
Here is a minimal reproducible example: /* * example for xtensa xt-xcc compiler "error: attempt to move .org backwards".
STM32 Cortex-M4F FPU hardfaults on basic VLDR
Yes there is a fpu present with my specific mcu. the code is compiled with the -mfloat-abi=soft flag otherwise the float
Ad
Use ngspice library in WebAssembly
I would need some help with using ngspice as a library in a webassembly (wasm) project. i installed emsdk and newest version of emcc
Can I use WebAssembly to safely execute untrusted user code within my web app?
In a web app i am building, i have a need to execute untrusted user code within the app (in the browser). the untrusted code is given a string
Labeling stack local variables (asm)
In an asm function, one can use the stack to create a local workspace for variables. what i am wondering is, can you create labels to
How can I load a file from a HTML input into Emscripten's MEMFS file system?
I have an html input like this <input type="file" id="myfile" onchange="load_file()">. i want to load the file into
llc: Too many positional arguments specified (error generating assembly from llvm-ir)
I am getting an error with llc for llvm, which i just installed on my mac with homebrew. $ llc –o malloc.s malloc.ll
How to output ARM V8 assembly from LLVM IR?
I have this c file: int mult() { int a =5; int b = 3; int c = a * b; return c; } i compile it to llvm ir
Minimal 64-bit Windows executable crashes with tail-call optimization enabled by gcc
I'm trying to create a minimal 64-bit windows executable to better understand how the windows executable format works. i wrote very basic
Why does the compiler copy RDI to another register, and then copy it back to RDI inside a loop?
I'm analysing a piece of inefficient code, but some of it is so confusing? original code:
NEARprotocol: Why is AssemblyScript smart contract development only for non financial use cases?
In the near protocol smart contract development documentation for assemblyscript it says:
x86 division exception-return address
When trying to write some routine in x86 assembly for a boot loader, i came across a bug where when a division error happened, the program would
Ad
Webpack throws error with Emscripten: Can't resolve 'fs'
I'm encountering errors in importing a javascript file into a vue.js component: this is the content of /components sub-folder:
How can I import Emscripten generated .wasm/js files in files created with create-react-app
I have a library i can successfully build & run with the emscripten generated .html files. i'd like to use it with react now,
Get address of a WebAssembly exported function?
Assuming having this c code, int add(int a, int b) { return a + b; } int mul(int a, int b) { return a * b; } void *add_ptr() {
Intel-x86, confused about the allocation of bytes in the esp register
I've been a bit stuck on this question. given the following c code: #include <stdio.h> #define buf_size 13 int foo(){
Overriding weak C function alias with ASM function
I am developing on an arm cortex m3. my ide generates a c source file which includes an isr vector table written in c as a struct of
How do I detect when Emscripten's generated .js finishes loading the wasm so I can run my JS functions which call it?
I'm using emscripten to compile some c code to webassembly. this is the final emcc call in my makefile: emcc $(cflags) iva.a -o
Why the JVM cannot be used in place of WebAssembly?
As far as i understood, javascript cannot be compiled ahead of time because of it's dynamic nature. so interpretation and just in time
Emscripten - Compile to WASM and keep original callable function names in the glue code
Using emscripten v 1.38.43, i'm compiling a c code. for optimization reasons, i've stripped down the generated js glue code and minimize the code
What does "comparison is for a two’s-complement ‘>=’" mean?
I am learning assembly language and got stuck on this point. this is a problem from book "computer system" chapter 3. the problem
Inline assembly in C with a jump and two return statements
I would like to have a void function which prints whether carry (overflow) happened and print the value of the (possibly overflowed)
Debugging WebAssembly with node
Is is possible to debug a wasm module through node? i am using vscode and compiling with emcc -g4 --source-map-base. putting
Ad
Type of adressing mode
I've been stuck trying to figure out the addressing mode of this instruction.if anyone can help me with this it would be appreciated.
Syscall in android NDK
I have tried to use the this syscall macro
What output for a garbage code generator?
I'm in a project groupe about analyzing malware at my university and i have to write a programm that generates garbage code like it used to appear
npm install fatal error with connection to github. webassembly and connection to github failed
I had just started a laravel project and went to go use npm install but it paused at webassembly dependancy and displayed maximum call stack size
Is it expected that a custom component derived from InputNumber<T> only binds one-way?
I created a simple custom blazor component inheriting from inputnumber<t> to contain an input element and some other conveniences (i
Is there any way to generate ELF BINARY using only python library?
Is there any way to generate elf binary using only the python library? i want to assemble the file below using python
Create textures in javascript and WebGL and identify them in WebAssembly
I want to create some
How to get a filename renamed by Webpack?
I'm using a webassembly file compiled by emscripten in my project. and since my project uses webpack, it renames all files, then the emscripten
How to use WebAssembly from node.js?
I am currently working on a personal node.js (>=8.0.0) project which requires me to call c subroutines (to improve execution time). i am trying to
How can I compile a library into WebAssembly that can be called from JavaScript code?
I am experimenting with wasm and i want to encode a pic as webp for a learning experience in wasm. i am attempting to compile
Not able to see disassembled code of if-else statements
I wanted to see how the disassembly of an if-else program written in c looks like inside gdb. to keep things simple, i created the following
Ad
invalid instruction suffix for mov?
I have this piece of inline assembly code that should print a in text mode: void print(){ asm volatile(
Offset before square bracket in x86 intel asm on GCC
From all the docs i've found, there is no mention of syntax like offset[var+offset2] in intel x86 syntax but gcc with the following
How to avoid repetitive syscalls and moves in MIPS Assembly?
Here's a fragment of my code and as you can see the only difference between these three is the move from $v0 to $t0, $t1, or $t2. does anyone know
low register and high register swapped places?
Ideal model small stack 100h jumps p186 dataseg array dw 312, 340, 311, 300 codeseg proc example pusha mov al ,4 ;number of
Assembly executable doesn't show anything (x64)
Very simple assembly introduction code. seems to compile ok through gcc -o prog1 prog1.s, then ./prog1 just skips a
Address in shellcode changing during execution
My goal is to create shellcode that calls winexec and launches notepad.exe. the bare bones code is (although actually
How to change the start/main entrypoint of x86-64 assembly with NASM?
I have this: $ make build read.o: in function `_start': read.asm:(.text+0x0): multiple definition of `_start'
why "guarded do" is better than "jump to middle" in asm
I was reading a textbook which describes two way of translating a while loop into machine code: //jump to middle goto test;
Extra push in OpenWatcom inline assembly
I'm compiling this c source with openwatcom v2 wcc: /* writes a '\0'-terminated string to the file descriptor. */
Should Flutter web use Wasm instead of dart2js
I spotted several articles about wasm being faster then js
Inserting gdb breakpoints fail
I'm learning about buffer overflow in c. for that purpose, i'm following
Ad
Is an extra move somehow faster when doing division-by-multiplication?
Consider this function: unsigned long f(unsigned long x) { return x / 7; } with -o3, clang
Is memcpy a really function with symbol?
This simple c: #include <stdio.h> #include <string.h> int *add(int a, int b){ int ar[1]; int result = a+b;
How can I run a .bin file from the same file inside .iso
I apologize in advance for the bad language, i mainly use a google translator. i decided to do something like my os (naturally, it will just be
Why Interrupts not generates by C code but easy generates by assembly instructions?
I am programming a little kernel, and implement idt and interrupts. this c code in my little kernel not generate any interrupt:
GCC + LD + NDISASM = huge amount of assembler instructions
I'm a newbie to c and gcc compilers and trying to study how c is compiled into machine code by disassembling binaries produced, but the result of
C: Weird label behavior with -O3?
Given this code (minimal example; there's no deeper meaning in it): #include <stdio.h>
Using jQuery DataTable in Blazor WASM
I want to integrate jquery datatable with my blazor wasm project. so i add
stack space for a vector that its size is given at runtime? (C code)
Supose this c code: int main(){ int n; scanf("%d\n", &n); int a[n]; int i; for (i = 0;
Avoiding page faults in IDT hooking
Note: i'm running on freebsd, but i've also included linux as a tag since the problem is somewhat general and linux-specific solutions are
How to assemble ARM instructions (using GCC)
I want to assemble arm instructions (= converting the textual assembly instructions to machine code). i tried using
What does the function insl do in Os Dev's PCI IDE tutorial?
This is the function that call's insl. void ide_read_buffer(unsigned char channel, unsigned char reg, unsigned int buffer,
Ad
How are void pointers implemented?
I was wondering how void pointers are implemented. i tried to find it out on godbolt with x86-64 (you can see it
Execute assembly:single goal during package phase
Below is the pom.xml. when i try running it with mvn package, the fat jar is not getting built. but mvn assembly:single
Ad
Blog Categories
Ad