From aa79432946f4c217b5e6517190f0a4f15702e708 Mon Sep 17 00:00:00 2001 From: aramya <22577625+thamugadi@users.noreply.github.com> Date: Sat, 1 Jul 2023 03:52:59 +0100 Subject: [PATCH] OFW client interface --- Makefile | 4 +- entry/boot.c | 162 ++++++++++-------------------------------------- entry/boot.h | 28 +-------- entry/start.s | 5 +- loader/def.fth | 3 +- loader/load.fth | 3 - 6 files changed, 40 insertions(+), 165 deletions(-) diff --git a/Makefile b/Makefile index 4c5c7dd..a306c3c 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ bootinfo.txt: loader/load.fth loader/def.fth cat loader/load.fth >> bootinfo.txt echo "" >> bootinfo.txt kernel.elf: start.elf boot.elf - $(PPC)-ld -Ttext=0x200000 start.elf boot.elf -o kernel.elf -boot.elf: entry/boot.c + $(PPC)-ld -Ttext=0x200000 -Tdata=0x300000 start.elf boot.elf -o kernel.elf +boot.elf: entry/boot.c entry/boot.h $(PPC)-gcc -c entry/boot.c -o boot.elf start.elf: entry/start.s $(PPC)-as -c entry/start.s -o start.elf diff --git a/entry/boot.c b/entry/boot.c index d70e43d..7574ac1 100644 --- a/entry/boot.c +++ b/entry/boot.c @@ -1,141 +1,45 @@ #include "boot.h" -void __stack_chk_fail_local(void){} -void __eabi(void){} -void get_io_type(void) +void __stack_chk_fail_local(void) { - if (*(unsigned char*)__VRAM__BEIGE == beige) IO_TYPE = beige; - else if (*(unsigned char*)__VRAM__MAC99 == mac99) IO_TYPE = mac99; - if (IO_TYPE == beige) - { - screen_width = (*(unsigned int*)(__VRAM__BEIGE+4)); - screen_height = (*(unsigned int*)(__VRAM__BEIGE+8)); - - } - else if (IO_TYPE == mac99) - { - screen_width = (*(unsigned int*)(__VRAM__MAC99+4)); - screen_height = (*(unsigned int*)(__VRAM__MAC99+8)); - } } -void init(void) +void __eabi(void) { - if (IO_TYPE == beige) +} + +int test(const char* name) +{ + struct { - p_vram = __VRAM__BEIGE; - p_bios = __BIOS__BEIGE; - p_timer= __TIMR__BEIGE; - } - else if (IO_TYPE == mac99) - { - p_vram = __VRAM__MAC99; - p_bios = __BIOS__MAC99; - p_timer= __TIMR__MAC99; - } + char* service; + int n_args; + int n_rets; + char* arg; + int ret; + } ofw_arg; + + const char _service[5] = "test"; + ofw_arg.service = _service; + + ofw_arg.n_args = 1; + ofw_arg.n_rets = 1; + ofw_arg.arg = name; + + ofw(&ofw_arg); + + return ofw_arg.ret; } void main(void) { - get_io_type(); - init(); - game_of_life(); -} - -void fillscreen(unsigned int* addr, unsigned char a, unsigned char b, unsigned char c, int n) -{ - unsigned char* ptr = addr; - for (unsigned int i = 0; i