[fb] Create fb driver

Create a new framebuffer driver. Also hackily passing frame buffer size
in the list of init handles to all processes and mapping the framebuffer
into all processes. Changed bootloader passing frame buffer as a module
to its own struct.
This commit is contained in:
2020-12-27 18:49:38 -08:00
committed by Justin C. Miller
parent e70eb5a926
commit 19cbf1ca67
15 changed files with 170 additions and 71 deletions

41
src/drivers/fb/main.cpp Normal file
View File

@@ -0,0 +1,41 @@
#include <stdint.h>
#include <stdlib.h>
#include "j6/types.h"
#include "j6/errors.h"
#include "j6/signals.h"
#include <j6libc/syscalls.h>
extern "C" {
void _init_libc(j6_process_init *);
int main(int, const char **);
}
j6_handle_t sys = j6_handle_invalid;
size_t size = 0;
void
_init_libc(j6_process_init *init)
{
sys = init->handles[0];
size = reinterpret_cast<size_t>(init->handles[1]);
}
int
main(int argc, const char **argv)
{
_syscall_system_log("fb driver starting");
if (size == 0)
return 1;
uint32_t *fb = reinterpret_cast<uint32_t*>(0x100000000);
for (size_t i=0; i < size/4; ++i) {
fb[i] = 0xff;
}
_syscall_system_log("fb driver done, exiting");
return 0;
}

24
src/drivers/fb/main.s Normal file
View File

@@ -0,0 +1,24 @@
section .bss
mymessage:
resq 1024
extern main
extern _init_libc
extern exit
section .text
global _start
_start:
mov rbp, rsp
mov rdi, rsp
call _init_libc
mov rdi, 0
mov rsi, 0
call main
mov rdi, rax
call exit