I have the following piece of code that I have to debug: After compiling and running that code I obtain a segmentation fault error, it seems that something goes wrong after the 5th line. My linux asm knowledge is very basic, any hints or ideas about what is exactly going wrong and how to fix it? This piece of…
Tag: assembly
ARM: Disabling MMU and updating PC
In short, I would like to shut down all MMU (and cache) operations in a Linux context (from inside the Kernel), for debug purposes, just to run some tests. To be perfectly clear, I don’t intend that my system still be functional after that. About my setup: I’m currently fiddling with a Freescale V…
Clean console on assembly
Is there anything similar to system(“cls”); that exists on C for Assembly? I’m using NASM to compile and I’m working on a x86 linux. UPDATE 1: Here’s my modified code to integrate sugestion: Cheers Answer To imitate the terminals clear command have in a .data section: then whenev…
Getting digit instead of Ascii in nasm assembly intel x86
I’m trying to learn the basics of assembly but can’t get across on how to display results stored in memory. What I’m trying to do is get the dot product of the two list of numbers and display it on the screen. However, I keep getting random letters which I believe are hex representations of …
assembly function segfault at return (nasm x64)
My asm function segfaults at return. Here is the function prototype : void ft_cat(int fd); Basically it get a fd from a C main and act like cat shell command. I get no problem if I removed read and write parts so maybe the problem is around syscalls. I just can’t tell. I already spent hours and hours lo…
C assembler function casting
I came across this piece of code (for the whole program see this page, see the program named “srop.c”). My question is regarding how func is used in the main method. I have only kept the code which I thought could be related. It is the line *ret = (int)func +4; that confuses me. There are three qu…
Accessing errno.h in assembly language
I want to access errno present in errno.h in assembly language in order to handle errors of write function call. I found somewhere that make call to _error in assembly language for this purpose but it is throwing errors as : My assembly code : ExitNewShell.asm How to access errno in assembly language? Answer …
NASM code with user output, and then input into an argument. (code error)
I have had problems implementing user output into and argument with my below code. An example of BASH showing, a similar example function of what i would like to implement in NASM. The reason why I am creating this code is to show a comparison of different languages, used within Linux, This is one part of my …
Printing an integer with x86 32-bit Linux sys_write (NASM)
I’m new to this forum. I have a little experience with high-level languages (really little). Nearly one month ago I thought it would be a good idea to see how assembly worked so after choosing nasm (IA-32) on linux I started learning from a tutorial. Now, after ending it, I tried to write a simple progr…
the physical address of global descriptor table?
I’m reading the disassemble code of mit os’s kernel code. I think the kernel code should follow the same rule. I saw the instruction in the kernel that load the Global Descriptor Table is as follows: lgdtl 0x10f018 I know the lgdt takes the length of the GDT (16bit) and the address of the GDT (32b…