mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
6ffed14b9c
Actually Portable Executable now supports Android. Cosmo's old mmap code required a 47 bit address space. The new implementation is very agnostic and supports both smaller address spaces (e.g. embedded) and even modern 56-bit PML5T paging for x86 which finally came true on Zen4 Threadripper Cosmopolitan no longer requires UNIX systems to observe the Windows 64kb granularity; i.e. sysconf(_SC_PAGE_SIZE) will now report the host native page size. This fixes a longstanding POSIX conformance issue, concerning file mappings that overlap the end of file. Other aspects of conformance have been improved too, such as the subtleties of address assignment and and the various subtleties surrounding MAP_FIXED and MAP_FIXED_NOREPLACE On Windows, mappings larger than 100 megabytes won't be broken down into thousands of independent 64kb mappings. Support for MAP_STACK is removed by this change; please use NewCosmoStack() instead. Stack overflow avoidance is now being implemented using the POSIX thread APIs. Please use GetStackBottom() and GetStackAddr(), instead of the old error-prone GetStackAddr() and HaveStackMemory() APIs which are removed.
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#ifdef _COSMO_SOURCE
|
|
#ifndef COSMOPOLITAN_LIBC_INTRIN_DLL_H_
|
|
#define COSMOPOLITAN_LIBC_INTRIN_DLL_H_
|
|
#define dll_make_first __dll_make_first
|
|
#define dll_make_last __dll_make_last
|
|
#define dll_remove __dll_remove
|
|
#define dll_splice_after __dll_splice_after
|
|
COSMOPOLITAN_C_START_
|
|
|
|
#define DLL_CONTAINER(t, f, p) ((t *)(((char *)(p)) - offsetof(t, f)))
|
|
|
|
struct Dll {
|
|
struct Dll *next;
|
|
struct Dll *prev;
|
|
};
|
|
|
|
forceinline void dll_init(struct Dll *e) {
|
|
e->next = e;
|
|
e->prev = e;
|
|
}
|
|
|
|
forceinline int dll_is_alone(struct Dll *e) {
|
|
return e->next == e && e->prev == e;
|
|
}
|
|
|
|
forceinline int dll_is_empty(struct Dll *list) {
|
|
return !list;
|
|
}
|
|
|
|
forceinline struct Dll *dll_last(struct Dll *list) {
|
|
return list;
|
|
}
|
|
|
|
forceinline struct Dll *dll_first(struct Dll *list) {
|
|
struct Dll *first = 0;
|
|
if (list)
|
|
first = list->next;
|
|
return first;
|
|
}
|
|
|
|
forceinline struct Dll *dll_next(struct Dll *list, struct Dll *e) {
|
|
struct Dll *next = 0;
|
|
if (e != list)
|
|
next = e->next;
|
|
return next;
|
|
}
|
|
|
|
forceinline struct Dll *dll_prev(struct Dll *list, struct Dll *e) {
|
|
struct Dll *prev = 0;
|
|
if (e != list->next)
|
|
prev = e->prev;
|
|
return prev;
|
|
}
|
|
|
|
void dll_remove(struct Dll **, struct Dll *) paramsnonnull() libcesque;
|
|
void dll_make_last(struct Dll **, struct Dll *) paramsnonnull((1)) libcesque;
|
|
void dll_make_first(struct Dll **, struct Dll *) paramsnonnull((1)) libcesque;
|
|
void dll_splice_after(struct Dll *, struct Dll *) paramsnonnull((1)) libcesque;
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* COSMOPOLITAN_LIBC_INTRIN_DLL_H_ */
|
|
#endif /* _COSMO_SOURCE */
|