test: Use Flanterm
This commit is contained in:
parent
820d4751d3
commit
b8fff872de
|
@ -1,2 +1,3 @@
|
|||
test.o
|
||||
test.elf
|
||||
flanterm
|
||||
|
|
|
@ -45,7 +45,8 @@ override INTERNALCFLAGS := \
|
|||
-mgeneral-regs-only \
|
||||
-mno-red-zone \
|
||||
-I. \
|
||||
-I..
|
||||
-I.. \
|
||||
-D_LIMINE_PROTO
|
||||
|
||||
ifneq ($(findstring riscv,$(CC_FOR_TARGET)),)
|
||||
override INTERNALCFLAGS += -march=rv64imac -mabi=lp64 -mno-relax
|
||||
|
@ -74,7 +75,11 @@ else
|
|||
all: test.elf
|
||||
endif
|
||||
|
||||
test.elf: limine.o e9print.o memory.o
|
||||
flanterm:
|
||||
mkdir -p flanterm
|
||||
cp -rv ../common/flanterm/* ./flanterm/
|
||||
|
||||
test.elf: limine.o e9print.o memory.o flanterm/flanterm.o flanterm/backends/fb.o
|
||||
$(LD) $^ $(LDFLAGS) $(INTERNALLDFLAGS) -o $@
|
||||
|
||||
multiboot2.elf: multiboot2_trampoline.o
|
||||
|
@ -87,7 +92,7 @@ multiboot.elf: multiboot_trampoline.o
|
|||
$(CC) $(CFLAGS) $(INTERNALCFLAGS_MB) -c e9print.c -o e9print.o
|
||||
$(LD) $^ multiboot.o e9print.o $(LDFLAGS) $(INTERNAL_LD_FLAGS_MULTIBOOT1) -m elf_i386 -o $@
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c flanterm
|
||||
$(CC) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.asm
|
||||
|
@ -97,3 +102,4 @@ clean:
|
|||
rm -rf test.elf limine.o e9print.o memory.o
|
||||
rm -rf multiboot2.o multiboot2.elf multiboot2_trampoline.o
|
||||
rm -rf multiboot.o multiboot_trampoline.o multiboot.elf
|
||||
rm -rf flanterm
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined (_LIMINE_PROTO)
|
||||
#include <flanterm/flanterm.h>
|
||||
extern struct flanterm_context *ft_ctx;
|
||||
#endif
|
||||
|
||||
static const char CONVERSION_TABLE[] = "0123456789abcdef";
|
||||
|
||||
void e9_putc(char c) {
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
__asm__ __volatile__ ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory");
|
||||
#endif
|
||||
#if defined (_LIMINE_PROTO)
|
||||
if (ft_ctx != NULL) {
|
||||
flanterm_write(ft_ctx, &c, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void e9_print(const char *msg) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include <stddef.h>
|
||||
#include <limine.h>
|
||||
#include <e9print.h>
|
||||
#include <flanterm/flanterm.h>
|
||||
#include <flanterm/backends/fb.h>
|
||||
|
||||
static void limine_main(void);
|
||||
|
||||
|
@ -232,9 +234,20 @@ void ap_entry(struct limine_smp_info *info) {
|
|||
|
||||
extern char kernel_start[];
|
||||
|
||||
struct flanterm_context *ft_ctx = NULL;
|
||||
|
||||
void limine_main(void) {
|
||||
e9_printf("\nWe're alive");
|
||||
|
||||
struct limine_framebuffer *fb = framebuffer_request.response->framebuffers[0];
|
||||
|
||||
ft_ctx = flanterm_fb_simple_init(
|
||||
fb->address,
|
||||
fb->width,
|
||||
fb->height,
|
||||
fb->pitch
|
||||
);
|
||||
|
||||
uint64_t kernel_slide = (uint64_t)kernel_start - 0xffffffff80000000;
|
||||
|
||||
e9_printf("Kernel slide: %x", kernel_slide);
|
||||
|
|
Loading…
Reference in New Issue