From 68ac5af4b7070bf7d551ae72fe32f7d5b5216e7e Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Mon, 4 Aug 1997 19:48:22 +0000 Subject: Sun Aug 3 18:25:38 1997 Shantanu Goel * 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 * 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. --- i386/i386/locore.S | 42 ++++++++++++++++++++++++++++++++++++++++++ i386/i386/thread.h | 3 +++ 2 files changed, 45 insertions(+) (limited to 'i386') 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; /* -- cgit v1.2.3