|Subject:||Re: Enable SMP support|
|Date:||Fri, 15 Jun 2018 18:27:21 +0200|
Ok. I understand you. But then... how can I to define cpu_number() function in multiprocessor? It isn't clear2018-06-15 1:30 GMT+02:00 Amos Jeffries <address@hidden>:On 15/06/18 10:31, Almudena Garcia wrote:
> Yes, I concluded the same a few hours ago. I tried to edit
> kern/cpu_number.h, to add a new definition with many cores, at this form
> int master_cpu; /* 'master' processor - keeps time */
> #if (NCPUS == 1)
> /* cpu number is always 0 on a single processor system */
> #define cpu_number() (0)
> #define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
> #define cpu_number() (NCPUS)
I may be wrong, but that does not seem correct.
The man page for cpu_number() state it to be "an unique CPU
identification number for the CPU that this thread is running on". So it
clearly can change at runtime if there are 2+ CPUs on the machine.
Whereas NCPUS is being used by the precompiler as an integer with fixed
value that can be known at pre-compile time. Implied by the "#if NCPUS >
1" statement which this version of the code omits.
Description: Text Data
|[Prev in Thread]||Current Thread||[Next in Thread]|