Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
5 replies
96 views

I have the following C code (an MWE): #include<time.h> void fun() { asm("arg1:"); struct timespec const a = { .tv_sec = 10, .tv_nsec = 0 }; asm("call_nanosleep:"); ...
user10732's user avatar
-1 votes
0 answers
20 views

I am trying to imitate a simple bootloader written in nasm I want to try a gas version Here is the code with nasm: [org 0x7c00] mov ah, 0x0e mov al, [var] int 0x10 jmp $ var: db "Hello",...
mx14slh's user avatar
  • 37
2 votes
1 answer
75 views

I have the following assembled but when ever I uncomment the jmp or je it fail with 11: Error: bad or irreducible absolute expression _start: mov $0x0e, %ah mov $'a', %al _loop: int $...
mx14slh's user avatar
  • 37
1 vote
0 answers
106 views

I am following an assembly tutorial where they use NASM. They manage to compare a register to a variable's address with cmp rcx, digitSpace, but how can I do the same with GAS? As you know this ...
mx14slh's user avatar
  • 37
3 votes
1 answer
87 views

I have the binary image of a bootloader which was written with some ancient assembler. I want to port the assembly code to GNU assembler (GAS). We speak about the X86/16-bit (real mode) world. This ...
vl106's user avatar
  • 150
-2 votes
1 answer
172 views

I have implemented a basic FIFO data structure with its related functions/subroutines in a FIFO.s file and want to use them in the main function inside a main.c file; // FIFO.s .syntax unified .cpu ...
student signup's user avatar
2 votes
2 answers
131 views

After some package upgrade on my Ubuntu 24.04 I stumbled upon inability to build/install/work with almost any of golang packages. So, I'm trying to install staticcheck and get the following error: $ ...
milo's user avatar
  • 1,260
1 vote
0 answers
51 views

I want to use the same label name in different parts of my Assembly code instead of using a new, never-before-used label name; Is such a thing possible? For example: . . . Factorial: // A subroutine ...
student signup's user avatar
4 votes
1 answer
104 views

I want to rename (more like add an alias to) one or more registers for a specific part of my Assembly code using the .req directive and later on undo the renaming of said register(s) so that those ...
student signup's user avatar
1 vote
0 answers
46 views

I have pushl $2147487744 this is 0x80001000 gnu as gives mycc_cpp.s:27: Error: invalid instruction suffix for `push' I have tried pushq pushing hex no luck
pm100's user avatar
  • 50.7k
1 vote
1 answer
65 views

I assembled the following file with GAS, the GNU assembler: .extern foo .global bar .section .text bar: call foo ret In the object file it produced there is a relocation entry of type ...
mdjukan's user avatar
  • 173
1 vote
0 answers
85 views

I've been dabbling with writing a small OS in D lang but I'm crashing on boot. I've been debugging my main file and think that the issue is with gdt_flush which is called in gdt.d and defined in gdt.s....
clickerticker48's user avatar
3 votes
0 answers
63 views

Is there a way to have the GNU assembly process a source file that contains macros, expand them, and then output the expanded equivalent code in a form that could be assembled by as? Basically, I'm ...
Bri Bri's user avatar
  • 2,012
4 votes
1 answer
100 views

In this assembly file below, the macro jump_table should automagically create ... a jump table to consecutively numbered labels like jump_0, jump_1, ... jump_<n>. It seems there is no loop ...
EnzoR's user avatar
  • 3,500
1 vote
1 answer
105 views

What do the symbols mean in this assembly language statement: .size _start, . - _start I've searched and found quite a few identical examples and several variations but none explain what the ...
simgar's user avatar
  • 618
3 votes
0 answers
83 views

I'm trying to understand this assembly from a bare-metal project I've cloned from GitHub. .section .text._start _start: // Infinitely wait for events (aka "park the core"). ....
simgar's user avatar
  • 618
3 votes
0 answers
742 views

In a simple/trivial GNU Assembly (GAS/as) program (see interaction and source, after explanation), opened for debug with GDB. Having trouble to set the value of a variable through its symbol (name). (...
nostromo's user avatar
  • 437
0 votes
0 answers
43 views

According to my understanding, the brk syscall allows you to set the memory available to the process, and I assume that the process cannot access any memory after the break point. Well, the code below ...
IMSOEVIL's user avatar
3 votes
1 answer
80 views

I've been reading a book called "Learn to Program with Assembly, Jonathan Barlett". In which , I didn't understand the Figure 6-1. Context: The author is explaining register-indirect mode, ...
Bobby's user avatar
  • 121
0 votes
0 answers
33 views

I've been learning x64 assembly lately from a book (Learn to program in Assembly, Jonathan Bartlett). The book claims, "In order to manipulate the data, we have to move it into registers first.&...
Bobby's user avatar
  • 121
3 votes
1 answer
46 views

I have a setup like this: .set ERRORS, 1 .macro ERROR_SUMMARY, COUNT .print "\e[1;92mZ#\e[1;31m Compilation Failed with \\COUNT Error(s)\e[0m!" .endm ERROR_SUMMARY ERRORS This should ...
renderthegreat's user avatar
3 votes
0 answers
82 views

Working on an assignment, the premise is essentially implementing provided C functions in assembly and preserving behavior. The program reads "records" from stdin (char* last_name, char* ...
user2533504's user avatar
0 votes
1 answer
64 views

I know in arm assembly we can use shifter operands like bellow: mov r0, r1, lsl #2 I use gcc to compile, therefore I have to adapt syntax. I already tried this: mov w0, w1, lsl 2 It didn't work: ...
imahmadrezas's user avatar
1 vote
0 answers
29 views

I wanted to print out first command line argument in x86_64 Assembly on Linux, but I have had hard time getting value of it. For clarification: commands I use to compile this are as -o args.o args.s -...
kaidezee's user avatar
2 votes
0 answers
119 views

This must be something really stupid; I'm trying to get the address for a label and store it into a .word on GNU Assembler, but for some weird reason, it's not working as I expect it to work. Take the ...
grilix's user avatar
  • 5,359
1 vote
0 answers
98 views

Consider this code: .intel_syntax noprefix .data l: .long 0 .text .global main main: mov DWORD PTR l, 0x11111111 mov eax, ...
Korsarq's user avatar
  • 805
1 vote
0 answers
55 views

When can I use this directive? Are there any other types besides function, tls_objrct, object, and common? Are there examples of using each type from the .type? Can I create my own type and mark it ...
Tayler's user avatar
  • 15
0 votes
0 answers
90 views

I am writing power function in GNU Assembly x86 on Linux principal-neanderthal 6.8.0-41-generic x86_x64. When i launch i get "segmetantion fault (core dumped)" error. .code32 .section .data ...
Fischer Benkovscki's user avatar
1 vote
1 answer
96 views

I am trying to build an application made of a single assembly file. I wrote a linker file targeting my chip which consists of a RISC-V CPU, a ROM and a RAM. I don't know how to tell the AS program to ...
user avatar
0 votes
2 answers
505 views

I am making my own risc V core as a personal project using the RV32I ISA, I am using a Harvard memory architecture meaning I have a program memory that starts at address 0x0 and a separate data memory ...
user25773352's user avatar
1 vote
0 answers
116 views

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
2 votes
0 answers
129 views

I am working on learning to write ARM firmware and am trying to create a Vector Table. I am using the GNU toolchain. I have assembly code like the following: MY_VECTOR_TABLE: .long 0 ...
Echelon X-Ray's user avatar
0 votes
1 answer
64 views

I'm trying to assemble code for MIPS R2000 (MIPS I ISA). I'm using LI pseudo instruction to initiate a register. After running the assembler on the following code: li $v1, 1 The binary .text ends up ...
Roi Amiel's user avatar
  • 365
3 votes
2 answers
692 views

the AVR 8bit core instruction set includes the more efficient 16bit versions of the "load data from memory" (LDS) and "store data to memory" (STS) instructions, as opposed to the ...
Peter Rottengatter's user avatar
2 votes
1 answer
203 views

After a long time I have to use the GNU assembler again. Ever since I had trouble with the '$'. The manual just says: 3.6.2.1 Integers A decimal integer starts with a non-zero digit followed by zero ...
vl106's user avatar
  • 150
1 vote
1 answer
64 views

.section .note.GNU-stack,"",@progbits .section .data cf_msg: .string "CF = %d\n" of_msg: .string "OF = %d\n" sf_msg: .string "SF = %d\n" less_msg: .string &...
Andi's user avatar
  • 13
1 vote
1 answer
69 views

Arch is SuperH. I have some variables specified like this: buffer_address: .long buffer buffer: .zero 1024 However, for certain buffer reads, I need to read as cache-through. The way to do that on ...
gfdjjrtiejo's user avatar
1 vote
0 answers
80 views

I have an assembly code that generates ISR (interrupt service routine) stubs. I want to automate this process, and for each of the interrupts (there are 256) generate it's own unique stub. This is ...
ThErOmAnEmPiRe's user avatar
3 votes
1 answer
220 views

I'm working on an embedded project using an ARM Cortex-M4 processor (specifically, an STM32F4 microcontroller) and I've encountered a peculiar issue related to memory sections defined in my linker ...
Giackkk's user avatar
  • 121
2 votes
1 answer
116 views

I want to append a string to a macro argument in gcc assembler. Here is what I have currently: The following macro to embed a file in my code which works just fine: .macro add_resource resource_name, ...
God I Am Clown's user avatar
0 votes
1 answer
244 views

Lets say I have a buffer I declared like this: .section .bss .lcomm buffer, 33 I pushed it to the stack and passed it as an argument to another function that expects a 44-byte length buffer. Is there ...
user16713791's user avatar
2 votes
0 answers
60 views

Arch is SuperH, specifically SH-2. I don't know the name of this operation, but I have been calling it "shift and duplicate". Effectively what I am looking for is: 0x0000AB12 -> ...
gfdjjrtiejo's user avatar
1 vote
1 answer
149 views

There are several versions of the same instruction: IDIV M32, IDIV R32, IDIV M64, IDIV R64 (https://www.felixcloutier.com/x86/idiv) How to understand which one is used? Let's say vdiv(std::vector<...
Vladislav Kogan's user avatar
0 votes
1 answer
98 views

Can read assembly but trying to learn to write small functions in it, but I can't seem to link a main written in C that calls an extern function written with gas. The target is linux x64. Here is main....
Jason Nordwick's user avatar
1 vote
0 answers
48 views

I have this code written in Assembly x86_64: .section .data .equ SYS_CALL, $0x80 .set filename, "a.txt" .section .text .section .bss .lcomm buffer, 20 .globl _start _start: mov $1,%rbx ...
user16713791's user avatar
0 votes
1 answer
29 views

Some time ago I created this function to dump a bytecode given an ASM instruction: show_bytecode(){ echo "$@" | as -o temp.o && ld --oformat binary -o temp.bin temp.o 2>/dev/null &...
ton's user avatar
  • 4,807
2 votes
1 answer
138 views

I'm currently working on a riscv prj with custom opcode. I wanna write some asm test cases (like riscv isa test) . A piece of work has been shown below RVTEST_CODE_BEGIN #---------------------------...
zhili's user avatar
  • 61
1 vote
0 answers
59 views

I have this code I wrote in x86. The code does a power of the first number I'm pushing to the queue by the second one. Now all cases work as expected except one case that's when the second number ...
user16713791's user avatar
1 vote
0 answers
34 views

I have this code I've written in Assembly x86: .section .data list: .long 1, 2, 3, 4, 5, 0 .section .text .globl _start _start: movl $0,%eax # eax will save our current location movl list(,%eax,...
user16713791's user avatar
1 vote
1 answer
425 views

I'm currently learning bootloader development and debugging with GDB to observe memory changes when the A20 line is disabled in real mode. Since QEMU automatically enables the A20 line, I'm attempting ...
user avatar

1
2 3 4 5
22