On Thu, Dec 19, 2013 at 07:54:47PM +0100, Roger Pau Monne wrote:
> This hook will only be implemented for bare metal, Xen doesn't require
> any bootstrap code since APs are started in long mode with paging
> enabled.
> ---
> sys/amd64/amd64/machdep.c |6 +-
> sys/amd64/include/sysarch.h |3 +++
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
> index 6bbfe5a..a811a9b 100644
> --- a/sys/amd64/amd64/machdep.c
> +++ b/sys/amd64/amd64/machdep.c
> @@ -186,6 +186,9 @@ struct init_ops init_ops = {
> .early_delay_init = i8254_init,
> .early_delay = i8254_delay,
> .parse_memmap = native_parse_memmap,
> +#ifdef SMP
> + .mp_bootaddress = mp_bootaddress,
> +#endif
> };
>
> /*
> @@ -1507,7 +1510,8 @@ getmemsize(caddr_t kmdp, u_int64_t first)
>
> #ifdef SMP
> /* make hole for AP bootstrap code */
> - physmap[1] = mp_bootaddress(physmap[1] / 1024);
> + if (init_ops.mp_bootaddress)
> + physmap[1] = init_ops.mp_bootaddress(physmap[1] / 1024);
> #endif
>
> /*
> diff --git a/sys/amd64/include/sysarch.h b/sys/amd64/include/sysarch.h
> index 084223e..77f4b29 100644
> --- a/sys/amd64/include/sysarch.h
> +++ b/sys/amd64/include/sysarch.h
> @@ -16,6 +16,9 @@ struct init_ops {
> void(*early_delay_init)(void);
> void(*early_delay)(int);
> void(*parse_memmap)(caddr_t, vm_paddr_t *, int *);
> +#ifdef SMP
> + u_int (*mp_bootaddress)(u_int);
> +#endif
> };
>
> extern struct init_ops init_ops;
I suggest to make the init_ops contain the mp_bootaddress unconditionally,
instead of making it depended on SMP. The #ifdef makes the kernel binary
interface fragile and depended on the config, which would cause problems
in future if any module needs any interation with init_ops.
pgpvtMJQoKY9a.pgp
Description: PGP signature