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 8320863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:48:42+00:00 2026-06-08T22:48:42+00:00

I have been trying to experiment with the Intel Debug Registers however I seem

  • 0

I have been trying to experiment with the Intel Debug Registers however I seem to be doing something incorrectly. I have created a very simple Linux LKM and tried to use inline assembly to perform trivial manipulation of the registers. e.g:

 __asm__ ("movl %eax, %db0");

The error messages I get suggest I’m doing something fundamentally incorrect. e.g:

Error: unsupported for `mov'

Does anyone have any insight into how to work with these registers?

  • 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-08T22:48:45+00:00Added an answer on June 8, 2026 at 10:48 pm

    That’s a syntax error – gcc’s inline assembler uses % as operand identifier, and to explicitly use it in register names for x86 you’ll have to write:

    __asm__ ("movl %%eax, %%db0\n\t");
    

    That’ll make it compile.

    Correction:
    There’s multiple issues here:

    1. __asm__ statements without clobbers are highly unusual (and rarely do what you’re expecting because there’s very few things one can do in assembly that have no side effects). Nonetheless, if and only if the instruction is actually both side-effect-free and has no inputs, it looks to be possible to omit the clobber list.
      One consequence of that is that escaping % is no longer necessary; the compiler for this simple example creates the same opcode for __asm__("movl %eax, %db0\n\t"); as it does for the fully-specified __asm__("movl %%eax, %%db0\n\t":::);. This is not necessarily an advantage though, because …
    2. The second problem is portability; x86_64 and i386 are similar but not identical, and one of the differences is the register width for the debug regs. This alone is a particularly good reason to actually use inline assembly operands instead of register names directly, because the following code:
      __asm__("mov %0, %%db0\n\t" : : "a"((uintptr_t)0) : );
      compiles both on 64bit (gcc -m64 ...) and 32bit (gcc -m32 ...) – it creates the same instruction, but the registers used when writing this in assembly are different for 64bit:
      208: 0f 23 c0 mov %rax,%db0
      while in 32bit, it does:
      269: 0f 23 c0 mov %eax,%db0
      The use of an input operand here provides the ability to abstract the register width away (uintptr_t comes from <inttypes.h> and is guaranteed to always be full general-purpose register width), so the same inline assembly can be used for 32bit and 64bit compiles.

    I admit I had no idea the compiler treats clobber-list-less __asm__ differently from “normal” such statements.

    In any case, in reality you will definitely need an argument/clobber list when modifying debug registers, because access to these are serializing instructions which should be implicitly made known to the compiler as memory clobber. Besides, the value you’re reading from them / writing to them must go to / come from somewhere … hence input/output.

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

Sidebar

Related Questions

I'm trying to make something like a very simple painting app using Libgdx. I've
Have been trying to encrypt an xml file to a string so that I
Have have been trying to make a validator for my xml files. I have
I have been trying to setup git for our web development team unsuccessfully. Some
I have been trying for almost a week now to create an SQLite database
I have been trying to generate report as per age differences of different months
I have been trying to create a ListView which I can sort using drag
I have been trying to align an entire label along with text to the
I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I have been trying to serialize a list that contains arrays and lists. I

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.