mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-08 17:40:31 +00:00
Now that printf() needs the PCPU, set it up before we call printf().
Change the pc_pcb field from a pointer to struct pcb to struct pcb so that sizeof(struct pcb) includes the PCB we use for IPI_STOP. Statically declare early_pcb so that we don't have to allocate the PCB for thread0. This way we can setup the PCPU before cninit() and thus before we use printf().
This commit is contained in:
parent
2fd31a5e0d
commit
77121031e7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164392
|
@ -224,7 +224,7 @@ interrupt(u_int64_t vector, struct trapframe *tf)
|
|||
cpumask_t mybit = PCPU_GET(cpumask);
|
||||
|
||||
intr = intr_disable();
|
||||
savectx(PCPU_GET(pcb));
|
||||
savectx(PCPU_PTR(pcb));
|
||||
atomic_set_int(&stopped_cpus, mybit);
|
||||
while ((started_cpus & mybit) == 0)
|
||||
/* spin */;
|
||||
|
|
|
@ -403,17 +403,7 @@ cpu_throw(struct thread *old __unused, struct thread *new)
|
|||
void
|
||||
cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
|
||||
{
|
||||
size_t pcpusz;
|
||||
|
||||
/*
|
||||
* Make sure the PCB is 16-byte aligned by making the PCPU
|
||||
* a multiple of 16 bytes. We assume the PCPU is 16-byte
|
||||
* aligned itself.
|
||||
*/
|
||||
pcpusz = (sizeof(struct pcpu) + 15) & ~15;
|
||||
KASSERT(size >= pcpusz + sizeof(struct pcb),
|
||||
("%s: too small an allocation for pcpu", __func__));
|
||||
pcpu->pc_pcb = (struct pcb *)((char*)pcpu + pcpusz);
|
||||
pcpu->pc_acpi_id = cpuid;
|
||||
}
|
||||
|
||||
|
@ -610,6 +600,13 @@ ia64_init(void)
|
|||
if (boothowto & RB_VERBOSE)
|
||||
bootverbose = 1;
|
||||
|
||||
/*
|
||||
* Setup the global data for the bootstrap cpu.
|
||||
*/
|
||||
pcpup = &early_pcpu;
|
||||
ia64_set_k4((u_int64_t)pcpup);
|
||||
pcpu_init(pcpup, 0, sizeof(early_pcpu));
|
||||
|
||||
/*
|
||||
* Initialize the console before we print anything out.
|
||||
*/
|
||||
|
@ -781,19 +778,10 @@ ia64_init(void)
|
|||
#else
|
||||
proc_linkup(&proc0, &thread0);
|
||||
#endif
|
||||
/*
|
||||
* Init mapping for kernel stack for proc 0
|
||||
*/
|
||||
|
||||
proc0kstack = (vm_offset_t)kstack;
|
||||
thread0.td_kstack = proc0kstack;
|
||||
thread0.td_kstack_pages = KSTACK_PAGES;
|
||||
|
||||
/*
|
||||
* Setup the global data for the bootstrap cpu.
|
||||
*/
|
||||
pcpup = (struct pcpu *)pmap_steal_memory(PAGE_SIZE);
|
||||
ia64_set_k4((u_int64_t)pcpup);
|
||||
pcpu_init(pcpup, 0, PAGE_SIZE);
|
||||
PCPU_SET(curthread, &thread0);
|
||||
|
||||
mutex_init();
|
||||
|
|
|
@ -200,8 +200,8 @@ cpu_mp_add(u_int acpiid, u_int apicid, u_int apiceid)
|
|||
}
|
||||
|
||||
if (acpiid != 0) {
|
||||
pc = (struct pcpu *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
pcpu_init(pc, acpiid, PAGE_SIZE);
|
||||
pc = (struct pcpu *)malloc(sizeof(*pc), M_PMAP, M_WAITOK);
|
||||
pcpu_init(pc, acpiid, sizeof(*pc));
|
||||
} else
|
||||
pc = pcpup;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <machine/frame.h>
|
||||
#include <machine/ia64_cpu.h>
|
||||
|
||||
#define KDB_STOPPEDPCB(pc) (pc)->pc_pcb
|
||||
#define KDB_STOPPEDPCB(pc) (&(pc)->pc_pcb)
|
||||
|
||||
static __inline void
|
||||
kdb_cpu_clear_singlestep(void)
|
||||
|
|
|
@ -32,13 +32,15 @@
|
|||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <machine/pcb.h>
|
||||
|
||||
#define PCPU_MD_FIELDS \
|
||||
struct pcb *pc_pcb; /* Used by IPI_STOP */ \
|
||||
struct pcb pc_pcb; /* Used by IPI_STOP */ \
|
||||
struct pmap *pc_current_pmap; /* active pmap */ \
|
||||
uint64_t pc_lid; /* local CPU ID */ \
|
||||
uint32_t pc_awake:1; /* CPU is awake? */ \
|
||||
uint64_t pc_clock; /* Clock counter. */ \
|
||||
uint64_t pc_clockadj; /* Clock adjust. */ \
|
||||
uint32_t pc_awake:1; /* CPU is awake? */ \
|
||||
uint32_t pc_acpi_id /* ACPI CPU id. */
|
||||
|
||||
struct pcpu;
|
||||
|
|
Loading…
Reference in a new issue