// The OS/K Team licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #ifndef _ARCH_H #define _ARCH_H #define dev_t stddev_t #include #include #include #include #include #include #include #undef dev_t #define packed __attribute__ ((__packed__)) #define static_assert _Static_assert #define alignof _Alignof typedef unsigned int bool; typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef struct reg_t reg_t; typedef struct ctx_t ctx_t; typedef struct instr_t instr_t; typedef struct acc_t acc_t; typedef struct arch_t arch_t; typedef struct dev_t dev_t; void log(const char *, ...); void vlog(const char *, va_list); #define KARCH_MAJOR 0 #define KARCH_MINOR 1 #define KARCH_REVIS 0 struct ctx_t { reg_t *r; instr_t *i; // Memory and memory size ushort *mp; ulong mz; // Read next instruction ushort (*get)(ctx_t *ctx); // Step by step int step; // Devices list head dev_t *dh; }; #define R(X) ctx->r[X].val void dumpregs(ctx_t *); void dumpinstr(ctx_t *, ulong, uint, ushort, acc_t *, acc_t *); void dumpmem(ctx_t *, ulong, ulong); void decode(ctx_t *ctx); void enable_stdin_echoing(void); void disable_stdin_echoing(void); #include #include #include #include #include extern reg_t arch_r[NREGS]; extern instr_t arch_i[NINSTRS]; #endif