mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Pass the fb phys addr to userspace
Instead of always mapping the framebuffer at an arbitrary location, and so reporting that to userspace, send the physical address so drivers can call system_map_mmio().
This commit is contained in:
@@ -28,7 +28,7 @@ struct j6_init_value {
|
|||||||
/// `flags` has the following bits:
|
/// `flags` has the following bits:
|
||||||
/// 0-3: Pixel layout. 0000: rgb8, 0001: bgr8
|
/// 0-3: Pixel layout. 0000: rgb8, 0001: bgr8
|
||||||
struct j6_init_framebuffer {
|
struct j6_init_framebuffer {
|
||||||
void* addr;
|
uintptr_t addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
uint32_t vertical;
|
uint32_t vertical;
|
||||||
uint32_t horizontal;
|
uint32_t horizontal;
|
||||||
|
|||||||
@@ -85,8 +85,13 @@ kernel_main(args::header *header)
|
|||||||
fb = memory::to_virtual<args::framebuffer>(reinterpret_cast<uintptr_t>(&header->video));
|
fb = memory::to_virtual<args::framebuffer>(reinterpret_cast<uintptr_t>(&header->video));
|
||||||
|
|
||||||
const args::framebuffer &video = header->video;
|
const args::framebuffer &video = header->video;
|
||||||
log::debug(logs::boot, "Framebuffer: %dx%d[%d] type %s @ %016llx",
|
log::debug(logs::boot, "Framebuffer: %dx%d[%d] type %d @ %llx size %llx",
|
||||||
video.horizontal, video.vertical, video.scanline, video.type, video.phys_addr);
|
video.horizontal,
|
||||||
|
video.vertical,
|
||||||
|
video.scanline,
|
||||||
|
video.type,
|
||||||
|
video.phys_addr,
|
||||||
|
video.size);
|
||||||
logger_clear_immediate();
|
logger_clear_immediate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,21 +254,31 @@ initialize_main_user_stack()
|
|||||||
char *message_arg = push<char>(tcb->rsp3, sizeof(message));
|
char *message_arg = push<char>(tcb->rsp3, sizeof(message));
|
||||||
kutil::memcpy(message_arg, message, sizeof(message));
|
kutil::memcpy(message_arg, message, sizeof(message));
|
||||||
|
|
||||||
extern args::framebuffer *fb;
|
j6_init_value *initv = nullptr;
|
||||||
j6_init_framebuffer *fb_desc = push<j6_init_framebuffer>(tcb->rsp3);
|
|
||||||
fb_desc->addr = fb ? reinterpret_cast<void*>(0x100000000) : nullptr;
|
|
||||||
fb_desc->size = fb ? fb->size : 0;
|
|
||||||
fb_desc->vertical = fb ? fb->vertical : 0;
|
|
||||||
fb_desc->horizontal = fb ? fb->horizontal : 0;
|
|
||||||
fb_desc->scanline = fb ? fb->scanline : 0;
|
|
||||||
fb_desc->flags = 0;
|
|
||||||
|
|
||||||
if (fb && fb->type == kernel::args::fb_type::bgr8)
|
|
||||||
fb_desc->flags |= 1;
|
|
||||||
|
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
|
|
||||||
j6_init_value *initv = push<j6_init_value>(tcb->rsp3);
|
extern args::framebuffer *fb;
|
||||||
|
if (fb) {
|
||||||
|
j6_init_framebuffer *fb_desc = push<j6_init_framebuffer>(tcb->rsp3);
|
||||||
|
kutil::memset(fb_desc, 0, sizeof(j6_init_framebuffer));
|
||||||
|
|
||||||
|
fb_desc->addr = fb->phys_addr;
|
||||||
|
fb_desc->size = fb->size;
|
||||||
|
fb_desc->vertical = fb->vertical;
|
||||||
|
fb_desc->horizontal = fb->horizontal;
|
||||||
|
fb_desc->scanline = fb->scanline;
|
||||||
|
|
||||||
|
if (fb->type == kernel::args::fb_type::bgr8)
|
||||||
|
fb_desc->flags |= 1;
|
||||||
|
|
||||||
|
initv = push<j6_init_value>(tcb->rsp3);
|
||||||
|
initv->type = j6_init_desc_framebuffer;
|
||||||
|
initv->data = fb_desc;
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
initv = push<j6_init_value>(tcb->rsp3);
|
||||||
initv->type = j6_init_handle_other;
|
initv->type = j6_init_handle_other;
|
||||||
initv->handle.type = j6_object_type_system;
|
initv->handle.type = j6_object_type_system;
|
||||||
initv->handle.handle = proc.add_handle(&system::get());
|
initv->handle.handle = proc.add_handle(&system::get());
|
||||||
@@ -286,11 +296,6 @@ initialize_main_user_stack()
|
|||||||
initv->handle.handle = th.self_handle();
|
initv->handle.handle = th.self_handle();
|
||||||
++n;
|
++n;
|
||||||
|
|
||||||
initv = push<j6_init_value>(tcb->rsp3);
|
|
||||||
initv->type = j6_init_desc_framebuffer;
|
|
||||||
initv->data = fb_desc;
|
|
||||||
++n;
|
|
||||||
|
|
||||||
uint64_t *initc = push<uint64_t>(tcb->rsp3);
|
uint64_t *initc = push<uint64_t>(tcb->rsp3);
|
||||||
*initc = n;
|
*initc = n;
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
scheduler *scheduler::s_instance = nullptr;
|
scheduler *scheduler::s_instance = nullptr;
|
||||||
|
|
||||||
extern kernel::args::framebuffer *fb;
|
|
||||||
|
|
||||||
const uint64_t rflags_noint = 0x002;
|
const uint64_t rflags_noint = 0x002;
|
||||||
const uint64_t rflags_int = 0x202;
|
const uint64_t rflags_int = 0x202;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user