From 2062e7070710989abf7271838efb99cbfbe511d0 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Sun, 12 Sep 2021 12:53:33 -0500 Subject: SMP fixed for CPUs with defective cores modified: README.md modified: src/.gdb_history modified: src/bootloader/enter_kernel.asm modified: src/bootloader/gdt.asm modified: src/debug/gdbinit.gdb modified: src/include/int.h modified: src/include/paging.h modified: src/include/smp.h modified: src/include/smp_sync.h modified: src/indigo_os modified: src/kernel/int.c modified: src/kernel/kernel.c modified: src/kernel/klog.c modified: src/kernel/madt.c modified: src/kernel/page.c modified: src/kernel/panic.c modified: src/kernel/printf.c modified: src/kernel/smp.c modified: src/kernel/smp_trampoline.asm modified: .gitignore deleted: src/.gdb_history --- src/include/int.h | 1 + src/include/paging.h | 2 +- src/include/smp.h | 22 ++++++++++++++++++++++ src/include/smp_sync.h | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/int.h b/src/include/int.h index 32313bd..6f1857b 100644 --- a/src/include/int.h +++ b/src/include/int.h @@ -79,6 +79,7 @@ void clear_int(); unsigned int alloc_idt(struct idt_entry *entry); void free_idt(unsigned int entry); void modify_idt(struct idt_entry *entry, unsigned int vector); +void smp_load_idt(); #endif diff --git a/src/include/paging.h b/src/include/paging.h index 302e567..5d33ca5 100644 --- a/src/include/paging.h +++ b/src/include/paging.h @@ -9,7 +9,7 @@ void unmap_lowmem(); size_t map_complete_physical(); -void debug_print_memory(); +void debug_pzone(); struct phys_map *init_pmap(size_t pagetable_size); diff --git a/src/include/smp.h b/src/include/smp.h index c4a675a..f4e3aa8 100644 --- a/src/include/smp.h +++ b/src/include/smp.h @@ -1,4 +1,26 @@ #ifndef SMP_INCLUDED #define SMP_INCLUDED +#include void smp_boot(); +extern uint8_t corecount; + +static inline void lock(uint8_t *lock) { + asm("mov al, 1\n" + "spinlock:\n" + "lock xchgb [%0], al\n" + "test al, al\n" + "pause\n" + "jnz spinlock\n" + ::"r"(lock):"al"); +} + +static inline void unlock(uint8_t *lock) { + asm("lock andb [%0], 0"::"r"(lock)); +} + +static inline void waitup(uint8_t *loto) { +} + +#define CREATE_LOTO(name) + #endif diff --git a/src/include/smp_sync.h b/src/include/smp_sync.h index 92784b8..93aac35 100644 --- a/src/include/smp_sync.h +++ b/src/include/smp_sync.h @@ -6,6 +6,7 @@ static inline void lock(uint8_t *lock) { "spinlock:\n" "lock xchgb [%0], al\n" "test al, al\n" + "pause\n" "jnz spinlock\n" ::"r"(lock):"al"); } @@ -14,4 +15,9 @@ static inline void unlock(uint8_t *lock) { asm("lock andb [%0], 0"::"r"(lock)); } +static inline void waitup(uint8_t *loto) { +} + +#define CREATE_LOTO(name) + #endif -- cgit v1.2.3