/crt/include/sysops.h
#ifndef __SYSOPS_H
#define __SYSOPS_H

#include <stdint.h>
#include <stddef.h>

struct console_operations {
	int32_t (*readkey)();
	size_t (*readline)(uint8_t buf[], size_t len);
	void (*writeb)(uint8_t b);
	void (*write)(uint8_t a[], size_t len);
	void (*discard)();
	void (*pos)(size_t x, size_t y);
	void (*clear)();
};

struct alloc_operations {
	void (*init)(size_t start, size_t size);
	void * (*alloc)(size_t size, size_t align);
	void (*dealloc)(void *ptr, size_t size, size_t align);
	void * (*malloc)(size_t size);
	void (*free)(void *ptr);
	void * (*realloc)(void *ptr, size_t size);
};

struct sys_ops {
	struct console_operations *console;
	struct alloc_operations *alloc;
};

static struct sys_ops *sys_ops __attribute__((section (".rodata"))) = (struct sys_ops *) 0xfc;

#endif //__SYSOPS_H