summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-08-04 19:48:22 +0000
committerThomas Bushnell <thomas@gnu.org>1997-08-04 19:48:22 +0000
commit68ac5af4b7070bf7d551ae72fe32f7d5b5216e7e (patch)
tree68176602abae0d2ba5e1c34d381344e3b0827132 /i386
parenta7664d03a1baaba45c72bdb92f4b0cfcb16463ed (diff)
Sun Aug 3 18:25:38 1997 Shantanu Goel <goel@cs.columbia.edu>
* i386/i386/thread.h (struct pcb): Added new field `data' used by Linux driver emulation. Fri Aug 1 16:15:33 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * i386/i386/locore.S (discover_x86_cpu_type): Comment out routine for now. * i386/i386at/model_dep.c (c_boot_entry): Comment out use of discover_x86_cpu_type for now. * i386/i386/locore.S (discover_x86_cpu_type): Use correct opcode for right shift. Use ENTRY macro correctly.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/locore.S42
-rw-r--r--i386/i386/thread.h3
2 files changed, 45 insertions, 0 deletions
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 75f20b0..c709562 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1142,6 +1142,48 @@ syscall_addr:
movl $(T_PF_USER),R_ERR(%ebx)
/* set error code - read user space */
jmp _take_trap /* treat as a trap */
+
+
+#if 0
+/* Discover what kind of cpu we have; return the family number
+ (3, 4, 5, 6, for 386, 486, 586, 686 respectively). */
+ENTRY(discover_x86_cpu_type)
+ movl %esp,%edx /* Save stack pointer */
+ and $~0x3,%esp /* Align stack pointer */
+
+ pushfl /* Fetch flags ... */
+ popl %eax /* ... into eax */
+ movl %eax,%ecx /* Save original flags for return */
+ xorl $(EFL_AC+EFL_ID),%eax /* Attempt to toggle ID and AC bits */
+ pushl %eax /* Save flags... */
+ popfl /* ... In EFLAGS */
+ pushfl /* Fetch flags back ... */
+ popl %eax /* ... into eax */
+
+ xorl %ecx,%eax /* See if any bits didn't change */
+ testl $EFL_AC,%eax /* Test AC bit */
+ jnz 0f /* Skip next bit if AC toggled */
+ movl $3,%eax /* Return value is 386 */
+ jmp 9f /* And RETURN */
+
+0: testl $EFL_ID,%eax /* Test ID bit */
+ jnz 0f /* Skip next bit if ID toggled */
+ movl $4,%eax /* Return value is 486 */
+ jmp 9f /* And RETURN */
+
+ /* We are a modern enough processor to have the CPUID instruction;
+ use it to find out what we are. */
+0: movl $1,%eax /* Fetch CPU type info ... */
+ cpuid /* ... into eax */
+ shrl $8,%eax /* Slide family bits down */
+ andl $15,%eax /* And select them */
+
+9: pushl %ecx /* From ecx... */
+ popfl /* ... restore original flags */
+ movl %edx,%esp /* Restore stack pointer */
+ ret /* And return */
+#endif
+
/* */
/*
diff --git a/i386/i386/thread.h b/i386/i386/thread.h
index 922427e..c911127 100644
--- a/i386/i386/thread.h
+++ b/i386/i386/thread.h
@@ -168,6 +168,9 @@ typedef struct pcb {
struct i386_saved_state iss;
struct i386_machine_state ims;
decl_simple_lock_data(, lock)
+#ifdef LINUX_DEV
+ void *data;
+#endif
} *pcb_t;
/*