Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:22:03+00:00 2026-06-12T14:22:03+00:00

In my 16bit program GAS is balking at the instruction: movw %ip, %dx I

  • 0

In my 16bit program GAS is balking at the instruction:

movw %ip, %dx

I find this strange as moving a segment register works fine, for example:

movw %ss, %ax

The full error message is:

Error: bad register name `%ip’

And my version string is:

GNU assembler (GNU Binutils) 2.22

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:22:04+00:00Added an answer on June 12, 2026 at 2:22 pm

    Unfortunately, not every register can be easily accessed. There are some limitations.

    As listed in x86 wikibook, GPR section, in x86 there are 8 General-Purpose Registers (GPRs): AX, CX, DX, BX, SP, BP, SI, DI, which can be used in many commands. They are encoded as 3 bits; and there is no space in the instruction encoding to encode Special registers, like EIP (IP), or EFLAGS (FLAGS).

    If you scroll wikibook down, there is a section about IP:

    Instruction Pointer

    The EIP register contains the address of the next instruction to be executed if no branching is done.

    EIP can only be read through the stack after a call instruction.

    So, it is really illegal to use mov to read IP.

    There are some examples of reading ip with call then pop %ax sequence here: http://www.programmersheaven.com/mb/x86_asm/267963/267963/how-to-access-ip-register/

    Update: About reading of SS register:

    There are actually many variant of mov instruction encoding, e.g. in this table we see segment reading

     mnemonic   op1 op2 po     o    description, notes 
     MOV    Sreg    r/m16   8E     r        Move
    

    or Control Register writing:

     MOV    r32 CRn 0F20   r ...    Move to Control Registers
    

    but there is still no MOV for IP register.

    Update2: in x86_64 there is a reading of EIP with LEA, according to https://stackoverflow.com/a/1047968/196561

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've started learning 16-bit assembly (eventually moving up to 32-bit) from this tutorial here:
As far as I know, this isn't caused by an infinite recursion. The program
I have a problem correctly terminating a 16bit DOS program written in Assembly. Here's
Can somebody give simple c-program to find whether my machine is 16-bit or 32-bit
I'm writing a small program to fix compatibility issues with a 16-bit program. This
Using C++ I need to combine two distinct IDs into one 16bit integer. Then
I'm porting a software that build from 16bit color depth to 18bit color depth.
Possible Duplicate: How to represent 18bit color depth to 16bit color depth? I'm porting
I need to pass audio data into a 3rd party system as a 16bit
i have a small program that uses 32bit object file, and i wish to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.