diff options
author | Brett Weiland <brett_weiland@bpcspace.com> | 2021-09-12 12:53:33 -0500 |
---|---|---|
committer | Brett Weiland <brett_weiland@bpcspace.com> | 2021-09-12 12:55:07 -0500 |
commit | 2062e7070710989abf7271838efb99cbfbe511d0 (patch) | |
tree | 1d7b9a7dc04ff8c3f3e3a0f3c54988ecc3087074 /src/include | |
parent | 1f71b9576db536af84155363e14fc49e92de2eef (diff) |
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
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/int.h | 1 | ||||
-rw-r--r-- | src/include/paging.h | 2 | ||||
-rw-r--r-- | src/include/smp.h | 22 | ||||
-rw-r--r-- | src/include/smp_sync.h | 6 |
4 files changed, 30 insertions, 1 deletions
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 <stdint.h> 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 |