diff options
author | Andrew Waterman <andrew@sifive.com> | 2017-02-20 21:43:09 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2017-02-20 21:43:09 -0800 |
commit | f6bca6e35b66632afad68f6b7fb2b3203c8502fb (patch) | |
tree | 3f8d691713d96ef4e7f57b8504691e68cdcda6f7 /pk | |
parent | 59484c94e161b0f1870096cfb183533b20569669 (diff) | |
download | pk-f6bca6e35b66632afad68f6b7fb2b3203c8502fb.zip pk-f6bca6e35b66632afad68f6b7fb2b3203c8502fb.tar.gz pk-f6bca6e35b66632afad68f6b7fb2b3203c8502fb.tar.bz2 |
Don't block for acks on console writes
Diffstat (limited to 'pk')
-rw-r--r-- | pk/mmap.c | 12 | ||||
-rw-r--r-- | pk/mmap.h | 1 | ||||
-rw-r--r-- | pk/pk.lds | 4 |
3 files changed, 9 insertions, 8 deletions
@@ -20,6 +20,7 @@ typedef struct { static spinlock_t vm_lock = SPINLOCK_INIT; static vmr_t* vmrs; +uintptr_t first_free_paddr; static uintptr_t first_free_page; static size_t next_free_page; static size_t free_pages; @@ -385,15 +386,14 @@ void populate_mapping(const void* start, size_t size, int prot) uintptr_t pk_vm_init() { -#if __riscv_xlen == 32 - // We can't support more than 2 GiB of memory in RV32 + // HTIF address signedness and va2pa macro both cap memory size to 2 GiB mem_size = MIN(mem_size, 1U << 31); -#endif - size_t mem_pages = mem_size >> RISCV_PGSHIFT; free_pages = MAX(8, mem_pages >> (RISCV_PGLEVEL_BITS-1)); - first_free_page = first_free_paddr; - first_free_paddr += free_pages * RISCV_PGSIZE; + + extern char _end; + first_free_page = ROUNDUP((uintptr_t)&_end, RISCV_PGSIZE); + first_free_paddr = first_free_page + free_pages * RISCV_PGSIZE; root_page_table = (void*)__page_alloc(); __map_kernel_range(DRAM_BASE, DRAM_BASE, first_free_paddr - DRAM_BASE, PROT_READ|PROT_WRITE|PROT_EXEC); @@ -33,6 +33,7 @@ uintptr_t do_mprotect(uintptr_t addr, size_t length, int prot); uintptr_t do_brk(uintptr_t addr); #define va2pa(va) ({ uintptr_t __va = (uintptr_t)(va); \ + extern uintptr_t first_free_paddr; \ __va >= DRAM_BASE ? __va : __va + first_free_paddr; }) #endif @@ -44,9 +44,9 @@ SECTIONS /* HTIF, isolated onto separate page */ /*--------------------------------------------------------------------*/ . = ALIGN(0x1000); - htif : + .htif : { - *(htif) + *(.htif) } . = ALIGN(0x1000); |