Compare commits
2 commits
ced7c79bd8
...
146e7f65ca
Author | SHA1 | Date | |
---|---|---|---|
|
146e7f65ca | ||
|
e94eecd9a1 |
5 changed files with 10 additions and 2 deletions
|
@ -30,10 +30,11 @@ main()
|
||||||
} else {
|
} else {
|
||||||
while(started == 0) {}
|
while(started == 0) {}
|
||||||
__sync_synchronize();
|
__sync_synchronize();
|
||||||
printf("hart %d starting\n", cpuid());
|
printf("Hart/Core [%d]: Starting\n", cpuid());
|
||||||
kvminithart(); // turn on paging
|
kvminithart(); // turn on paging
|
||||||
trapinithart(); // install kernel trap vector
|
trapinithart(); // install kernel trap vector
|
||||||
plicinithart(); // ask PLIC for device interrupts
|
plicinithart(); // ask PLIC for device interrupts
|
||||||
|
printf("Hart/Core [%d]: Online\n", cpuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler();
|
scheduler();
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#define UART0 0x10000000L
|
#define UART0 0x10000000L
|
||||||
#define UART0_IRQ 10
|
#define UART0_IRQ 10
|
||||||
|
|
||||||
|
#define QEMU_POWER 0x100000
|
||||||
|
|
||||||
// virtio mmio interface
|
// virtio mmio interface
|
||||||
#define VIRTIO0 0x10001000
|
#define VIRTIO0 0x10001000
|
||||||
#define VIRTIO0_IRQ 1
|
#define VIRTIO0_IRQ 1
|
||||||
|
|
|
@ -100,5 +100,6 @@ sys_trace(void)
|
||||||
void
|
void
|
||||||
sys_halt(void)
|
sys_halt(void)
|
||||||
{
|
{
|
||||||
/* TODO: Implement sys_halt */
|
(*(volatile u32 *)QEMU_POWER) = 0x5555;
|
||||||
|
panic("sys_poweroff");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ kvmmake(void)
|
||||||
kpgtbl = (pagetable_t)kalloc();
|
kpgtbl = (pagetable_t)kalloc();
|
||||||
memset(kpgtbl, 0, PGSIZE);
|
memset(kpgtbl, 0, PGSIZE);
|
||||||
|
|
||||||
|
// Map qemu
|
||||||
|
kvmmap(kpgtbl, QEMU_POWER, QEMU_POWER, PGSIZE, PTE_R | PTE_W);
|
||||||
|
|
||||||
// uart registers
|
// uart registers
|
||||||
kvmmap(kpgtbl, UART0, UART0, PGSIZE, PTE_R | PTE_W);
|
kvmmap(kpgtbl, UART0, UART0, PGSIZE, PTE_R | PTE_W);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
printf("System powering down...\n");
|
||||||
halt();
|
halt();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue