2020-01-22 07:02:12 +03:00
|
|
|
#ifndef __LIB__BLIB_H__
|
|
|
|
#define __LIB__BLIB_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2020-01-25 04:05:19 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-04-30 14:03:04 +03:00
|
|
|
int cpuid(uint32_t leaf, uint32_t subleaf,
|
|
|
|
uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
|
|
|
|
|
2020-04-29 17:53:05 +03:00
|
|
|
__attribute__((noreturn)) void panic(const char *str);
|
2020-04-13 09:21:25 +03:00
|
|
|
|
2020-01-25 04:05:19 +03:00
|
|
|
void pit_sleep(uint64_t pit_ticks);
|
2020-04-25 21:33:26 +03:00
|
|
|
int pit_sleep_and_quit_on_keypress(uint32_t pit_ticks);
|
2020-01-22 07:02:12 +03:00
|
|
|
|
2020-04-15 21:15:38 +03:00
|
|
|
void brewind(size_t count);
|
2020-03-28 06:02:26 +03:00
|
|
|
void *balloc(size_t count);
|
|
|
|
void *balloc_aligned(size_t count, size_t alignment);
|
|
|
|
|
2020-01-25 06:49:11 +03:00
|
|
|
#define GETCHAR_CURSOR_LEFT (-10)
|
|
|
|
#define GETCHAR_CURSOR_RIGHT (-11)
|
|
|
|
#define GETCHAR_CURSOR_UP (-12)
|
|
|
|
#define GETCHAR_CURSOR_DOWN (-13)
|
|
|
|
|
2020-01-22 07:02:12 +03:00
|
|
|
void print(const char *fmt, ...);
|
2020-01-25 06:49:11 +03:00
|
|
|
int getchar(void);
|
2020-01-25 05:06:56 +03:00
|
|
|
void gets(const char *orig_str, char *buf, size_t limit);
|
2020-01-22 09:13:19 +03:00
|
|
|
uint64_t strtoui(const char *s);
|
2020-01-22 07:02:12 +03:00
|
|
|
|
|
|
|
#define DIV_ROUNDUP(a, b) (((a) + ((b) - 1)) / (b))
|
|
|
|
|
|
|
|
typedef void *symbol[];
|
|
|
|
|
|
|
|
#endif
|