Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Segmentation error assembly

Status
Not open for further replies.

rockxasm

Programmer
Apr 11, 2020
3
0
0
MA
Hi I am on linux 64bit and when I run the asm code it tells me segmentation error
here is the code:
GNU nano 4.8 main.asm
SECTION .data ; Section containing initialised data

SECTION .text ; Section containing code

global _start ; Linker needs this to find the entry point!

_start: ; Write your instructions between the two noops
mov ax, 5307h
mov cx, 3
mov bx, 1
int 15h


and I use nasm and ld for compiling and linking on 64 bit :
nasm -felf64 main.asm
ld main.o
do anyone have any solution for the problem ?
 
Because Linux != DOS.

> mov ax, 5307h

No, you can't just power off the machine with a few simple asm instructions poking away at a non-existent DOS interrupt from the user space of a 64-bit protected operating system.

> do anyone have any solution for the problem ?
Which problem is that?

If you want to know how to interact with the Linux kernel at the ASM level, then you need to read up on that subject.

If you want to mess around with old time 16-bit code, then this might help.
You would install some 16 bit assembler inside DOSBox.
You then write your 16 bit ASM code and watch DOSbox shutdown.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
I understand , thank you for your response but I have another question:
I have searched about the code to shutdown my computer in assembly linux x86/x64 and it's worked on my pc
now i want to send a hex file built around the code to a machine in my local network to reboot is that possible?
 
> hex file built around the code
What does this even mean?

Normally, if you want to remote admin a machine on your local network, you 'ssh' into it and issue the shutdown command to shutdown or reboot.



--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
it is understood thank you very much for your response
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top