Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/waterbox/libc/functions/_PDCLIB/emulibc.c
2 views
1
#include <stdint.h>
2
#include <stddef.h>
3
#include "_PDCLIB_glue.h"
4
#include <errno.h>
5
#include <emulibc.h>
6
7
ECL_EXPORT ECL_ENTRY __attribute__((noreturn)) void (*_ecl_trap)(void); // something very unexpected happened. should not return
8
ECL_EXPORT ECL_ENTRY void *(*_ecl_sbrk)(size_t n); // sbrk. won't return if the request can't be satisfied
9
ECL_EXPORT ECL_ENTRY void (*_ecl_debug_puts)(const char *); // low level debug write, doesn't involve STDIO
10
11
ECL_EXPORT ECL_ENTRY void *(*_ecl_sbrk_sealed)(size_t n); // allocate memory; see emulibc.h
12
ECL_EXPORT ECL_ENTRY void *(*_ecl_sbrk_invisible)(size_t n); // allocate memory; see emulibc.h
13
14
void *alloc_sealed(size_t size)
15
{
16
return _ecl_sbrk_sealed(size);
17
}
18
19
void *alloc_invisible(size_t size)
20
{
21
return _ecl_sbrk_invisible(size);
22
}
23
24
void _debug_puts(const char *s)
25
{
26
_ecl_debug_puts(s);
27
}
28
29
void *_PDCLIB_sbrk(size_t n)
30
{
31
void *ret = _ecl_sbrk(n);
32
return ret;
33
}
34
35
void _PDCLIB_Exit( int status )
36
{
37
_ecl_trap();
38
}
39
40
41