Author: stepan Date: 2009-11-19 13:55:28 +0100 (Thu, 19 Nov 2009) New Revision: 47
Removed: trunk/SerialICE/patches/serialice-cpuid-ecx.diff Modified: trunk/SerialICE/io.h trunk/SerialICE/serialice.c Log: Only a typo kept the CPUID fix from compiling with romcc. Found the typo so commit this per default:
Some invocations of cpuid honor the ECX register in addition to the EAX register as an input parameter. This patch fixes cpuid in these (rare) cases.
Modified: trunk/SerialICE/io.h =================================================================== --- trunk/SerialICE/io.h 2009-11-19 09:23:30 UTC (rev 46) +++ trunk/SerialICE/io.h 2009-11-19 12:55:28 UTC (rev 47) @@ -162,46 +162,46 @@
/* CPUID functions */
-static inline unsigned int cpuid_eax(unsigned int op) +static inline unsigned int cpuid_eax(unsigned int op, unsigned op2) { unsigned int eax;
__asm__("cpuid" : "=a" (eax) - : "0" (op) + : "0" (op), "2" (op2) : "ebx", "ecx", "edx"); return eax; }
-static inline unsigned int cpuid_ebx(unsigned int op) +static inline unsigned int cpuid_ebx(unsigned int op, unsigned op2) { unsigned int eax, ebx;
__asm__("cpuid" : "=a" (eax), "=b" (ebx) - : "0" (op) + : "0" (op), "2" (op2) : "ecx", "edx" ); return ebx; }
-static inline unsigned int cpuid_ecx(unsigned int op) +static inline unsigned int cpuid_ecx(unsigned int op, unsigned int op2) { unsigned int eax, ecx;
__asm__("cpuid" : "=a" (eax), "=c" (ecx) - : "0" (op) + : "0" (op), "2" (op2) : "ebx", "edx" ); return ecx; }
-static inline unsigned int cpuid_edx(unsigned int op) +static inline unsigned int cpuid_edx(unsigned int op, unsigned int op2) { unsigned int eax, edx;
__asm__("cpuid" : "=a" (eax), "=d" (edx) - : "0" (op) + : "0" (op), "2" (op2) : "ebx", "ecx"); return edx; }
Deleted: trunk/SerialICE/patches/serialice-cpuid-ecx.diff =================================================================== --- trunk/SerialICE/patches/serialice-cpuid-ecx.diff 2009-11-19 09:23:30 UTC (rev 46) +++ trunk/SerialICE/patches/serialice-cpuid-ecx.diff 2009-11-19 12:55:28 UTC (rev 47) @@ -1,87 +0,0 @@ -Index: serialice.c -=================================================================== ---- serialice.c (revision 18) -+++ serialice.c (working copy) -@@ -161,19 +161,19 @@ - * have to worry about running out of registers if we - * occupy eax, ebx, ecx, edx at the same time - */ -- reg32 = cpuid_eax(eax); -+ reg32 = cpuid_eax(eax, ecx); - sio_put32(reg32); - sio_putc('.'); - -- reg32 = cpuid_ebx(eax); -+ reg32 = cpuid_ebx(eax, ecx); - sio_put32(reg32); - sio_putc('.'); - -- reg32 = cpuid_ecx(eax); -+ reg32 = cpuid_ecx(eax, ecx); - sio_put32(reg32); - sio_putc('.'); - -- reg32 = cpuid_edx(eax); -+ reg32 = cpuid_edx(eax, ecx); - sio_put32(reg32); - } - -Index: io.h -=================================================================== ---- io.h (revision 12) -+++ io.h (working copy) -@@ -162,46 +162,46 @@ - - /* CPUID functions */ - --static inline unsigned int cpuid_eax(unsigned int op) -+static inline unsigned int cpuid_eax(unsigned int op, unsigned op2) - { - unsigned int eax; - - __asm__("cpuid" - : "=a" (eax) -- : "0" (op) -+ : "0" (op), "2" (op) - : "ebx", "ecx", "edx"); - return eax; - } - --static inline unsigned int cpuid_ebx(unsigned int op) -+static inline unsigned int cpuid_ebx(unsigned int op, unsigned op2) - { - unsigned int eax, ebx; - - __asm__("cpuid" - : "=a" (eax), "=b" (ebx) -- : "0" (op) -+ : "0" (op), "2" (op2) - : "ecx", "edx" ); - return ebx; - } - --static inline unsigned int cpuid_ecx(unsigned int op) -+static inline unsigned int cpuid_ecx(unsigned int op, unsigned int op2) - { - unsigned int eax, ecx; - - __asm__("cpuid" - : "=a" (eax), "=c" (ecx) -- : "0" (op) -+ : "0" (op), "2" (op2) - : "ebx", "edx" ); - return ecx; - } - --static inline unsigned int cpuid_edx(unsigned int op) -+static inline unsigned int cpuid_edx(unsigned int op, unsigned int op2) - { - unsigned int eax, edx; - - __asm__("cpuid" - : "=a" (eax), "=d" (edx) -- : "0" (op) -+ : "0" (op), "2" (op2) - : "ebx", "ecx"); - return edx; - }
Modified: trunk/SerialICE/serialice.c =================================================================== --- trunk/SerialICE/serialice.c 2009-11-19 09:23:30 UTC (rev 46) +++ trunk/SerialICE/serialice.c 2009-11-19 12:55:28 UTC (rev 47) @@ -161,19 +161,19 @@ * have to worry about running out of registers if we * occupy eax, ebx, ecx, edx at the same time */ - reg32 = cpuid_eax(eax); + reg32 = cpuid_eax(eax, ecx); sio_put32(reg32); sio_putc('.');
- reg32 = cpuid_ebx(eax); + reg32 = cpuid_ebx(eax, ecx); sio_put32(reg32); sio_putc('.');
- reg32 = cpuid_ecx(eax); + reg32 = cpuid_ecx(eax, ecx); sio_put32(reg32); sio_putc('.');
- reg32 = cpuid_edx(eax); + reg32 = cpuid_edx(eax, ecx); sio_put32(reg32); }