Support Hello World

This commit is contained in:
Jaby 2022-08-31 10:55:25 +02:00
parent d806c5c5e2
commit 367e4d5b3f
4 changed files with 17 additions and 13 deletions

View File

@ -48,7 +48,8 @@ struct __no_align __syscall_InterruptElement {
}; };
#ifdef __cplusplus #ifdef __cplusplus
reinterpret_cast<__VA_ARGS__>(table) #define __syscall_function_cast(table, ...) reinterpret_cast<__VA_ARGS__>(table)
extern "C" {
#else #else
#define __syscall_function_cast(table, ...) ((__VA_ARGS__)(void*)table) #define __syscall_function_cast(table, ...) ((__VA_ARGS__)(void*)table)
#endif #endif
@ -123,6 +124,10 @@ static __always_inline void __syscall_ExitCriticalSection() {
__asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory"); __asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
} }
int __syscall_printf(const char* txt, ...); void __syscall_printf(const char* txt, ...);
#ifdef __cplusplus
}
#endif
#endif //!__JABYENGINE_SYSCALLS__H #endif //!__JABYENGINE_SYSCALLS__H

View File

@ -26,8 +26,8 @@ SOFTWARE.
OUTPUT_FORMAT("binary") OUTPUT_FORMAT("binary")
EXTERN(_start) EXTERN(_ZN10JabyEngine5startEv)
ENTRY(_start) ENTRY(_ZN10JabyEngine5startEv)
TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000; TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000;
@ -97,7 +97,7 @@ SECTIONS {
LONG(0); LONG(0); LONG(0); LONG(0);
/* 0x0010 - 0x0013 : entry point */ /* 0x0010 - 0x0013 : entry point */
LONG(ABSOLUTE(_start)); LONG(ABSOLUTE(_ZN10JabyEngine5startEv));
/* 0x0014 - 0x0017 : initial value of $gp */ /* 0x0014 - 0x0017 : initial value of $gp */
LONG(0); LONG(0);

View File

@ -1,8 +0,0 @@
#include <stdio.h>
int x = 0;
void _start() {
//call main here
printf("Hello Planschbecken c: %i\n", x);
}

View File

@ -0,0 +1,7 @@
#include <stdio.h>
namespace JabyEngine {
void start() {
printf("Hello Planschbecken\n");
}
}