×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Segmentation error assembly

Segmentation error assembly

Segmentation error assembly

(OP)
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 ?

RE: Segmentation error assembly

Because Linux != DOS.

> mov ax, 5307h
http://www.ctyme.com/intr/rb-1404.htm

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.
https://linux-kernel-labs.github.io/refs/heads/mas...

If you want to mess around with old time 16-bit code, then this might help.
https://www.dosbox.com/
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.

RE: Segmentation error assembly

(OP)
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?

RE: Segmentation error assembly

> 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.

RE: Segmentation error assembly

(OP)
it is understood thank you very much for your response

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close