Skip to content
Advertisement

Tag: x86-64

Segmentation fault in my Assembly implementation

I am new to assembly language programing, and here I am trying to call C standard library function puts from my assembly code, but I am continuously getting segmentaion fault. Please help; Operating system : LINUX 16.04 Assembler : nasm Machine : intel x86 – 64bit Answer to explain Comments More, start with x86 calling convention and your code. x86

Can I use 1G superpages to back shared mmaps?

So far when I’ve tried using a file in /mnt/hugepages1G/ as the backing I get segfaults. It works fine if I use 2M superpages in /mnt/hugepages/ I think I read somewhere that I now can’t find that Linux only supports 2M pages for Shared memory? But I can’t swear to it. Can’t find it in documentation. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/vm/hugetlbpage.txt?id=HEAD $ hugeadm –pool-list

Reading user input as an integer

I wrote an Assembly program (x86_64 Linux NASM) that prints an integer to console, based in the algorithm suggested my the comments in this post, which is basically this: All works just fine under the following script: After compiling it, the number 567 gets printed on the screen (console). But if I try to do the same but allowing the

Strange pointer position in the stack

I wrote this simple code: and I’ve disassembled it to see what the compiler does. Using objdump I obtain: I can understand everything except for the mov QWORD PTR [rbp-0x10],0x0, this correspond (I think)to p=NULL; but from mov QWORD PTR [rbp-0x8],rax I know that my pointer is on rbp-0x8 and it seems correct (the size of a pointer is 8bytes).

What is the difference between retq and ret?

Let’s consider the following program, which computes an unsigned square of the argument: This is properly compiled by as, but disassembles to Is there any difference between ret and retq? Answer In long (64-bit) mode, you return (ret) by popping a quadword address from the stack to %rip. In 32-bit mode, you return (ret) by popping a dword address from

push/pop segmentation fault in simple multiplication function

my teacher is doing a crash course in assembly with us, and I have no experience in it whatsoever. I am supposed to write a simple function that takes four variables and calculates (x+y)-(z+a) and then prints out the answer. I know it’s a simple problem, but after hours of research I am getting no where, any push in the

Advertisement