Go to the documentation of this file.
33 #include <lib/string.h>
44 static inline unsigned int apicRead(address) {
45 return *(
volatile unsigned int *) (0xFEE00000 + address);
48 static inline void apicWrite(
unsigned int address,
unsigned int data) {
49 *(
volatile unsigned int *) (0xFEE00000 + address) = data;
52 static __inline__
void setDr3 (
void *dr3) {
54 __asm__ __volatile__ (
"mov %0, %%dr3" ::
"r" (value));
57 static __inline__
uInt32 getDr3 (
void) {
59 __asm__ __volatile__ (
"mov %%dr3, %0" :
"=r" (value));
68 static void GDT_fixer() {
130 return(
'0' + cpu->
id);
172 kpanic(
"CPU doesn't support CPUID, get a newer machine\n");
183 kpanic(
"CPU doesn't support CPUID, get a newer machine\n");
203 cpuid(0x80000000,data);
204 if(data[0]>=0x80000004) {
206 cpuid(0x80000002 + i,data);
208 *(
unsigned int *)&
cpuinfo[cpus].
brand[16*i+0] = data[0];
209 *(
unsigned int *)&
cpuinfo[cpus].
brand[16*i+4] = data[1];
210 *(
unsigned int *)&
cpuinfo[cpus].
brand[16*i+8] = data[2];
211 *(
unsigned int *)&
cpuinfo[cpus].
brand[16*i+12] = data[3];
239 apicWrite(0x300, 0x000C4500);
240 for (tmp = 0; tmp < 800000; tmp++)
243 apicWrite(0x300, 0x000C4600);
244 for (tmp = 0; tmp < 800000; tmp++)
247 apicWrite(0x300, 0x000C4600);
248 for (tmp = 0; tmp < 800000; tmp++)
277 " movl 12(%esp),%eax \n"
278 " movl 16(%esp),%edi \n"
280 " movl %eax,0(%edi) \n"
281 " movl %ebx,4(%edi) \n"
282 " movl %ecx,8(%edi) \n"
283 " movl %edx,12(%edi) \n"
unsigned short int uInt16
void outportByte(unsigned int, unsigned char)
outputut one byte to specified port
uInt8 kernel_function(void)
void spinUnlock(spinLock_t *lock)
#define SPIN_LOCK_INITIALIZER
void ap_trampoline_start()
void kpanic(const char *fmt,...)
print panic message and halt system
void * memcpy(const void *dst, const void *src, size_t length)
void spinLock(spinLock_t *lock)
int spinLockLocked(spinLock_t *lock)
uInt32 *base __attribute__((packed))
void cpuid(uInt32, uInt32 *)
void setEflags(uInt32 eflags)
struct cpuinfo_t cpuinfo[8]
int kprintf(const char *,...)