-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpcpu.c
46 lines (33 loc) · 831 Bytes
/
pcpu.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "typedef.h"
#include "lib.h"
#include "log.h"
#include "coproc_def.h"
#include "asm_func.h"
#include "vcpu.h"
#include "pcpu.h"
/* defined in phys_cpu_setting.c */
extern pcpu_t phys_cpus[CPU_NUM];
/* TODO */
pcpu_t *current_phys_cpu_core_init(void){
uint32_t cpu_id;
pcpu_t *phys_cpu;
READ_CPUID(cpu_id);
if(cpu_id >= CPU_NUM)
hyp_panic("illegal cpu id : %#x\n", cpu_id);
phys_cpu = &phys_cpus[cpu_id];
phys_cpu->cpu_id = cpu_id;
phys_cpu->current_vcpu = NULL;
phys_cpu->last_vcpu = NULL;
READ_SYSREG(phys_cpu->freq, CNTFRQ_EL0);
return phys_cpu;
}
pcpu_t *get_current_phys_cpu(void){
uint32_t cpu_id;
READ_CPUID(cpu_id);
return &phys_cpus[cpu_id];
}
pcpu_t *get_phys_cpu_by_cpu_id(uint8_t cpu_id){
return &phys_cpus[cpu_id];
}
void *phys_cpu_relax(pcpu_t *phys_cpu){
}