diff options
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/intr.c | 1 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 30 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/vector.S | 10 |
3 files changed, 38 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c index 685a16d..a545788 100644 --- a/sys/arch/amd64/amd64/intr.c +++ b/sys/arch/amd64/amd64/intr.c @@ -129,6 +129,7 @@ intr_register(const char *name, const struct intr_hand *ih) ih_new->priority = ih->priority; ih_new->irq = ih->irq; ih_new->vector = i; + ih_new->nintr = 0; g_intrs[i] = ih_new; if (ih->irq >= 0) { diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 123f95b..40950f9 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -189,7 +189,8 @@ enable_simd(void) static void cpu_get_info(struct cpu_info *ci) { - uint32_t unused, ebx; + uint32_t eax, ebx, unused; + uint8_t ext_model, ext_family; /* Extended features */ CPUID(0x07, unused, ebx, unused, unused); @@ -197,6 +198,33 @@ cpu_get_info(struct cpu_info *ci) ci->feat |= CPU_FEAT_SMEP; if (ISSET(ebx, BIT(20))) ci->feat |= CPU_FEAT_SMAP; + + /* + * Processor info and feature bits + */ + CPUID(0x01, eax, unused, unused, unused); + ci->model = (eax >> 4) & 0xF; + ci->family = (eax >> 8) & 0xF; + + /* + * If the family ID is 15 then the actual family + * ID is the sum of the extended family and the + * family ID fields. + */ + if (ci->family == 0xF) { + ext_family = (eax >> 20) & 0xFF; + ci->family += ext_family; + } + + /* + * If the family has the value of either 6 or 15, + * then the extended model number would be used. + * Slap them together if this is the case. + */ + if (ci->family == 6 || ci->family == 15) { + ext_model = (eax >> 16) & 0xF; + ci->model |= (ext_model << 4); + } } void diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S index c820a41..890b314 100644 --- a/sys/arch/amd64/amd64/vector.S +++ b/sys/arch/amd64/amd64/vector.S @@ -51,16 +51,22 @@ ioapic_common_func: jz 1f // Nope, return mov (%rdx), %rbx // intr_hand.func - add $8, %rdx // Get interrupt data + add $16, %rdx // Get interrupt data mov %rdx, %rdi // Pass the interrupt data push %rcx // Save our counter + push %rdx call *%rbx // Call the handler + pop %rdx pop %rcx // Restore our counter or %rax, %rax // Was it theirs? (RET >= 1) - jnz done // Yes, we are done. + jnz handled // Yes, we are done. 1: inc %rcx // Next cmp $256, %rcx // Did we reach the end? jl .walk // Nope, keep going + jmp done // Out of entries +handled: + sub $8, %rdx + addq $1, (%rdx) done: call lapic_eoi retq |