Mail Archives: djgpp-workers/2000/05/28/15:07:55
Here is the cvs diff for uname() patches. How do I get new files
reported? -N doesn't work. It's for the wc204.txi file.
Right,
MartinS
----- wc204.txi starts. ------
@node Changes in 2.04, , Changes in 2.03, What Changed
@section Changes in 2.04
Here is a list of changes from DJGPP V2.03 to V2.04.
@findex uname
Ability to detect which CPU in @file{uname.c}.
----- wc204.txi ends. ------
----- uname cvs diff starts. ------
? djgpp/src/docs/kb/wc204.txi
Index: djgpp/src/docs/kb/wc.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc.txi,v
retrieving revision 1.3
diff -p -3 -r1.3 wc.txi
*** wc.txi 1999/03/20 20:51:11 1.3
--- wc.txi 2000/05/28 18:59:30
***************
*** 6,14 ****
--- 6,16 ----
* Changes in 2.01:: DJGPP 2.01
* Changes in 2.02:: DJGPP 2.02
* Changes in 2.03:: DJGPP 2.03
+ * Changes in 2.04:: DJGPP 2.04
@end menu
@include wc201.txi
@include wc202.txi
@include wc203.txi
+ @include wc204.txi
Index: djgpp/src/docs/kb/wc203.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc203.txi,v
retrieving revision 1.72
diff -p -3 -r1.72 wc203.txi
*** wc203.txi 2000/01/04 21:32:06 1.72
--- wc203.txi 2000/05/28 18:59:34
***************
*** 1,4 ****
! @node Changes in 2.03, , Changes in 2.02, What Changed
@section Changes in 2.03
Here is a list of changes from DJGPP V2.02 to V2.03
--- 1,4 ----
! @node Changes in 2.03, Changes in 2.04, Changes in 2.02, What Changed
@section Changes in 2.03
Here is a list of changes from DJGPP V2.02 to V2.03
Index: djgpp/src/libc/posix/utsname/uname.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/utsname/uname.c,v
retrieving revision 1.3
diff -p -3 -r1.3 uname.c
*** uname.c 1996/10/05 21:39:50 1.3
--- uname.c 2000/05/28 18:59:50
*************** int uname(struct utsname *u)
*** 13,18 ****
--- 13,21 ----
{
__dpmi_regs r;
unsigned short dos_version;
+ unsigned is_486_or_better;
+ unsigned cpuid_support;
+ unsigned cpuid_info;
if (!u)
{
*************** int uname(struct utsname *u)
*** 25,31 ****
u->sysname[sizeof(u->sysname) - 1] = '\0';
sprintf(u->release, "%d", dos_version >> 8);
sprintf(u->version, "%02d", dos_version & 0xff);
! strcpy(u->machine, "pc");
r.x.ax = 0x5e00;
r.x.ds = __tb >> 4;
--- 28,108 ----
u->sysname[sizeof(u->sysname) - 1] = '\0';
sprintf(u->release, "%d", dos_version >> 8);
sprintf(u->version, "%02d", dos_version & 0xff);
!
! /* CPU detection code by Laurynas Biveinis */
! /* Uses Phil Frisbie, Jr 386 and CPUID detection code */
!
! /* Let's check for 386. Intel says that 386 is unable to set or clear */
! /* value of 18 bit in EFLAGS (AC). So we toggle this bit and see if */
! /* we succeed */
! asm volatile (
! "pushf;"
! "popl %%eax;"
! "movl %%eax, %%ebx;"
! "xorl $0x40000, %%eax;"
! "pushl %%eax;"
! "popf;"
! "pushf;"
! "popl %%eax;"
! "cmpl %%ebx, %%eax;"
! "jz 0f;"
! "movl $1, %0;" /* 80486+ present */
! "jmp 1f;"
! "0:"
! "movl $0, %0;" /* 80386 present */
! "1:"
! "pushl %%ebx;" /* get original EFLAGS */
! "popf;" /* restore EFLAGS */
! : "=g" (is_486_or_better)
! :
! : "eax", "ebx");
! if (is_486_or_better)
! {
! /* In the same way we checked for 386, we will check for CPUID now, */
! /* using 21 bit in EFLAGS (ID bit) */
! asm volatile (
! "pushf;" /* get extended flags */
! "popl %%eax;"
! "movl %%eax, %%ebx;" /* save current flags */
! "xorl $0x200000, %%eax;" /* toggle bit 21 */
! "pushl %%eax;" /* put new flags on stack */
! "popfl;" /* flags updated now in flags */
! "pushfl;" /* get extended flags */
! "popl %%eax;"
! "xorl %%ebx, %%eax;" /* if bit 21 r/w then supports cpuid */
! "jz 0f;"
! "movl $1, %0;"
! "jmp 1f;"
! "0:"
! "movl $0, %0;"
! "1:"
! "pushl %%ebx;" /* Restore */
! "popfl;" /* original EFLAGS */
! : "=g" (cpuid_support)
! :
! : "%eax", "%ebx");
! if (cpuid_support)
! {
! /* Now we can use CPUID */
! asm volatile (
! "movl $1, %%eax;"
! "cpuid;"
! : "=a" (cpuid_info)
! :
! : "%ebx", "%ecx", "%edx");
! /* What we need is instruction family info in 8-11 bits */
! switch ((cpuid_info & 0x780) >> 8)
! {
! case 0x6: strcpy(u->machine, "i686"); break;
! case 0x5: strcpy(u->machine, "i586"); break;
! case 0x4: strcpy(u->machine, "i486"); break;
! }
! }
! else
! strcpy(u->machine, "i486"); // i486 not supporting CPUID
! }
! else
! strcpy(u->machine, "i386");
r.x.ax = 0x5e00;
r.x.ds = __tb >> 4;
Index: djgpp/src/libc/posix/utsname/uname.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/utsname/uname.txh,v
retrieving revision 1.2
diff -p -3 -r1.2 uname.txh
*** uname.txh 1998/09/27 15:22:28 1.2
--- uname.txh 2000/05/28 18:59:50
***************
*** 4,10 ****
@example
#include <sys/utsname.h>
! #int uname(struct utsname *u);
@end example
@subheading Description
--- 4,10 ----
@example
#include <sys/utsname.h>
! int uname(struct utsname *u);
@end example
@subheading Description
*************** struct utsname @{
*** 25,31 ****
@item machine
! "pc"
@item nodename
--- 25,31 ----
@item machine
! The CPU family type: "i386", "i486", "i586" or "i686".
@item nodename
----- uname cvs diff ends. ------
- Raw text -