//kernel/trunk/genarch/include/fb/fb.h |
---|
35,7 → 35,4 |
extern spinlock_t fb_lock; |
void fb_init(__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan); |
/* To be implemented by architecture. */ |
void fb_map_arch(__address virtaddr, __address physaddr, size_t size); |
#endif |
//kernel/trunk/genarch/Makefile.inc |
---|
67,10 → 67,6 |
genarch/src/fb/font-8x16.c \ |
genarch/src/fb/fb.c |
DEFS += -DCONFIG_FB |
ifneq ($(CONFIG_FB_MAP_ARCH),y) |
GENARCH_SOURCES += \ |
genarch/src/fb/fb_map.c |
endif |
endif |
## i8042 controller |
//kernel/trunk/genarch/src/fb/fb_map.c |
---|
File deleted |
//kernel/trunk/genarch/src/fb/fb.c |
---|
32,7 → 32,6 |
#include <console/console.h> |
#include <sysinfo/sysinfo.h> |
#include <mm/slab.h> |
#include <bitops.h> |
#include <align.h> |
#include <panic.h> |
#include <memstr.h> |
349,18 → 348,10 |
} |
unsigned int fbsize = scan * y; |
unsigned int fborder; |
if (fbsize <= FRAME_SIZE) |
fborder = 0; |
else |
fborder = (fnzb32(fbsize - 1) + 1) - FRAME_WIDTH; |
/* Map the framebuffer */ |
fbaddress = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(fborder, FRAME_KA))); |
fbaddress = (__u8 *) hw_map((__address) addr, fbsize); |
fb_map_arch((__address) fbaddress, (__address) addr, fbsize); |
xres = x; |
yres = y; |
bitspp = bpp; |
//kernel/trunk/generic/include/mm/page.h |
---|
78,5 → 78,6 |
extern pte_t *page_mapping_find(as_t *as, __address page); |
extern pte_t *page_table_create(int flags); |
extern void map_structure(__address s, size_t size); |
extern __address hw_map(__address physaddr, size_t size); |
#endif |
//kernel/trunk/arch/sparc64/Makefile.inc |
---|
65,7 → 65,6 |
# |
CONFIG_FB = y |
CONFIG_FB_MAP_ARCH = y |
## Compile with support for i8042 controller. |
# |
//kernel/trunk/arch/sparc64/src/console.c |
---|
71,12 → 71,6 |
ofw_console_active = 1; |
} |
void fb_map_arch(__address virtaddr, __address physaddr, size_t size) |
{ |
dtlb_insert_mapping(virtaddr, physaddr, PAGESIZE_512K, true, false); |
dtlb_insert_mapping(virtaddr + 512*1024, physaddr + 512*1024, PAGESIZE_512K, true, false); |
} |
/** Initialize kernel console to use framebuffer and keyboard directly. */ |
void standalone_sparc64_console_init(void) |
{ |
//kernel/trunk/arch/sparc64/src/mm/page.c |
---|
27,9 → 27,29 |
*/ |
#include <arch/mm/page.h> |
#include <arch/mm/tlb.h> |
#include <genarch/mm/page_ht.h> |
#include <mm/frame.h> |
#include <bitops.h> |
void page_arch_init(void) |
{ |
page_mapping_operations = &ht_mapping_operations; |
} |
__address hw_map(__address physaddr, size_t size) |
{ |
unsigned int order; |
if (size <= FRAME_SIZE) |
order = 0; |
else |
order = (fnzb32(size - 1) + 1) - FRAME_WIDTH; |
__address virtaddr = PA2KA(PFN2ADDR(frame_alloc(order, FRAME_KA))); |
dtlb_insert_mapping(virtaddr, physaddr, PAGESIZE_512K, true, false); |
dtlb_insert_mapping(virtaddr + 512 * 1024, physaddr + 512 * 1024, PAGESIZE_512K, true, false); |
return virtaddr; |
} |
//kernel/trunk/arch/amd64/src/mm/page.c |
---|
71,6 → 71,8 |
SET_FRAME_ADDRESS_ARCH(ptl3, PTL3_INDEX_ARCH(page), (__address)KA2PA(tgt)); \ |
SET_FRAME_FLAGS_ARCH(ptl3, PTL3_INDEX_ARCH(page), PAGE_WRITE | PAGE_EXEC); \ |
} |
void page_arch_init(void) |
{ |
__address cur; |
108,6 → 110,7 |
} |
} |
/** Identity page mapper |
* |
* We need to map whole physical memory identically before the page subsystem |
161,6 → 164,7 |
oldpage = page; |
} |
void page_fault(int n, istate_t *istate) |
{ |
__address page; |
172,3 → 176,19 |
panic("page fault\n"); |
} |
} |
__address hw_map(__address physaddr, size_t size) |
{ |
if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
panic("Unable to map physical memory %p (%d bytes)", physaddr, size) |
__address virtaddr = PA2KA(last_frame); |
pfn_t i; |
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) |
page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE); |
last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
return virtaddr; |
} |
//kernel/trunk/arch/ia32/src/mm/page.c |
---|
33,6 → 33,7 |
#include <mm/page.h> |
#include <mm/as.h> |
#include <arch/types.h> |
#include <align.h> |
#include <config.h> |
#include <func.h> |
#include <arch/interrupt.h> |
42,6 → 43,7 |
#include <print.h> |
#include <interrupt.h> |
void page_arch_init(void) |
{ |
__address cur; |
69,3 → 71,19 |
paging_on(); |
} |
__address hw_map(__address physaddr, size_t size) |
{ |
if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
panic("Unable to map physical memory %p (%d bytes)", physaddr, size) |
__address virtaddr = PA2KA(last_frame); |
pfn_t i; |
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) |
page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE); |
last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
return virtaddr; |
} |