The inline assembly in my kernel module code is following:
u64 cade_seg;
__asm__ __volatile__ ("mov %%cs %0": "=r" (code_seg));
However, when it compiles (as kernel module), error is thrown that "junk rax
after register." Is there anything wrong with the inline assembly code above.?
Update: by replacing %%cs
with other register, say %%rax
, the error persists.
In assembly language, the registers should be separated by a comma:
Also segment selectors are a 16 bit type.