Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

NASM SYSEXIT bug=Invalid OPCode

Sign in to follow this  



It seems some of the older versions of NASM has an error in it.

They translate the SYSCALL instruction just fine, but the translated OPCode for the SYSEXIT instruction is off by one, which produces an illegal instruction.

These versions output SYSEXIT into the OPCode 0x0F36. This OPCode is not correct, so a valid SYSEXIT instruction in the source will still assemble--It will just crash because of the unknown / illegal instruction.

There are two ways around this. The first, is to embed the machine language directly within the source to be executed.

Because SYSEXIT uses the OPCode 0xF35 (Not the invalid OPCode 0xF36 produced by NASM), we can use this:

; here we are executing the code...

dw 0x0F35 ; Embedded machine opcode--this is our sysexit instruction

This will assembly as just binary data--but, when executed, it is executed as a valid SYSEXIT instruction.

The other option is, of course, getting a newer, more recent version[wink]

OS Development Series Tutorial 12
This should be completed by either today or tomorrow. It is another 2 part tutorial, covering all of the basic groundwork for a Kernel at its core.

Afterwords, Tutorial 14.1, 14.2, 14.x will be special tutorials that describe setting up individual toolset envirements, and setting up the C compiliers and linkers for use at Kernelland.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!