I’m writing a subroutine to simply reprint decimal numbers as strings using the stack, but not getting the values I expected. When I run it through the debugger I see that I can’t get the value from esi into al. I suspect that I’m not allowed to use esi in the manner that I am, but I’m not sure on
Tag: assembly
GCC compiled code: why integer declaration needs several statements?
I’m learning AT&T assembly,I know arrays/variables can be declared using .int/.long, or using .equ to declare a symbol, that’s to be replaced by assembly. They’re declared insided either .data section(initialzed),or .bss section(uninitialzed). But when I used gcc to compiled a very simple .c file with ‘-S’ command line option to check the disassembly code, I noticed that: (1) .s is
What parts of this HelloWorld assembly code are essential if I were to write the program in assembly?
I have this short hello world program: I compiled it into the following assembly code with gcc: My question is: are all parts of this code essential if I were to write this program in assembly (instead of writing it in C and then compiling to assembly)? I understand the assembly instructions but there are certain pieces I don’t understand.
About the memory layout of programs in Linux
I have some questions about the memory layout of a program in Linux. I know from various sources (I’m reading “Programming from the Ground Up”) that each section is loaded into it’s own region of memory. The text section loads first at virtual address 0x8048000, the data section is loaded immediately after that, next is the bss section, followed by
Segmentation fault caused by strb w1, [x22,x23] when x23 reaches a certain value
Encountered an interesting segmentation fault on strb w1, [x22,x23] instruction in ARMv8 Assembly code when x23 reaches a certain value (which is 635), when I’m not using bl write function. However, if I use bl instruction to call write function, the segmentation fault does not occur; but the program finishes with “… exited with code 02” in gdb or echo
Differing CPUID usage from high-level languages
I’m attempting to utilize an x86 ASM function that requires certain processor architecture. I understand that I need to check a specific bit after calling “CPUID standard function 01H”. Below is a C implementation from the CPUID Wikipedia page for calling CPUID: Though the Linux kernel uses the function below: Which one is better? Other they essentually equivalent? Answer As
Is there any merit about assembly language? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. Improve this question I heard some of developers use assembly language in embedded system. I wonder what merit they have from learning assembly language
basic linux x86 assembly minimum number returns incorrectly
I wrote this basic linux x86 assembly app. I expect it to return 3 when I do echo $? however the status is always 0. What am I doing wrong? Note: %ebx always contains the status code, and it should contain the min value by exit time. Fixed: Answer The issue is that the terminating zero also participates in the
Converting User Input Hexadecimal to Decimal in Assembly
I am trying to create an assembly program that takes a user input hexadecimal number no greater than 4 digits and outputs the same number in base 10. This is being done using NASM on a Linux install. Using some tutorials I’ve found and my very limited understanding of this language, I have come up with this. It should be
Behavior of fgetc() function in C
I am looking for an easy way to manage file opening and closing in x86-64 assembly on linux. I thought the easiest way would be to write a c file containing functions that I could call without having to worry about stability. So I wrote this function : And then I read the port like so: Where PORT.p is a