baremetal: second try (with i386-elf-gcc)

This commit is contained in:
2026-02-23 17:59:16 +01:00
parent e426ea39e3
commit d85116d83b
3 changed files with 54 additions and 963 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,17 +5,17 @@
#include <stdbool.h>
// #include <assert.h>
// #include <time.h>
#include <string.h>
// #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// #include <stdlib.h>
// #include <math.h>
#include <stdarg.h>
#include <ctype.h>
#include <pthread.h>
// #include <ctype.h>
// #include <pthread.h>
// #include <signal.h>
#include <semaphore.h>
// #include <semaphore.h>
// #include <limits.h>
#include <dirent.h>
// #include <dirent.h>
// #include <fcntl.h>
// #include <unistd.h>
// #include <poll.h>
@ -42,11 +42,19 @@ extern "C" {
#define BH_APPLET_PRESERVED_STACK_SIZE (8 * 1024)
#define BH_THREAD_DEFAULT_PRIORITY 0
typedef pthread_t korp_tid;
typedef pthread_mutex_t korp_mutex;
typedef pthread_cond_t korp_cond;
typedef pthread_t korp_thread;
typedef sem_t korp_sem;
typedef int korp_tid;
typedef struct {
int dummy;
} korp_mutex;
typedef struct {
int dummy;
} korp_cond;
typedef struct {
int dummy;
} korp_thread;
typedef struct {
int dummy;
} korp_sem;
// typedef pthread_rwlock_t korp_rwlock;
typedef struct {
@ -55,7 +63,9 @@ typedef struct {
} korp_rwlock;
typedef int os_file_handle;
typedef DIR *os_dir_stream;
typedef struct {
int dummy;
} *os_dir_stream;
typedef int os_raw_file_handle;
static inline os_file_handle
@ -67,10 +77,17 @@ os_get_invalid_handle(void)
static inline int
os_getpagesize()
{
// TODO: What pagesize?
// TODO: What pagesize? 65536?
return 4096;
}
void *
memcpy(void *restrict dest, const void *restrict src, size_t n);
void *
memmove(void *dest, const void *src, size_t n);
void *
memset(void *dest, int c, size_t n);
#ifdef __cplusplus
}
#endif

View File

@ -3,10 +3,10 @@ set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
add_definitions(-DBH_PLATFORM_BAREMETAL)
include_directories(${PLATFORM_SHARED_DIR})
include_directories(${PLATFORM_SHARED_DIR}/../include)
# file (GLOB header ${PLATFORM_SHARED_DIR}/../include/baremetal/*.h)
# list (APPEND RUNTIME_LIB_HEADER_LIST ${header})
file (GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c)
set (PLATFORM_SHARED_SOURCE ${source_all})
file (GLOB header ${PLATFORM_SHARED_DIR}/../include/baremetal/*.h)
LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header})