Skip to main content

All Questions

Tagged with
1 vote
0 answers
32 views

Unable to compile NASM without -no_pie on macOS

I'm trying to follow the tutorial for NASM and I made a few adjustments (like changing the entrypoint function from "start" to "_main") to get the following hello.asm to compile ...
Christopher Rybicki's user avatar
0 votes
0 answers
49 views

How can I get this STDIN to work in GAS Assembler running on Linux?

I am new to Assembler and am currently reading a book about it by Jonathan Bartlett called 'Learn to Program with Assembly'. On pages 160-1 he gives the following sample program to demonstrate the use ...
Digital Samizdat's user avatar
0 votes
0 answers
30 views

Why is my assembly code giving extra output? [duplicate]

Before I start, it's important to say I am a complete beginner to Assembly, so I might be missing something very obvious. I was trying to make an Assembly program where it prints the following output ...
Spyros's user avatar
  • 101
1 vote
0 answers
48 views

Assembly jump instructions don't seem to work

bits 64 default rel section .data fmt db "%s", 0xd, 0xa, 0 err db "Correct usage: echo <string>" section .text extern printf extern ExitProcess global ...
Angad Warhadpande's user avatar
3 votes
0 answers
51 views

How to pass arguments to a windows syscall in NASM assembly? [duplicate]

I am learning how to implement direct system calls using nasm assembly and c code, I have created a funcs.asm that contains section .text global NtOpenProcess NtOpenProcess: mov rax, 26h ...
RAT's user avatar
  • 199
4 votes
0 answers
59 views

Why does Intel x86 manual use +rd instead of +ro or +rq for 64-bit registers?

The description of the PUSH instruction in the Intel manual (PDF, Volume 2, Chapter 4.3, PUSH) contains the line 50+rd PUSH r64. It seems +rd is used throughout most of the instruction descriptions ...
user2468852's user avatar
0 votes
1 answer
47 views

Debugging assembly to call IUnknown::Release - is shadow space right?

I am getting a bug where sometimes this code works sometimes it does not: 48 8B 41 08 ; MOV RAX, [RCX + 0x08] gets the refcount 48 FF C8 ; DEC RAX ; decrement ...
Greedo's user avatar
  • 5,355
1 vote
0 answers
64 views

How to Fix IMUL and DIV Errors in Assembly Calculator Code?

I'm currently learning assembly language and trying to write a simple calculator program. The program is supposed to read two numbers and an operator (+, -, *, /) from stdin, perform the specified ...
권민서's user avatar
3 votes
1 answer
63 views

How to get NASM to encode `push` with a sign-extended 16-bit immediate?

When assembling the following with NASM: BITS 64 push 32767 I get 68 ff 7f 00 00. This is interesting to me, since this is the 32b encoding (push dword). Any ideas why it doesn't resort to the 16b ...
Goubermouche's user avatar
1 vote
0 answers
66 views

Assembling with gcc gives error operand type mismatch for `cmp' for some integers, not others

This is a weird one. I'm using gcc to assemble a program and I want to know if the value in register rsi fits in 32 bits, so I use this instruction: cmpq $0xffffffff, %rsi I get back an error that ...
Kenshi's user avatar
  • 11
1 vote
1 answer
77 views

Working with 64-bit products and quotients of 32-bit integers in assembly x86-64

Starting to learn assembly x86-64, I'm writing a program that gets an array of integers and does some calculations on it. The purpose isn't relevant to the question, but the calculations include ...
Newlearner826's user avatar
2 votes
0 answers
45 views

(x86_64 NASM) Why is my program returning 0 instead of 256? [duplicate]

This is my first assembly code: ;program name - first.asm section .data ;stores initialised var section .bss ;stores uninit var section .text ;actual code global _start _start: mov eax,1 mov ...
Angadh's user avatar
  • 21
2 votes
1 answer
75 views

ModR/M Historical Notation /0.../7

While learning about x64, I struggled to understand some notations in the intel manual. Let's look at 0xC7 MOV: opcode instruction Op/Enc Description C7 /0 iw MOV r/m16, imm16 MI Move imm16 to r/m16....
ton's user avatar
  • 4,349
-1 votes
0 answers
53 views

Why does gcc not allocate space for local variable in this example? [duplicate]

This is the C code I compiled with gcc - #include <stdio.h> #include <stdlib.h> int sum(int arr[20]) { int s = 0; for (int i = 0; i < 20; i++) s += arr[i]; return s;...
Irtiaz Kabir's user avatar
-4 votes
0 answers
108 views

Why does the first code cause a segmentaiton fault while the later one doesn't?

I'm self-studying csapp, and currently stuck at level-3 of Attack Lab. This lab requires you to inject some code by a 40-byte input string. The basic idea is that you input a 48-byte string, with the ...
Bicheng's user avatar
  • 735

15 30 50 per page
1
2 3 4 5
308