Questions tagged [assembly]

Tag for questions regarding the wide family of assembly languages both low and high level. It should be used for both the languages themselves as well as their assemblers.

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

Checking the build of each executable, disassembling all the .o files. How to hunt down the xz kind of backdoor elsewhere in Linux distributions? [closed]

You might have read about the backdoor that was released with the xz command (versions 5.6.0 and 5.6.1). A malevolent committer gained the trust of his maintainer, and achieved to insert at build time ...
Marc Le Bihan's user avatar
0 votes
0 answers
56 views

make: *** No rule to make target 'mykernel.bin'. Stop

I'm worrking on an OS but I'm getting this error with my makefile.win. Looks like the linker.ld output file doesn't match the naming convention of the file i'm making (mykernel.bin). Not sure if that'...
Abilaash's user avatar
3 votes
1 answer
82 views

Audio playback from assembly language in Unix?

Looking for a simple audio interface for Unix For fun, I'm learning x86 assembly language by porting an old game. The trickiest part is finding a way to play simple sounds (square waves, mostly). The ...
hackerb9's user avatar
  • 1,579
2 votes
1 answer
225 views

Why does the Linux kernel have its own bootloader

I am trying to work my way through Linux kernel code, and in this file there seems to be a full blown bootloader that bios is expected to run. I was under the impression that generally, grub will be ...
Maslin's user avatar
  • 123
1 vote
0 answers
59 views

perf instruction count

so i've been playing with perf and assembly i have the following program: .intel_syntax noprefix .global _start _start: mov cl, 2 mov ebx, 0b101 shr ebx, cl and bl, 1 je do_stuff ...
Joao Luca's user avatar
0 votes
0 answers
51 views

Linking problem in assembly code

Here is my assembly code: .section .data mystring: .asciz "Hello world\n" .section .text .globl _start _start: pushl $0 pushl $mystring call printf pushl $0 call exit ...
Swapnil's user avatar
  • 47
0 votes
0 answers
40 views

Why does AIX on Power require that the svc instruction must be preceded by an unconditional branch or a CR instruction?

The IBM AIX Documentation for the svc (Supervisor Call) instruction has a note that states To ensure correct operation, an svc instruction must be preceded by an unconditional branch or a CR ...
gorignak's user avatar
0 votes
1 answer
109 views

Terminal syscalls in Assembly

I would like to write a chess engine for Linux. It will be in pure X64 Assembly language without any C/C++ or any other high level languages external libraries. It will run in full screen text/console/...
Danny Cohen's user avatar
1 vote
1 answer
66 views

How do unix systems call into an application?

I am currently implementing a C runtime library for the Arm64 platform, and I am unsure which assumptions I can make about the environment at the precise point that the application is executed (what ...
lte678's user avatar
  • 11
0 votes
1 answer
36 views

How can I en- and decompress a bootable image?

I have a bootable kernel image, that I had created with MinGW Toolchain's that available for Microsoft Windows 11. The Project is in size tiny, but I would know: "How can I shrink the image, if ...
Jens's user avatar
  • 1
0 votes
2 answers
941 views

Assembly code that print to screen without syscall

Is it possible, in Linux, to write an x86 assembly program that print a character to the screen (standard output) without the use of any system call? I think that it is not possible because, in x86 ...
Bender's user avatar
  • 121
0 votes
1 answer
56 views

as .*s does not work like gcc .*c

when i run gcc -c *.c, it runs:- gcc -c file1.c -o file1.o gcc -c file2.c -o file2.o gcc -c file3.c -o file3.o ... but as *.s runs:- as file1.s -o a.out as file2.s -o a.out as file3.s -o a.out ... ...
user135142's user avatar
0 votes
2 answers
245 views

A better disassembler than `objdump -d`?

I notice when using objdump -d, it outputs the assembly (in either Intel syntax or AT&T syntax), the binary opcode encodings and the address numbers. In my case, I just want the disassembler to ...
user135142's user avatar
0 votes
1 answer
47 views

Why does assembler called from script not create a certain file when run from crontab?

I'm using this script to build and package some applications I developed. Full content of the script is listed at the end. It is called by this crontab entry: 50 23 * * * nice $HOME/update-dl-wwwecm $...
ecm's user avatar
  • 133
0 votes
0 answers
115 views

How to disassemble floppy disk?

I want to disassemble floppy disk and assemble it again with nasm -f bin command. For example, I want to disassemble MS-DOS .img files and assemble it again with nasm -f bin command. I tried to use ...
sbh's user avatar
  • 73
2 votes
1 answer
2k views

How do I run shellcode on Linux kernel 5.8+?

The assembly code I'm trying to run is simply a syscall 60. # exit.s .intel_syntax noprefix .section .text .globl _start _start: xor rax, rax mov al, 0x3c xor rdi, rdi xor rdi, 1 syscall ...
I.Am.A.Guy's user avatar
-5 votes
1 answer
369 views

Does the existence of linker and loader not depend on operating systems such as Linux?

Does the existence of linker (for performing linking following compilation) and loader (for executing an executable file) not depend on operating systems such as Linux? (I had though of linker and ...
Tim's user avatar
  • 102k
3 votes
1 answer
154 views

How is overflow_stack variable included in entry.S in arm64 architecture?

The overflow_stack variable is used in the kernel_ventry macro in arch/arm64/kernel/entry.S /* Switch to the overflow stack */ adr_this_cpu sp, overflow_stack + OVERFLOW_STACK_SIZE, x0 It ...
JHM's user avatar
  • 33
4 votes
1 answer
2k views

How to disassembly multiple functions using Linux utility objdump?

After a program is compiled and the binary file is generated, we can use objdump to disassemble the binary file and extract the assembly code and a lot of information. However, using -j .text with ...
husin alhaj ahmade's user avatar
1 vote
1 answer
2k views

How can we perform an arithmetic operation on a register using GDB? [closed]

I want to inject a bit-flip fault into a running program. For this purpose, I'm using gdb to insert a breakpoint into the target program and then flipping a single bit in a random-selected register. ...
husin alhaj ahmade's user avatar
0 votes
1 answer
136 views

Red hat vs Ubuntu compile and assembly Problem(Book reference)

Can you recommend me OS mentioned in Shellcoder's Handbook because I'm having frequent issues on running ELF files mentioned there(See the errors below). I know that to overcome those error I have to ...
Evil Dead's user avatar
2 votes
1 answer
3k views

-bash: ./ex1: cannot execute binary file: Exec format error (on Ubuntu installed through Windows 10 app store, 64 bit)

I am trying to start out with some assembly but I run into this error from the outset. Here are the details: I've written the file myself (following a video) so its not some import: global _start ...
x iLeon's user avatar
  • 39
3 votes
3 answers
1k views

Why is an executable called a "text file"?

In the course of updating software today I got the error "Text file busy", which got me wondering: Why is a Unix (or Linux) executable called a "text" file when that seems so counterintuitive and ...
Vercingatorix's user avatar
2 votes
1 answer
412 views

Is it safe to use the .bss section as a static stack?

(This is in the context of x86-64 Linux.) I am trying to write a high-reliability userland executable, and I have total control over the generated assembly. I don't want to rely on automatic stack ...
Mario Carneiro's user avatar
1 vote
0 answers
190 views

How to export kernel functions which written in assembly?

I am working with a PowerPC processor and have to use dcache functions in my kernel module, like: "clean_dcache_range()", implemented in $KERNEL_SOURCE/arch/powerpc/kernel/misc_32.S (version 4.1.8). ...
Masoud.J's user avatar
6 votes
1 answer
411 views

How to understand this TMG's assembly code from the Version 6 Unix?

Early versions of Unix included Doug McIlroy's tool tmg ("transmogrifier"), an early compiler-compiler. TMG was implemented in Dennis Ritchie's assembly language as well as in TMGL itself (the ...
Andriy Makukha's user avatar
0 votes
1 answer
1k views

How is the Linux kernel partially written in assembly when system calls are required? [closed]

Does the kernel just not use system calls, or is the assembly being assembled before being on a new system? I might need some more info on assemblers, but I'm just confused that if instructions such ...
TheRyGuy's user avatar
2 votes
1 answer
96 views

What the branch machine op-code means (X86 architecture)?

I have a simple c code which is compiled and then the text code extracted using objdump utility. here is the dump file (A piece of dumped file): 0804841b <main>: 804841b: 8d 4c 24 04 ...
husin alhaj ahmade's user avatar
2 votes
1 answer
777 views

How to build and run the GNU GAS assembler test suite?

I'm at Binutils tag binutils-2_31, and there is a directory: gas/testsuite with some tests that I'm interested in. I've compiled the entire binutils with: ./configure make but the directory gas/...
Ciro Santilli OurBigBook.com's user avatar
1 vote
1 answer
246 views

What software that I run uses AVX (or a specific assembly instruction)?

Let's say I want to find any libraries that use AVX, or the VZEROALL instruction? How could I go about doing that? I don't care if the AVX was hand written or compiled, I'll look that up later. I'm ...
Evan Carroll's user avatar
  • 30.9k
20 votes
1 answer
9k views

Why can the kernel not use SSE/AVX registers and instructions?

This post from StackOverflow has this, In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP ...
Evan Carroll's user avatar
  • 30.9k
2 votes
1 answer
894 views

What does SYSENTER do in 64-bit Long mode on Linux?

There is an x86 instruction sysenter. This seems to be the Intel fast-system-call method. SYSENTER seems to be valid in LONG mode (64-bit) on Intel processors. This seems to have fallen out of favor ...
Evan Carroll's user avatar
  • 30.9k
0 votes
1 answer
2k views

Running a custom-compiled executable returns "No such file or directory"

I have an executable but when I run it I get "No such file or directory" $ chmod a+x bin $ file bin bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/...
Evan Carroll's user avatar
  • 30.9k
0 votes
1 answer
639 views

Does GCC generate Bit Tests (x86 BT)?

Seaching through the GCC source, I see things like X86_TUNE_USE_BT TARGET_USE_BT My goal is to get an answer for myself whether or not GCC generates BT, BTS, BTR, and BTC. I started with BT and I ...
Evan Carroll's user avatar
  • 30.9k
2 votes
1 answer
152 views

Issues with cross-compiling and "as"?

I'm trying to compile source for a utility for an ARM system (host machine: x86_64, Debian, uname -v reports version as "Debian 4.9.110-3+deb9u1") but when it tries to pack the file into a final ...
Yeniaul Adrianad's user avatar
1 vote
1 answer
276 views

Where is start symbol in cat executable?

In my Ubuntu 18.04, when I disassemble /bin/cat or the one in coreutils using IDA Pro there exists "start" symbol, usually found with name "_start" in other programs such as gimp. However, when I use ...
masec's user avatar
  • 615
3 votes
1 answer
3k views

What do you call the calling convention behind `int 0x80`?

I know there is a syscall convention but what do you call the calling convention that precedes it that you see when you call to int 80 rather than syscall, like this. mov rax,4 ; system call ...
Evan Carroll's user avatar
  • 30.9k
2 votes
1 answer
1k views

Kernel initialization in UEFI mode

When using old legacy BIOS (consider X86 architecture), the boot loader jumps to a location at the real mode kernel (offset 512 which is defined in header.S assembly file) and starts the real mode ...
user2808671's user avatar
-1 votes
1 answer
802 views

How does the processor determine each instruction's opcode and operands: looking into binary file with VIM [closed]

I run the command view /bin/ls on FreeBSD 10.3 and I can see the binary file unmodified: Then on vim/view I run the command :%!xxd and I can see the file in hex format as follows. I notice at the ...
Megidd's user avatar
  • 1,559
2 votes
1 answer
823 views

Z80 CPU cross-assembler for the MSX standard

I'm trying to program for the old eighties MSX standard that used a Z80 CPU. My problem is that I can't seem to find a cross-assembler for this CPU using the MSX standard. Is there any Z80 CPU MSX ...
Informancien's user avatar
3 votes
0 answers
111 views

perf-like assembly reading tool

perf has a very friendly terminal interface for performance analysis. It has a very helpful feature that the branch target is annotated with beautiful arrows, showing where this branch is going to (if ...
wuxb's user avatar
  • 215
1 vote
1 answer
805 views

x86 Emulator for Linux with detailed debugging

I am looking for a x86 emulator so that I can run my Linux kernel inside it. I am specifically looking for an emulator that shows all the function calls in C/Assembly level from bootloader, all the ...
ManiAm's user avatar
  • 187
3 votes
3 answers
9k views

Any x86-64 Linux assembler?

I want to start learning assembly language, but all the googling didn't make any sense. I got some Exec format error and even used wine which is not good for understanding. So I wonder if anyone can ...
user30167's user avatar
  • 893
1 vote
1 answer
620 views

Incompatibility of High Level Assembly on Kali Linux Rolling

After reading the "Art of Assembly Language", I obtained the High Level Assembly language from the website listed in the book. After editing my .bashrc file, I compiled my canonical "Hello world!" ...
alcao758's user avatar
  • 111
110 votes
11 answers
471k views

How to view a binary file?

From what I understand, a compiler makes a binary file that consists of 1's and 0's that a CPU can read. I have a binary file but how do I open it to see the 1's and 0's that are there? A text editor ...
Martin Zeltin's user avatar
2 votes
1 answer
5k views

Compile shared library from asm code with current sources

I just did some basic functions in asm that I compile in a shared library. Like : BITS 64 global foo section .text foo: mov rax, 1 ret I compiled with ...
OOM's user avatar
  • 133
2 votes
1 answer
281 views

Is there a reference for the assembler-like output produced by `awk -W dump`?

The command awk -W dump ... produces a dump of "assembler-like" code (as shown here [link], or by reading the man). Some of the instructions are easy to guess at their meaning such as jz, which is ...
Allen's user avatar
  • 206
0 votes
1 answer
15k views

Permission denied when I try to run a program assembled with the GNU assembler

I was testing the GNU assembler using intermediate code generated by gcc. I don't really understand the GNU assembly syntax at all, though I could learn it at some point. I ran the command as hello....
Zen Hacker's user avatar
2 votes
1 answer
801 views

CLFS for ARMv7 neon

I am following CLFS book (GIT-20140613-arm version), and I have a issue when building GCC with armv7 and neon combination. Target info here. My host is a clean Debian 8 with gawk, build-essential, ...
Tiago Pimenta's user avatar
11 votes
1 answer
681 views

Where in GRUB2 source code is the handover/jump to kernel code?

I'm looking for the line of code where GRUB2 finally jumps to kernel code and thus hands over execution on x86 systems? I guess it's in an assembler file since this is very low architecture stuff. I ...
JohnnyFromBF's user avatar
  • 3,496