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 questions I have
Tag: assembly
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 You’re making x86 Linux syscalls from
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 research project. So
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 program where you get the
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 (32bit) as the operand. However,
nasm assembly linux timer or sleep
I’m trying to find a way to make my code wait for two seconds before proceeding. I’m using nasm for Linux in protected mode, so I can only use int 80h. I found a syscall called “alarm” (27) and another called “pause” (29). However, when I try to use those, the program waits and finishes instead of continuing execution. I’ve
How to clear screen on protected mode
I’m using NASM for Linux and I’d like know how, in the protected mode, you can clear the screen. I found a solution using the int10h, but on the protected mode I can only use int80h. Thanks in advance. Answer You can write x1b[2J to the standard output so the terminal get cleared and fix the cursor position using x1b[H,
How to print a number in ARM assembly?
I am trying to print a number that I have stored. I’m not sure if I am close or way off. Any help would be appreciated though. Here is my code: It compiles and runs, but I don’t see anything printed. From what I understand, I need the address of where to start printing in r1, how many bytes in
Calling assembly routines from C source code
I have this simple C source code : and i have this s.asm which defines the function _Sum : now , i compiled the .asm using : and compiled and linked the .c file using : this is the outcome : So what is the problem ? I’m using Ubuntu-Linux Any help would be greatly appreciated , Thanks [SOLVED] :
How can I create a basic NASM Assembly (Linux) calculator to add two integers?
I had a go at it, and tried: Sorry about all the XOR instructions, I just wanted to make sure registers were cleared before I used them for a system call, I’m still learning assembly and not sure about what instructions will render a register empty. When I compile, link and run this I can enter the two integers only