DELETED kcore/old/def.fbsd.i Index: kcore/old/def.fbsd.i ================================================================== --- kcore/old/def.fbsd.i +++ kcore/old/def.fbsd.i @@ -1,2 +0,0 @@ -#define KVos fbsd -typedef unsigned char stat; DELETED kcore/old/def.h Index: kcore/old/def.h ================================================================== --- kcore/old/def.h +++ kcore/old/def.h @@ -1,28 +0,0 @@ -#include -/* - * ~ lexi hale - * define flags so we can reason about - * our environment. */ - -#if (KVos == lin) ||\ - (KVos == fbsd) ||\ - (KVos == obsd) ||\ - (KVos == nbsd) ||\ - (KVos == dar) ||\ - (KVos == and) -# define KFenv_unix -#endif - -#if defined(KFenv_unix) ||\ - (KVos == hai) ||\ - (KVos == mgw) -# define KFenv_posix -#endif - -#define Kpragma(p) _Pragma(#p) -#if defined(__GNUC__) || defined(__clang__) -# define Kerror(msg) Kpragma(GCC error #msg) -#else -# define Kerror(msg) Kpragma(message #msg) -#endif -#define Knoimpl(fn,p) Kerror(no implementation of fn for platform p) DELETED kcore/old/def.h.m Index: kcore/old/def.h.m ================================================================== --- kcore/old/def.h.m +++ kcore/old/def.h.m @@ -1,36 +0,0 @@ ---- kcore/def.h.m → ---- ~ lexi hale ---- this file gathers information on the environment it's ---- being compiled in, setting macros that other headers ---- need. it will be emitted as . ---- vim: ft=c -#ifndef KIdef -#define KIdef - -[ifdef atom_target_bits] - [define target: [atom_target_arch].[atom_target_os].[atom_target_bits]] - #define KVbits [atom_target_bits] -[else] - [define target: [atom_target_arch].[atom_target_os]] -[endif] -#define KVtarget [target] -#define KVos [atom_target_os] -#define KVarch [atom_target_arch] -[if [target_unix] == yes] - #define KFenv_unix - #define KFenv_posix -[else] - [if [target_posix] == yes] - #define KFenv_posix - [endif] -[endif] - -#define Kpragma(p) _Pragma(#p) -#if defined(__GNUC__) || defined(__clang__) -# define Kerror(msg) Kpragma(GCC error #msg) -#else -# define Kerror(msg) Kpragma(message #msg) -#endif -#define Knoimpl(fn) Kerror(no implementation of fn for platform [target]) - -#endif DELETED kcore/old/def.lin.i Index: kcore/old/def.lin.i ================================================================== --- kcore/old/def.lin.i +++ kcore/old/def.lin.i @@ -1,2 +0,0 @@ -#define KVos lin -typedef unsigned char stat; DELETED kcore/old/def.win.i Index: kcore/old/def.win.i ================================================================== --- kcore/old/def.win.i +++ kcore/old/def.win.i @@ -1,2 +0,0 @@ -#define KVos win -typedef u32 stat; DELETED kcore/old/type.h.m Index: kcore/old/type.h.m ================================================================== --- kcore/old/type.h.m +++ kcore/old/type.h.m @@ -1,182 +0,0 @@ ---- kcore/type.h.m → ---- ~ lexi hale ---- this file gathers information on the environment it's ---- being compiled in, defining types that our code ---- needs. it will be emitted as . ---- vim: ft=c -#ifndef KItype -#define KItype - -/* we define 64-bit types first due to an oddity in how - * 128-bit types are handled: we want kc_?big to reference - * the absolute largest type available to the compiler, - * but in some cases, 128-bits may not be among the - * standard C types despite being supported by the - * compiler. to work around this, we first check whether - * 64-bit types are available (__int128_t only works on - * 64-bit systems) and then whether the compiler is one - * that supports the 128-bit extension - but only if a - * native 128-bit type is not available. - * - * once this is done, we can be certain that u128 will - * reference the largest available integer type and can - * safely define kc_?big by reference to it. */ - -[ifdef type_bit64] - typedef unsigned [type_bit64] u64; - typedef signed [type_bit64] s64; - [ifndef type_bit128] - /* even if no native type is 128 bits long, clang and - * gcc have extensions to support 128 bit arithmetic - * on 64-bit hardware */ -# if defined(__GNUC__) || defined(__clang__) - typedef unsigned __int128_t u128; - typedef signed __int128_t s128; -# else - /* if we don't have access to that extension - * or native 128-bit types, then we just use - * the largest native type specified in the - * C standard */ - typedef unsigned long long u128; - typedef signed long long s128; -# endif - [endif] -[else] - typedef unsigned long long u64; - typedef signed long long s64; - - typedef u64 u128; - typedef s64 s128; -[endif] - -[ifdef type_bit128] - typedef unsigned [type_bit128] u128; - typedef signed [type_bit128] s128; -[endif] - -typedef unsigned char ubyte; -typedef signed char sbyte; -typedef u128 ubig; -typedef s128 sbig; - -[ifdef type_bit8] - typedef unsigned [type_bit8] u8; - typedef signed [type_bit8] s8; -[else] - typedef ubyte u8; - typedef sbyte s8; -[endif] - -[ifdef type_bit16] - typedef unsigned [type_bit16] u16; - typedef signed [type_bit16] s16; -[else] - typedef ubig u16; - typedef sbig s16; -[endif] - -[ifdef type_bit32] - typedef unsigned [type_bit32] u32; - typedef signed [type_bit32] s32; -[else] - typedef ubig u32; - typedef sbig s32; -[endif] - -enum /* max-min values of each type */ { - byte_bits = [byte_bits], - - u8_min = 0, u8_max = ((u8)-1), - u16_min = 0, u16_max = ((u16)-1), - u32_min = 0, u32_max = ((u32)-1), - u64_min = 0, u32_max = ((u64)-1), - u128_min = 0, u128_max = ((u128)-1), - - /* assuming two's complement. TODO: check math */ - [define merge: $1$2] - [define [sspec type]: - [merge [type],_min] = 0 - ((1 << sizeof([type]) * kc_byte_bits) / 2), - [merge [type],_max] = (1 << sizeof([type]) * kc_byte_bits) / 2 - 1] - - [sspec s8], [sspec s16], [sspec s32], - [sspec s64], [sspec s128], - - kc_uchar_min = 0, kc_uchar_max = [type_max_u_char], - kc_ushort_min = 0, kc_ushort_max = [type_max_u_short], - kc_uint_min = 0, kc_uint_max = [type_max_u_int], - kc_ulong_min = 0, kc_ulong_max = [type_max_u_long], - kc_ullong_min = 0, kc_ullong_max = [type_max_u_llong], - - kc_schar_min = [type_min_s_char], kc_schar_max = [type_max_s_char], - kc_sshort_min = [type_min_s_short], kc_sshort_max = [type_max_s_short], - kc_sint_min = [type_min_s_int], kc_sint_max = [type_max_s_int], - kc_slong_min = [type_min_s_long], kc_slong_max = [type_max_s_long], - kc_sllong_min = [type_min_s_llong], kc_sllong_max = [type_max_s_llong], - - ubig_min = u128_min, ubig_max = u128_max, - sbig_min = s128_min, sbig_max = s128_max, - - ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max, - sbyte_min = kc_schar_min, sbyte_max = kc_schar_max, -}; - -[ifdef type_sz] - typedef [type_sz] sz; -[else] -# ifdef __cplusplus - /* C++ gives us a clean, standardized way to do this */ - typedef decltype (sizeof(char)) sz; -# else -# if defined(__GNUC__) || defined(__clang__) - typedef __typeof__ (sizeof(char)) sz; -# else - /* we're stumped - set sz to the safest possible value under - * the circumstances, and warn the user. */ -# warning no authoritative sz (size_t) type definition \ - available; defaulting to largest unsigned integer type - typedef ubig sz; -# endif -# endif -[endif] - -[ifdef type_offset] - typedef [type_offset] offset; -[else] -# ifdef __cplusplus - /* C++ gives us a clean, standardized way to do this */ - typedef decltype (((void*)-1) - 1) offset; -# else -# if defined(__GNUC__) || defined(__clang__) - typedef __typeof__ (((void*)10) - ((void*)5)) offset; -# else - /* no dice - set offset to the safest possible value under - * the circumstances, and warn the user. */ -# warning no authoritative offset (ptrdiff_t) type definition \ - available; defaulting to largest unsigned integer type - typedef sbig offset; -# endif -# endif -[endif] - -// exit status integer types - pls use kbad in instead -[if [target_posix] == yes] - /* by convention, posix return values are 8-bit, - * but note that many modern UNIXes do technically - * support higher-bit values. for this reason, - * longstat is defined differently under posix. */ - typedef u8 stat; - typedef u32 stat_long; -[else] - [if ([atom_target_os] == win) || - ([atom_target_os] == vms)] - typedef u32 stat; - [else] - typedef u8 stat; - /* we don't know a specific exit status type - * for your arch so we're going with a sane - * default. if this is wrong, help us fix it! */ - [endif] - typedef stat stat_long; -[endif] - -#endif DELETED kcore/old/type.x86.32.i Index: kcore/old/type.x86.32.i ================================================================== --- kcore/old/type.x86.32.i +++ kcore/old/type.x86.32.i @@ -1,14 +0,0 @@ -#define KVarch x86 -#define KVbits 32 - -typedef unsigned long sz; - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned long u32; -typedef signed long s32; - -typedef u32 word; -typedef s32 sword; DELETED kcore/old/type.x86.64.i Index: kcore/old/type.x86.64.i ================================================================== --- kcore/old/type.x86.64.i +++ kcore/old/type.x86.64.i @@ -1,18 +0,0 @@ -#define KVarch x86 -#define KVbits 64 - -typedef unsigned long long sz; - -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned long u32; -typedef signed long s32; -typedef unsigned long long u64; -typedef signed long long s64; -typedef __uint128_t u128; -typedef __int128_t s128; - -typedef u64 word; -typedef s64 sword; DELETED kio/posix_fd_write.fn.x86.lin.32.s Index: kio/posix_fd_write.fn.x86.lin.32.s ================================================================== --- kio/posix_fd_write.fn.x86.lin.32.s +++ kio/posix_fd_write.fn.x86.lin.32.s @@ -1,14 +0,0 @@ -bits 32 -global kio_posix_fd_write - -%include "../arch/x86.lin.32.s" -; vim: ft=nasm - -kio_posix_fd_write: - mov sys.reg.0, sys.call.write - mov sys.reg.1, [esp + 4] ; holy god but this took the most - mov sys.reg.2, [esp + 8] ; stupidly long time to fucking - mov sys.reg.3, [esp + 12]; figure out - sys.call - ret - DELETED kio/posix_fd_write.fn.x86.lin.64.s Index: kio/posix_fd_write.fn.x86.lin.64.s ================================================================== --- kio/posix_fd_write.fn.x86.lin.64.s +++ kio/posix_fd_write.fn.x86.lin.64.s @@ -1,14 +0,0 @@ -bits 64 -global kio_posix_fd_write - -%include "../arch/x86.lin.64.s" -; vim: ft=nasm - -kio_posix_fd_write: - mov sys.reg.0, sys.write - ; mov sys.reg.1, ccall.reg.0 - nop - ; mov sys.reg.2, ccall.reg.1 - nop - ; mov sys.reg.3, ccall.reg.2 - nop - sys.call - ret - ADDED legacy/kcore/def.fbsd.i Index: legacy/kcore/def.fbsd.i ================================================================== --- legacy/kcore/def.fbsd.i +++ legacy/kcore/def.fbsd.i @@ -0,0 +1,2 @@ +#define KVos fbsd +typedef unsigned char stat; ADDED legacy/kcore/def.h Index: legacy/kcore/def.h ================================================================== --- legacy/kcore/def.h +++ legacy/kcore/def.h @@ -0,0 +1,28 @@ +#include +/* + * ~ lexi hale + * define flags so we can reason about + * our environment. */ + +#if (KVos == lin) ||\ + (KVos == fbsd) ||\ + (KVos == obsd) ||\ + (KVos == nbsd) ||\ + (KVos == dar) ||\ + (KVos == and) +# define KFenv_unix +#endif + +#if defined(KFenv_unix) ||\ + (KVos == hai) ||\ + (KVos == mgw) +# define KFenv_posix +#endif + +#define Kpragma(p) _Pragma(#p) +#if defined(__GNUC__) || defined(__clang__) +# define Kerror(msg) Kpragma(GCC error #msg) +#else +# define Kerror(msg) Kpragma(message #msg) +#endif +#define Knoimpl(fn,p) Kerror(no implementation of fn for platform p) ADDED legacy/kcore/def.h.m Index: legacy/kcore/def.h.m ================================================================== --- legacy/kcore/def.h.m +++ legacy/kcore/def.h.m @@ -0,0 +1,36 @@ +--- kcore/def.h.m → +--- ~ lexi hale +--- this file gathers information on the environment it's +--- being compiled in, setting macros that other headers +--- need. it will be emitted as . +--- vim: ft=c +#ifndef KIdef +#define KIdef + +[ifdef atom_target_bits] + [define target: [atom_target_arch].[atom_target_os].[atom_target_bits]] + #define KVbits [atom_target_bits] +[else] + [define target: [atom_target_arch].[atom_target_os]] +[endif] +#define KVtarget [target] +#define KVos [atom_target_os] +#define KVarch [atom_target_arch] +[if [target_unix] == yes] + #define KFenv_unix + #define KFenv_posix +[else] + [if [target_posix] == yes] + #define KFenv_posix + [endif] +[endif] + +#define Kpragma(p) _Pragma(#p) +#if defined(__GNUC__) || defined(__clang__) +# define Kerror(msg) Kpragma(GCC error #msg) +#else +# define Kerror(msg) Kpragma(message #msg) +#endif +#define Knoimpl(fn) Kerror(no implementation of fn for platform [target]) + +#endif ADDED legacy/kcore/def.lin.i Index: legacy/kcore/def.lin.i ================================================================== --- legacy/kcore/def.lin.i +++ legacy/kcore/def.lin.i @@ -0,0 +1,2 @@ +#define KVos lin +typedef unsigned char stat; ADDED legacy/kcore/def.win.i Index: legacy/kcore/def.win.i ================================================================== --- legacy/kcore/def.win.i +++ legacy/kcore/def.win.i @@ -0,0 +1,2 @@ +#define KVos win +typedef u32 stat; ADDED legacy/kcore/type.h.m Index: legacy/kcore/type.h.m ================================================================== --- legacy/kcore/type.h.m +++ legacy/kcore/type.h.m @@ -0,0 +1,182 @@ +--- kcore/type.h.m → +--- ~ lexi hale +--- this file gathers information on the environment it's +--- being compiled in, defining types that our code +--- needs. it will be emitted as . +--- vim: ft=c +#ifndef KItype +#define KItype + +/* we define 64-bit types first due to an oddity in how + * 128-bit types are handled: we want kc_?big to reference + * the absolute largest type available to the compiler, + * but in some cases, 128-bits may not be among the + * standard C types despite being supported by the + * compiler. to work around this, we first check whether + * 64-bit types are available (__int128_t only works on + * 64-bit systems) and then whether the compiler is one + * that supports the 128-bit extension - but only if a + * native 128-bit type is not available. + * + * once this is done, we can be certain that u128 will + * reference the largest available integer type and can + * safely define kc_?big by reference to it. */ + +[ifdef type_bit64] + typedef unsigned [type_bit64] u64; + typedef signed [type_bit64] s64; + [ifndef type_bit128] + /* even if no native type is 128 bits long, clang and + * gcc have extensions to support 128 bit arithmetic + * on 64-bit hardware */ +# if defined(__GNUC__) || defined(__clang__) + typedef unsigned __int128_t u128; + typedef signed __int128_t s128; +# else + /* if we don't have access to that extension + * or native 128-bit types, then we just use + * the largest native type specified in the + * C standard */ + typedef unsigned long long u128; + typedef signed long long s128; +# endif + [endif] +[else] + typedef unsigned long long u64; + typedef signed long long s64; + + typedef u64 u128; + typedef s64 s128; +[endif] + +[ifdef type_bit128] + typedef unsigned [type_bit128] u128; + typedef signed [type_bit128] s128; +[endif] + +typedef unsigned char ubyte; +typedef signed char sbyte; +typedef u128 ubig; +typedef s128 sbig; + +[ifdef type_bit8] + typedef unsigned [type_bit8] u8; + typedef signed [type_bit8] s8; +[else] + typedef ubyte u8; + typedef sbyte s8; +[endif] + +[ifdef type_bit16] + typedef unsigned [type_bit16] u16; + typedef signed [type_bit16] s16; +[else] + typedef ubig u16; + typedef sbig s16; +[endif] + +[ifdef type_bit32] + typedef unsigned [type_bit32] u32; + typedef signed [type_bit32] s32; +[else] + typedef ubig u32; + typedef sbig s32; +[endif] + +enum /* max-min values of each type */ { + byte_bits = [byte_bits], + + u8_min = 0, u8_max = ((u8)-1), + u16_min = 0, u16_max = ((u16)-1), + u32_min = 0, u32_max = ((u32)-1), + u64_min = 0, u32_max = ((u64)-1), + u128_min = 0, u128_max = ((u128)-1), + + /* assuming two's complement. TODO: check math */ + [define merge: $1$2] + [define [sspec type]: + [merge [type],_min] = 0 - ((1 << sizeof([type]) * kc_byte_bits) / 2), + [merge [type],_max] = (1 << sizeof([type]) * kc_byte_bits) / 2 - 1] + + [sspec s8], [sspec s16], [sspec s32], + [sspec s64], [sspec s128], + + kc_uchar_min = 0, kc_uchar_max = [type_max_u_char], + kc_ushort_min = 0, kc_ushort_max = [type_max_u_short], + kc_uint_min = 0, kc_uint_max = [type_max_u_int], + kc_ulong_min = 0, kc_ulong_max = [type_max_u_long], + kc_ullong_min = 0, kc_ullong_max = [type_max_u_llong], + + kc_schar_min = [type_min_s_char], kc_schar_max = [type_max_s_char], + kc_sshort_min = [type_min_s_short], kc_sshort_max = [type_max_s_short], + kc_sint_min = [type_min_s_int], kc_sint_max = [type_max_s_int], + kc_slong_min = [type_min_s_long], kc_slong_max = [type_max_s_long], + kc_sllong_min = [type_min_s_llong], kc_sllong_max = [type_max_s_llong], + + ubig_min = u128_min, ubig_max = u128_max, + sbig_min = s128_min, sbig_max = s128_max, + + ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max, + sbyte_min = kc_schar_min, sbyte_max = kc_schar_max, +}; + +[ifdef type_sz] + typedef [type_sz] sz; +[else] +# ifdef __cplusplus + /* C++ gives us a clean, standardized way to do this */ + typedef decltype (sizeof(char)) sz; +# else +# if defined(__GNUC__) || defined(__clang__) + typedef __typeof__ (sizeof(char)) sz; +# else + /* we're stumped - set sz to the safest possible value under + * the circumstances, and warn the user. */ +# warning no authoritative sz (size_t) type definition \ + available; defaulting to largest unsigned integer type + typedef ubig sz; +# endif +# endif +[endif] + +[ifdef type_offset] + typedef [type_offset] offset; +[else] +# ifdef __cplusplus + /* C++ gives us a clean, standardized way to do this */ + typedef decltype (((void*)-1) - 1) offset; +# else +# if defined(__GNUC__) || defined(__clang__) + typedef __typeof__ (((void*)10) - ((void*)5)) offset; +# else + /* no dice - set offset to the safest possible value under + * the circumstances, and warn the user. */ +# warning no authoritative offset (ptrdiff_t) type definition \ + available; defaulting to largest unsigned integer type + typedef sbig offset; +# endif +# endif +[endif] + +// exit status integer types - pls use kbad in instead +[if [target_posix] == yes] + /* by convention, posix return values are 8-bit, + * but note that many modern UNIXes do technically + * support higher-bit values. for this reason, + * longstat is defined differently under posix. */ + typedef u8 stat; + typedef u32 stat_long; +[else] + [if ([atom_target_os] == win) || + ([atom_target_os] == vms)] + typedef u32 stat; + [else] + typedef u8 stat; + /* we don't know a specific exit status type + * for your arch so we're going with a sane + * default. if this is wrong, help us fix it! */ + [endif] + typedef stat stat_long; +[endif] + +#endif ADDED legacy/kcore/type.x86.32.i Index: legacy/kcore/type.x86.32.i ================================================================== --- legacy/kcore/type.x86.32.i +++ legacy/kcore/type.x86.32.i @@ -0,0 +1,14 @@ +#define KVarch x86 +#define KVbits 32 + +typedef unsigned long sz; + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned long u32; +typedef signed long s32; + +typedef u32 word; +typedef s32 sword; ADDED legacy/kcore/type.x86.64.i Index: legacy/kcore/type.x86.64.i ================================================================== --- legacy/kcore/type.x86.64.i +++ legacy/kcore/type.x86.64.i @@ -0,0 +1,18 @@ +#define KVarch x86 +#define KVbits 64 + +typedef unsigned long long sz; + +typedef unsigned char u8; +typedef signed char s8; +typedef unsigned short u16; +typedef signed short s16; +typedef unsigned long u32; +typedef signed long s32; +typedef unsigned long long u64; +typedef signed long long s64; +typedef __uint128_t u128; +typedef __int128_t s128; + +typedef u64 word; +typedef s64 sword; ADDED legacy/posix_fd_write.fn.x86.lin.32.s Index: legacy/posix_fd_write.fn.x86.lin.32.s ================================================================== --- legacy/posix_fd_write.fn.x86.lin.32.s +++ legacy/posix_fd_write.fn.x86.lin.32.s @@ -0,0 +1,14 @@ +bits 32 +global kio_posix_fd_write + +%include "../arch/x86.lin.32.s" +; vim: ft=nasm + +kio_posix_fd_write: + mov sys.reg.0, sys.call.write + mov sys.reg.1, [esp + 4] ; holy god but this took the most + mov sys.reg.2, [esp + 8] ; stupidly long time to fucking + mov sys.reg.3, [esp + 12]; figure out + sys.call + ret + ADDED legacy/posix_fd_write.fn.x86.lin.64.s Index: legacy/posix_fd_write.fn.x86.lin.64.s ================================================================== --- legacy/posix_fd_write.fn.x86.lin.64.s +++ legacy/posix_fd_write.fn.x86.lin.64.s @@ -0,0 +1,14 @@ +bits 64 +global kio_posix_fd_write + +%include "../arch/x86.lin.64.s" +; vim: ft=nasm + +kio_posix_fd_write: + mov sys.reg.0, sys.write + ; mov sys.reg.1, ccall.reg.0 - nop + ; mov sys.reg.2, ccall.reg.1 - nop + ; mov sys.reg.3, ccall.reg.2 - nop + sys.call + ret +