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)
#else
#define cpu_number() (NCPUS)
#endif /* NCPUS == 1 */
#endif /* _KERN_CPU_NUMBER_H_ */
But this was unsuccessfull. Now I'm trying to edit i386/i386/cpu_number.h
to hardcode this function
#ifndef _I386_CPU_NUMBER_H_
#define _I386_CPU_NUMBER_H_
#if NCPUS > 1
/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
#define CPU_NUMBER(NCPUS)
#else /* NCPUS == 1 */
#define CPU_NUMBER(reg)
#define CX(addr,reg) addr
#endif /* NCPUS == 1 */
#ifndef __ASSEMBLER__
#include "kern/cpu_number.h"
#endif
But problem continues, so I think that the original problem is in a lower
level than this, (probably there isn't any implementation to multiprocessor
case internally)
2018-06-15 0:14 GMT+02:00 Svante Signell <[email protected]>:
> On Thu, 2018-06-14 at 20:21 +0200, Almudena Garcia wrote:
> > Ok, I found the warning what you refers
> >
> > ../kern/thread.h:401:42: warning: implicit declaration of function
> > ‘cpu_number’; did you mean ‘cpu_idle’? [-Wimplicit-function-
> > declaration]
> >
> > After check the cpu_number.h file, feels that It don't define the
> > cpu_number function in multi-processor mode
> >
> > https://pastebin.com/rnpVCtXp
> >
> > But I don't found the source file to this library, to check the
> > implementation.
>
> Hi Almudena,
>
> Did you see the kernel headers
> i386/i386/cpu_number.h
> ...
> /*
> * Machine-dependent definitions for cpu identification.
> *
> */
> #ifndef _I386_CPU_NUMBER_H_
> #define _I386_CPU_NUMBER_H_
>
> #if NCPUS > 1
>
> /* More-specific code must define cpu_number() and CPU_NUMBER. */
> #define CX(addr, reg) addr(,reg,4)
>
> #else /* NCPUS == 1 */
>
> #define CPU_NUMBER(reg)
> #define CX(addr,reg) addr
>
> #endif /* NCPUS == 1 */
>
> #ifndef __ASSEMBLER__
> #include "kern/cpu_number.h"
> #endif
>
> #endif /* _I386_CPU_NUMBER_H_ */
>
> and kern/cpu_number.h:
>
> #ifndef _KERN_CPU_NUMBER_H_
> #define _KERN_CPU_NUMBER_H_
>
> /*
> * Definitions for cpu identification in multi-processors.
> */
>
> 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)
>
> #endif /* NCPUS == 1 */
> #endif /* _KERN_CPU_NUMBER_H_ */
>
> There are no definitions of cpu_number() for more processors than one
> :(
>