Halt syscall and userspace util. Mapped qemu power.
This commit is contained in:
parent
e94eecd9a1
commit
146e7f65ca
4 changed files with 8 additions and 1 deletions
|
@ -23,6 +23,8 @@
|
|||
#define UART0 0x10000000L
|
||||
#define UART0_IRQ 10
|
||||
|
||||
#define QEMU_POWER 0x100000
|
||||
|
||||
// virtio mmio interface
|
||||
#define VIRTIO0 0x10001000
|
||||
#define VIRTIO0_IRQ 1
|
||||
|
|
|
@ -100,5 +100,6 @@ sys_trace(void)
|
|||
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();
|
||||
memset(kpgtbl, 0, PGSIZE);
|
||||
|
||||
// Map qemu
|
||||
kvmmap(kpgtbl, QEMU_POWER, QEMU_POWER, PGSIZE, PTE_R | PTE_W);
|
||||
|
||||
// uart registers
|
||||
kvmmap(kpgtbl, UART0, UART0, PGSIZE, PTE_R | PTE_W);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
printf("System powering down...\n");
|
||||
halt();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue