From 9710282b371d7f5f47eccb76fe0379141c54cf94 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Tue, 4 Feb 2020 07:26:28 +0900 Subject: [PATCH] Move CPU_ID macro to kernel/include/arch.h --- kernel/arch/cpu.h | 12 ------------ kernel/include/arch.h | 8 +++++++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/kernel/arch/cpu.h b/kernel/arch/cpu.h index da1062a..9746a4d 100644 --- a/kernel/arch/cpu.h +++ b/kernel/arch/cpu.h @@ -118,18 +118,6 @@ struct cpu { struct task *cpu_task; } __attribute__((packed)); -#if defined(CONFIG_SMP) && CONFIG_SMP_CPUS > 1 - -int cpu_get_id(void); -#define CPU_ID cpu_get_id() - -#else - -#define CPU_ID 0 - -#endif /* CONFIG_SMP */ - - void _segment_descriptor_set(segment_descriptor_t*, u32_t, u32_t, u32_t, u32_t); #endif /* __CPU_H */ diff --git a/kernel/include/arch.h b/kernel/include/arch.h index 9707be8..4741ab2 100644 --- a/kernel/include/arch.h +++ b/kernel/include/arch.h @@ -142,6 +142,12 @@ struct region { u32_t reg_refs; }; +#if FEATURE(SMP) && FEATURE(APIC) +#define CPU_ID cpu_get_id() +#else /* !(FEATURE(SMP) && FEATURE(APIC)) */ +#define CPU_ID 0 +#endif /* !(FEATURE(SMP) && FEATURE(APIC)) */ + int cpu_get_id(void); u64_t cpu_get_capabilities(void); u64_t cpu_timestamp(void); @@ -206,7 +212,7 @@ int pg_dir_create(pg_dir_t**); * The number of pages that will be mapped depends on the page directory. If * PAE-mode paging is employed, pg_dir_map() will attempt to map pages of the * largest-possible size, meaning that it will attempt to map 4M pages if the - * alignment of the addresses and the page directory's page size permitts. + * alignment of the addresses and the page directory's page size permits. * Any pages that have been mapped into the page directory will have their * page attributes set according to the value passed in `attrs'. * The PAGE_ATTR_PRESENT will be set regardless of the value in `attrs'. -- 2.47.3