Skip to content
Advertisement

Tag: x86

ELF label address

I have the following code in .s file: Its object file has the following: After linking, it becomes: How does the argument 0x0 to pushq at byte 20 of the object file gets converted to 0x400578 in the final executable? Which section of the object file contains this information? Answer You answered your own question: After linking…. Here is a

Generate raw binary from C code in Linux

I have been implementing just for fun a simple operating system for x86 architecture from scratch. I implemented the assembly code for the bootloader that loads the kernel from disk and enters in 32-bit mode. The kernel code that is loaded is written in C, so in order to be executed the idea is to generate the raw binary from

Cannot Make Code Segment Execute-Only (Not Readable)

I’m trying to make the Code Segment Execute-Only (Not Readable). But I FAILED after I tried everything the Manual told me to. Here is what I did to make the code segment unreadable. First, I’ve found this in “Intel(R)64 and IA-32 Architectures Software Developer’s Manual(Combined Volumes 1,2A,2B,2C,2D,3A,3B,3C and 3D)”: Set read-enable bit to enable read and Segment Types.(Sorry, I’m still

How is the $ token treated when used under a label vs in a single line?

The NASM manual includes the following on the $ token in section 3.5: $ evaluates to the assembly position at the beginning of the line containing the expression and earlier in section 3.1 there is a note about source lines: NASM uses backslash () as the line continuation character; if a line ends with backslash, the next line is considered

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

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

Advertisement