diff options
author | Damien Zammit <damien@zamaudio.com> | 2023-09-24 10:34:49 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-09-24 14:37:50 +0200 |
commit | 31d45d0d8ee1d8eee96fc2a283a388b6b6aca669 (patch) | |
tree | a95db566461b2cb4d5fac435b32bbc8349664fc3 /i386 | |
parent | 74a1d4600a53541f5c89d55c6d4efd3210fe992d (diff) | |
download | gnumach-31d45d0d8ee1d8eee96fc2a283a388b6b6aca669.tar.gz gnumach-31d45d0d8ee1d8eee96fc2a283a388b6b6aca669.tar.bz2 gnumach-31d45d0d8ee1d8eee96fc2a283a388b6b6aca669.zip |
cpu_number: Inline widely used simple function
TESTED: on uniprocessor and smp, both behaved as normal.
Message-Id: <20230924103428.455966-2-damien@zamaudio.com>
Diffstat (limited to 'i386')
-rw-r--r-- | i386/Makefrag_x86.am | 1 | ||||
-rw-r--r-- | i386/i386/cpu_number.c | 30 | ||||
-rw-r--r-- | i386/i386/cpu_number.h | 10 |
3 files changed, 8 insertions, 33 deletions
diff --git a/i386/Makefrag_x86.am b/i386/Makefrag_x86.am index 46c1d38b..272de023 100644 --- a/i386/Makefrag_x86.am +++ b/i386/Makefrag_x86.am @@ -18,7 +18,6 @@ libkernel_a_SOURCES += \ i386/i386/ast_check.c \ i386/i386/ast_types.h \ i386/i386/cpu.h \ - i386/i386/cpu_number.c \ i386/i386/cpu_number.h \ i386/i386/db_disasm.c \ i386/i386/db_interface.c \ diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c deleted file mode 100644 index ef19e11f..00000000 --- a/i386/i386/cpu_number.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022 Free Software Foundation, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <i386/cpu_number.h> -#include <i386/apic.h> -#include <i386/smp.h> -#include <i386/cpu.h> -#include <i386/mp_desc.h> -#include <kern/printf.h> - -#if NCPUS > 1 -int cpu_number(void) -{ - return cpu_id_lut[apic_get_current_cpu()]; -} -#endif diff --git a/i386/i386/cpu_number.h b/i386/i386/cpu_number.h index 479a847a..8357be84 100644 --- a/i386/i386/cpu_number.h +++ b/i386/i386/cpu_number.h @@ -64,8 +64,14 @@ popl %esi ;\ #ifndef __ASSEMBLER__ -#include "kern/cpu_number.h" -int cpu_number(void); +#include <kern/cpu_number.h> +#include <i386/apic.h> + +static inline int cpu_number(void) +{ + return cpu_id_lut[apic_get_current_cpu()]; +} + #endif #else /* NCPUS == 1 */ |