VESAMTTR (recovered from Google) (DOSX)
I dopn't need anything extra, just if here someone knows AT&T inline ASM for DJGPP:
My ring0 code is this shor function:
void ring0_rdmsr(void) // GCC bohuzel nepodporuje __attribute__ ((naked)) na x86
{ // takze misto pointeru na funkci pouzijeme ASM label
asm __volatile__ (
"rdmsr_label:\n" // label at start of pure code behind C-function prologue
"rdmsr\n" // read CPU MSR register value to EDX:EAX
"movl %eax,(%ebx)\n" // mov dword ptr [ebx],eax
"movl %edx,(%edi)\n" // mov dword ptr [edi],edx
"lret\n" // far return from ring 0
); // C-function epilogue will be never reached
and callgate is called:
asm __volatile__ ( // volani CallGate
// "pushal\n" // store all registers to stack
"cli\n" // disable interrupts
"movl %0,%%ebx\n" // store pointer to low DWord
"movl %1,%%edi\n" // store pointer to high DWord
"movl %2,%%ecx\n" // store MSR index
"lcall *%3\n" // far call the CallGate to enter ring 0, require code far return
"sti\n" // enable interrupts
// "popal\n" // restore all registers from stack
: // no outputs (readed data overwrites input arguments)
: "g" (eax), "g" (edx), "g" (ecx), "m" (ldt_callgate_ptr) // inputs
);
If I have pushal/popal around the call, then DJGPP crashes (but mingw32 not) so i commented it. Is it really needed? Or can I ommit it? Or any idea to improve this inline asm?
EDIT by rr: added {code} tags
---
DOS gives me freedom to unlimited HW access.
Complete thread:
- VESAMTTR (recovered from Google) - DOS386, 23.07.2007, 02:42 (DOSX)
- VESAMTTR (recovered from Google) - RayeR, 03.09.2007, 20:45
- VESAMTTR (recovered from Google) - RayeR, 03.09.2007, 20:58
- VESAMTTR (recovered from Google) - Rugxulo, 04.09.2007, 02:01
- VESAMTTR (recovered from Google) - RayeR, 04.09.2007, 12:59
- VESAMTTR (recovered from Google) - Japheth, 04.09.2007, 16:41
- VESAMTTR (recovered from Google) - RayeR, 04.09.2007, 20:25
- VESAMTTR (recovered from Google) - Japheth, 04.09.2007, 22:32
- VESAMTTR (recovered from Google) - DOS386, 05.09.2007, 02:17
- VESAMTTR (recovered from Google) - RayeR, 05.09.2007, 09:53
- VESAMTTR (recovered from Google) - Japheth, 06.09.2007, 08:27
- VESAMTTR (recovered from Google) - DOS386, 11.09.2007, 06:54
- VESAMTTR (recovered from Google) - RayeR, 12.09.2007, 20:31
- VESAMTTR (recovered from Google) - DOS386, 13.09.2007, 02:21
- VESAMTTR (recovered from Google) - RayeR, 12.09.2007, 20:31
- VESAMTTR (recovered from Google) - DOS386, 11.09.2007, 06:54
- VESAMTTR (recovered from Google) - Japheth, 06.09.2007, 08:27
- VESAMTTR (recovered from Google) - Japheth, 04.09.2007, 22:32
- VESAMTTR (recovered from Google) - RayeR, 04.09.2007, 20:25
- VESAMTTR (recovered from Google) - Rugxulo, 05.09.2007, 14:51
- VESAMTTR (recovered from Google) - RayeR, 05.09.2007, 16:22
- VESAMTTR (recovered from Google) - Rugxulo, 05.09.2007, 20:56
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 01:08
- VESAMTTR (recovered from Google) - Rugxulo, 06.09.2007, 04:40
- VESAMTTR (recovered from Google) - rr, 06.09.2007, 16:56
- VESAMTTR (recovered from Google) - Rugxulo, 07.09.2007, 04:12
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 22:35
- VESAMTTR (recovered from Google) - Rugxulo, 07.09.2007, 04:14
- VESAMTTR (recovered from Google) - RayeR, 07.09.2007, 10:18
- VESAMTTR (recovered from Google) - rr, 07.09.2007, 10:45
- VESAMTTR (recovered from Google) - RayeR, 08.09.2007, 01:46
- VESAMTTR (recovered from Google) - Rugxulo, 08.09.2007, 07:03
- VESAMTTR (recovered from Google) - RayeR, 08.09.2007, 22:03
- VESAMTTR (recovered from Google) - rr, 08.09.2007, 22:49
- VESAMTTR (recovered from Google) - RayeR, 10.09.2007, 14:18
- VESAMTTR (recovered from Google) - rr, 08.09.2007, 22:49
- VESAMTTR (recovered from Google) - RayeR, 08.09.2007, 22:03
- VESAMTTR (recovered from Google) - Rugxulo, 08.09.2007, 07:03
- VESAMTTR (recovered from Google) - RayeR, 08.09.2007, 01:46
- VESAMTTR (recovered from Google) - rr, 07.09.2007, 10:45
- VESAMTTR (recovered from Google) - RayeR, 07.09.2007, 10:18
- VESAMTTR (recovered from Google) - Rugxulo, 07.09.2007, 04:14
- VESAMTTR (recovered from Google) - rr, 06.09.2007, 16:56
- VESAMTTR (recovered from Google) - Japheth, 06.09.2007, 07:17
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 22:34
- VESAMTTR (recovered from Google) - rr, 06.09.2007, 16:51
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 22:33
- VESAMTTR (recovered from Google) - Rugxulo, 07.09.2007, 05:11
- VESAMTTR (recovered from Google) - rr, 07.09.2007, 10:40
- VESAMTTR (recovered from Google) - rr, 07.09.2007, 10:40
- VESAMTTR (recovered from Google) - Rugxulo, 07.09.2007, 05:11
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 22:33
- VESAMTTR (recovered from Google) - Rugxulo, 06.09.2007, 04:40
- VESAMTTR (recovered from Google) - RayeR, 06.09.2007, 01:08
- VESAMTTR (recovered from Google) - Rugxulo, 05.09.2007, 20:56
- VESAMTTR (recovered from Google) - RayeR, 05.09.2007, 16:22
- VESAMTTR (recovered from Google) - Japheth, 04.09.2007, 16:41
- VESAMTTR (recovered from Google) - RayeR, 04.09.2007, 12:59
- VESAMTTR (recovered from Google) - Rugxulo, 04.09.2007, 02:01