Questions tagged [yasm]

Yasm is a modular assembler intended as a full rewrite of the Netwide Assembler (NASM). It is licensed under a revision of the BSD licenses.

172 questions
5
votes
2 answers

The effect of code alignment in timing main loops in assembly

Let's say I have the following main loop .L2: vmulps ymm1, ymm2, [rdi+rax] vaddps ymm1, ymm1, [rsi+rax] vmovaps [rdx+rax], ymm1 add rax, 32 jne .L2 The way I would time this is…
Z boson
  • 32,619
  • 11
  • 123
  • 226
5
votes
2 answers

Simple asm program with yasm in MacOS Mountain Lion

I want to compile and execute a very simple program in 64 bit. section .text global _start _start: mov rdx,len mov rcx,msg mov rbx,1 mov rax,4 int 0x80 mov rbx,0 mov rax,1 int 0x80…
ssedano
  • 8,322
  • 9
  • 60
  • 98
4
votes
0 answers

compiling ffmpeg with libvpx, unable to find decoder

I am trying to compile ffmpeg with libvpx support on Windows with Visual Studio compiler. I am using msys2 for building platform and running flowing commands for libvpx cd libvpx ./configure --prefix="$HOME/ffmpeg_build" --target=x86_64-win64-vs16…
mr.Nobody
  • 165
  • 7
4
votes
1 answer

Wrong size of compiled bootloader

I am making a bootloader, but it generates a 513 byte output file whereas it should be 512 bits. Here is boot.asm [ORG 7C00] [BITS 16] mov eax,cr0 or eax,1 mov cr0,eax [BITS 32] mov ax,10h mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ss,ax INT…
4
votes
0 answers

How to build libmpg123 using the Visual C++ port with YASM?

According to the answer to this question, the first method says that you can build it from the source code (provided in the ports folder) which is more flexible than the second option (which can only generate a dynamic library, not a static…
Ruks
  • 3,886
  • 1
  • 10
  • 22
4
votes
2 answers

Yasm with 64-bit instructions

I'm trying to assemble some assembly source code for x86_64 written in Intel syntax that uses 64-bit registers. I use the following command line flags: yasm foo.asm -a x86 -m amd64 I keep getting errors like: warning: `rbp' is a register in 64-bit…
Siler
  • 8,976
  • 11
  • 64
  • 124
4
votes
2 answers

Building x264 with YASM: failing the ASM check

My question up front is, "I have new yasm, I think x264 is supposed to be cool with that, why is x264 not cool with that?" For reasons, I am building a CentOS docker image (based on centos:latest) that contains a from-scratch ffmpeg build, following…
4
votes
0 answers

fmul to st1 gives "unexpected `,' after instruction"

When disassembling the .com file for the Color Dream demoscene production with ndisasm, I get the following output: $ ndisasm color_dream.com | grep "fmul to" -B3 -A3 -m1 00000033 D9C1 fld st1 00000035 B00D mov…
Alexander
  • 9,737
  • 4
  • 53
  • 59
4
votes
1 answer

YASM assembly calling stdout.write in jitted function

I'm trying to write a just-in-time compiler and I have a piece of code that just doesn't want to work. My platform is x86-64 ubuntu. I have the following code written in yasm: bits 64 mov rdx, 1 mov rcx, 'A' mov rbx, 1 mov rax, 4 int 0x80 ret So…
freakish
  • 54,167
  • 9
  • 132
  • 169
4
votes
3 answers

How to avoid stdin input that does not fit in buffer be sent to the shell in Linux 64-bit Intel (x86-64) assembly

Edit: Title changed, as @Gunner pointed out that this is not a buffer overflow. In reading user input from stdin with NR_read in Linux 64-bit Intel assembly, I wonder how can I avoid that the input that does not fit in the input buffer being sent to…
nrz
  • 10,435
  • 4
  • 39
  • 71
4
votes
2 answers

Segmentation fault in NASM assembly code

My assembler is YASM and I am coding on 64-bit Linux. I assemble using yasm -f elf -m amd64 -g dwarf2 filename.asm and link using ld I'm trying to implement selection sort. rdi and rsi are pointing to various parts of a strbuf2 resb 10 array. What…
InvalidBrainException
  • 2,312
  • 8
  • 32
  • 41
3
votes
2 answers

Setting breakpoints in GDB on a program build with YASM -g dwarf2 changes program behaviour and segfaults or SIGILL

I'm trying to work out if a string is a palindrome or not in Assembly. Essentially I attempt to copy the bytes backwards from string 'my_string' to 'tmp_str'. Then I attempt to compare both strings use repe and cmpsb. The problem I'm facing is that…
Salih MSA
  • 120
  • 1
  • 7
3
votes
1 answer

Why is yasm generating incorrect debugging information?

I have an x86_64 assembly program I'm trying to debug on Linux, but when I try to use gdb, it skips around randomly and loops through the same couple instructions or repeats instructions. It also seems to loop through different instructions…
3
votes
1 answer

In yasm how do I specify a 16-bit near jmp when targeting 32-bit code?

I'm trying to get yasm to output a 16-bit near relative jmp. Specifically, it would be a rel16/rel32 jmp opcode with an operand size override prefix. I know jmp short label will emit an 8-bit near relative jmp, and a jmp long label will emit a…
Earlz
  • 62,085
  • 98
  • 303
  • 499
3
votes
1 answer

GDB: Printing binary values omits leading zero?

I'm writing some simple assembly programs with the y assembler. However, I've noticed that although I can examine binary values in memory just fine, printing them (in the registers) omits a leading zero. This keeps catching me off guard, and so I'm…
Micrified
  • 3,338
  • 4
  • 33
  • 59
1
2
3
11 12