s h(deleted)
12/14/2009 6:00 AM
post43763
|
some simple examples:
typedef struct {
unsigned int eax;
unsigned int ebx;
unsigned int ecx;
unsigned int edx;
} regs_abcd_t;
void CPUID (unsigned int arg_eax, unsigned int arg_ecx, regs_abcd_t *out);
#pragma aux CPUID = \
".586" \
"cpuid" \
"mov [edi],eax" \
"mov [edi+4],ebx" \
"mov [edi+8],ecx" \
"mov [edi+12],edx" \
parm [eax] [ecx] [edi] \
modify exact [eax ebx ecx edx];
void processor_brand_string (char *str); /* str must point to a buffer which is at least 48 B long */
#pragma aux processor_brand_string = \
".586 " \
"mov eax,80000002h " \
"cpuid " \
"mov [esi],eax " \
"mov [esi+4],ebx " \
"mov [esi+8],ecx " \
"mov [esi+12],edx " \
"mov eax,80000003h " \
"cpuid " \
"mov [esi+16],eax " \
"mov [esi+20],ebx " \
"mov [esi+24],ecx " \
"mov [esi+28],edx " \
"mov eax,80000004h " \
"cpuid " \
"mov [esi+32],eax " \
"mov [esi+36],ebx " \
"mov [esi+40],ecx " \
"mov [esi+44],edx " \
parm [esi] \
modify exact [eax ebx ecx edx];
See Watcom 10.6 documentation on "Auxiliary pragmas" in helpviewer.
And Intel Software Developer's Manual - Instruction Set Reference - http://www.intel.com/products/processor/manuals/
stepan hejny
aveco
|
|
|