1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-05-30 12:44:56 +02:00
parent 1331ccdff5
commit 0641094a96
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
21 changed files with 86 additions and 87 deletions

View File

@ -1,4 +1,4 @@
; The OS/K Team licences this file to you under the MIT license. ; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information. ; See the LICENSE file in the project root for more information.
; ;

View File

@ -1,4 +1,4 @@
; The OS/K Team licences this file to you under the MIT license. ; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information. ; See the LICENSE file in the project root for more information.
; ;

View File

@ -1,4 +1,4 @@
; The OS/K Team licences this file to you under the MIT license. ; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information. ; See the LICENSE file in the project root for more information.
; ;

View File

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
The OS/K Team licenses this file to you under the MIT license.
See the LICENSE file in the project root for more information.
-->
<!DOCTYPE language SYSTEM "language.dtd"> <!DOCTYPE language SYSTEM "language.dtd">
<language _name="Assembler (K-Arch)" version="1.0" _section="Sources" globs="*.k" mimetypes="text/x-asm;text/x-assembler"> <language _name="Assembler (K-Arch)" version="1.0" _section="Sources" globs="*.k" mimetypes="text/x-asm;text/x-assembler">
@ -13,7 +17,7 @@
<start-regex>/\*</start-regex> <start-regex>/\*</start-regex>
<end-regex>\*/</end-regex> <end-regex>\*/</end-regex>
</block-comment> </block-comment>
<pattern-item _name="Label" style="Preprocessor"> <pattern-item _name="Label" style="Preprocessor">
<regex>^[A-Za-z_][A-Za-z_0-9.]*\:</regex> <regex>^[A-Za-z_][A-Za-z_0-9.]*\:</regex>
</pattern-item> </pattern-item>
@ -26,25 +30,25 @@
<start-regex>&quot;</start-regex> <start-regex>&quot;</start-regex>
<end-regex>&quot;</end-regex> <end-regex>&quot;</end-regex>
</string> </string>
<string _name="String 2" style = "String" end-at-line-end="TRUE"> <string _name="String 2" style = "String" end-at-line-end="TRUE">
<start-regex>&apos;</start-regex> <start-regex>&apos;</start-regex>
<end-regex>&apos;</end-regex> <end-regex>&apos;</end-regex>
</string> </string>
<keyword-list _name="Assembler Cmds" style="def:preprocessor" <keyword-list _name="Assembler Cmds" style="def:preprocessor"
case-sensitive="TRUE" case-sensitive="TRUE"
match-empty-string-at-beginning = "TRUE" match-empty-string-at-beginning = "TRUE"
match-empty-string-at-end = "TRUE"> match-empty-string-at-end = "TRUE">
<keyword>include</keyword> <keyword>include</keyword>
</keyword-list> </keyword-list>
<pattern-item _name="Instructions" style="def:keyword" case-sensitive="FALSE" <pattern-item _name="Instructions" style="def:keyword" case-sensitive="FALSE"
match-empty-string-at-beginning = "TRUE" match-empty-string-at-beginning = "TRUE"
match-empty-string-at-end = "TRUE"> match-empty-string-at-end = "TRUE">
<regex>^\s+[a-zA-Z_]{2,}</regex> <regex>^\s+[a-zA-Z_]{2,}</regex>
</pattern-item> </pattern-item>
<keyword-list _name="Registers K" style="def:type" <keyword-list _name="Registers K" style="def:type"
case-sensitive="FALSE" case-sensitive="FALSE"
match-empty-string-at-beginning = "TRUE" match-empty-string-at-beginning = "TRUE"

View File

@ -11,11 +11,11 @@ static inline void _except(ctx_t *ctx, int x, char *fmt, ...)
va_list ap; va_list ap;
log("Disassembly error: "); log("Disassembly error: ");
va_start(ap, fmt); va_start(ap, fmt);
vlog(fmt, ap); vlog(fmt, ap);
va_end(ap); va_end(ap);
log("\n"); log("\n");
if (ctx->disf) if (ctx->disf)
@ -39,14 +39,14 @@ static void scan_param(ctx_t *ctx, acc_t *p)
p->mlen = c & 0xF; p->mlen = c & 0xF;
c = ctx->get(ctx); c = ctx->get(ctx);
} }
else if (A_IS_OFF(c)) { else if (A_IS_OFF(c)) {
p->mem = 1; p->mem = 1;
p->mlen = c & 0xF; p->mlen = c & 0xF;
p->off = (short)ctx->get(ctx); p->off = (short)ctx->get(ctx);
c = ctx->get(ctx); c = ctx->get(ctx);
} }
if (c >= A_IMM16) { if (c >= A_IMM16) {
// Check for double access code // Check for double access code
if (p->type != A_REG) if (p->type != A_REG)
@ -57,26 +57,26 @@ static void scan_param(ctx_t *ctx, acc_t *p)
} }
p->val = c; p->val = c;
if (p->type == A_IMM32) { if (p->type == A_IMM32) {
p->ilen = 4; p->ilen = 4;
p->val = p->val | ((ulong)ctx->get(ctx) << 16); p->val = p->val | ((ulong)ctx->get(ctx) << 16);
} }
else if (p->type == A_IMM64) { else if (p->type == A_IMM64) {
p->ilen = 8; p->ilen = 8;
p->val = p->val | ((ulong)ctx->get(ctx) << 16); p->val = p->val | ((ulong)ctx->get(ctx) << 16);
p->val = p->val | ((ulong)ctx->get(ctx) << 32); p->val = p->val | ((ulong)ctx->get(ctx) << 32);
p->val = p->val | ((ulong)ctx->get(ctx) << 48); p->val = p->val | ((ulong)ctx->get(ctx) << 48);
} }
else if (p->type == A_REG) { else if (p->type == A_REG) {
if (p->val > NREGS) { if (p->val > NREGS) {
_except(ctx, E_ILL, "Inexistent REG"); _except(ctx, E_ILL, "Inexistent REG");
} }
r = &ctx->r[p->val]; r = &ctx->r[p->val];
if (r->flags & (RES | CTL)) { if (r->flags & (RES | CTL)) {
_except(ctx, E_ACC, "Reserved REG: %s", r->name); _except(ctx, E_ACC, "Reserved REG: %s", r->name);
} }
@ -102,13 +102,13 @@ void disasm(ctx_t *ctx)
c = ctx->get(ctx); c = ctx->get(ctx);
} }
} }
else if (!ISINSTR(c)) { else if (!ISINSTR(c)) {
_except(ctx, E_ILL, "Bad opcode: 0x%04hX", c); _except(ctx, E_ILL, "Bad opcode: 0x%04hX", c);
} }
i = &ctx->i[c]; i = &ctx->i[c];
// Scan for parameters // Scan for parameters
if (i->prm1 != NOPRM) { if (i->prm1 != NOPRM) {
scan_param(ctx, &p1); scan_param(ctx, &p1);
@ -120,7 +120,7 @@ void disasm(ctx_t *ctx)
#ifdef _NEED_DISASM #ifdef _NEED_DISASM
dumpinstr(ctx, rip, rep, c, &p1, &p2); dumpinstr(ctx, rip, rep, c, &p1, &p2);
#else #else
do_rep: do_rep:
dumpinstr(ctx, rip, rep, c, &p1, &p2); dumpinstr(ctx, rip, rep, c, &p1, &p2);
i->func(ctx, &p1, &p2); i->func(ctx, &p1, &p2);

View File

@ -31,16 +31,16 @@ void dumpfwstack(ctx_t *ctx)
void d_log(ctx_t *ctx, char *fmt, ...) void d_log(ctx_t *ctx, char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
if (ctx->disf) { if (ctx->disf) {
vfprintf(ctx->disf, fmt, ap); vfprintf(ctx->disf, fmt, ap);
fflush(ctx->disf); fflush(ctx->disf);
} }
else else
vlog(fmt, ap); vlog(fmt, ap);
va_end(ap); va_end(ap);
} }
@ -53,19 +53,19 @@ void dumpinstr(ctx_t *ctx, ulong rip, uint rep,
d_log(ctx, "0x%08lX: %s%s", rip, d_log(ctx, "0x%08lX: %s%s", rip,
(rep ? "rep " : ""), (rep ? "rep " : ""),
i->name); i->name);
if (i->prm1 != NOPRM) if (i->prm1 != NOPRM)
p = p1; p = p1;
lp: lp:
if (p != 0) { if (p != 0) {
if (p->mem) d_log(ctx, " %c:[", getmempref(p->mlen)); if (p->mem) d_log(ctx, " %c:[", getmempref(p->mlen));
else d_log(ctx, " "); else d_log(ctx, " ");
if (p->type == A_REG) if (p->type == A_REG)
d_log(ctx, "%s", ctx->r[p->val].name); d_log(ctx, "%s", ctx->r[p->val].name);
else else
d_log(ctx, "%c:0x%lX", getmempref(p->ilen), p->val); d_log(ctx, "%c:0x%lX", getmempref(p->ilen), p->val);
if (p->mem) { if (p->mem) {
if (p->off) if (p->off)
d_log(ctx, "+%hd", p->off); d_log(ctx, "+%hd", p->off);

View File

@ -8,11 +8,11 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
va_list ap; va_list ap;
log("\nException %d - ", code); log("\nException %d - ", code);
va_start(ap, fmt); va_start(ap, fmt);
vlog(fmt, ap); vlog(fmt, ap);
va_end(ap); va_end(ap);
log("\n"); log("\n");
dumpregs(ctx); dumpregs(ctx);

View File

@ -1,4 +1,4 @@
# The OS/K Team licences this file to you under the MIT license. # The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information. # See the LICENSE file in the project root for more information.
stop stop

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
# The OS/K Team licences this file to you under the MIT license. # The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information. # See the LICENSE file in the project root for more information.
fi = open("INSTRS") fi = open("INSTRS")
@ -24,15 +24,15 @@ def getflag(s):
if s == "m": if s == "m":
return "P_MEM" return "P_MEM"
return "__ERROR__" return "__ERROR__"
for _, line in enumerate(fi): for _, line in enumerate(fi):
if line[0] == '#' or line[0] == ' ' or line[0] == '\n': if line[0] == '#' or line[0] == ' ' or line[0] == '\n':
continue continue
tok = line.strip().split(' ') tok = line.strip().split(' ')
if len(tok) == 1: if len(tok) == 1:
name = tok[0] name = tok[0]
p1 = "NOPRM" p1 = "NOPRM"
@ -42,12 +42,12 @@ for _, line in enumerate(fi):
name = "{}_{}".format(tok[0], tok[1].strip()) name = "{}_{}".format(tok[0], tok[1].strip())
p1 = getflag(tok[1]) p1 = getflag(tok[1])
p2 = "NOPRM" p2 = "NOPRM"
elif len(tok) == 3: elif len(tok) == 3:
name = "{}_{}_{}".format(tok[0], tok[1], tok[2].strip()) name = "{}_{}_{}".format(tok[0], tok[1], tok[2].strip())
p1 = getflag(tok[1]) p1 = getflag(tok[1])
p2 = getflag(tok[2]) p2 = getflag(tok[2])
else: else:
name = "__ERROR__" name = "__ERROR__"
p1 = "__ERROR__" p1 = "__ERROR__"

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"
@ -31,16 +31,16 @@ IMPL_START_1(mul)
ulong t = (u1 * u2); ulong t = (u1 * u2);
ulong w3 = (t & 0xffffffff); ulong w3 = (t & 0xffffffff);
ulong k = (t >> 32); ulong k = (t >> 32);
v1 >>= 32; v1 >>= 32;
t = (v1 * u2) + k; t = (v1 * u2) + k;
k = (t & 0xffffffff); k = (t & 0xffffffff);
ulong w1 = (t >> 32); ulong w1 = (t >> 32);
v2 >>= 32; v2 >>= 32;
t = (u1 * v2) + k; t = (u1 * v2) + k;
k = (t >> 32); k = (t >> 32);
ctx->r[RDX].val = (v1 * v2) + w1 + k; ctx->r[RDX].val = (v1 * v2) + w1 + k;
ctx->r[RAX].val = (t << 32) + w3; ctx->r[RAX].val = (t << 32) + w3;
} }

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"
@ -35,7 +35,7 @@ IMPL_START_1(lea)
if (!p2->mem) { if (!p2->mem) {
_except(ctx, E_ILL, "Bad LEA format"); _except(ctx, E_ILL, "Bad LEA format");
} }
v1 = (p2->type == A_REG ? ctx->r[p2->val].val : p2->val) + p2->off; v1 = (p2->type == A_REG ? ctx->r[p2->val].val : p2->val) + p2->off;
} }
IMPL_OUT; IMPL_OUT;

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "../arch.h" #include "../arch.h"
@ -65,6 +65,3 @@ void i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2) \
#define JUMP(v) \ #define JUMP(v) \
ctx->r[RIP].val = v + ctx->r[CR1].val ctx->r[RIP].val = v + ctx->r[CR1].val

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"
@ -11,7 +11,7 @@
IMPL_START_2(test) IMPL_START_2(test)
{ {
ulong v = v1 & v2; ulong v = v1 & v2;
if (v == 0) ctx->r[FLG].val |= ZF; if (v == 0) ctx->r[FLG].val |= ZF;
else ctx->r[FLG].val &= ~ZF; else ctx->r[FLG].val &= ~ZF;
} }
@ -23,7 +23,7 @@ IMPL_START_2(cmp)
ctx->r[FLG].val |= ZF; ctx->r[FLG].val |= ZF;
ctx->r[FLG].val &= ~CF; ctx->r[FLG].val &= ~CF;
} }
else if (v1 < v2) { else if (v1 < v2) {
ctx->r[FLG].val &= ~ZF; ctx->r[FLG].val &= ~ZF;
ctx->r[FLG].val |= CF; ctx->r[FLG].val |= CF;

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"
@ -67,7 +67,7 @@ IMPL_END;
IMPL_START_0(popf) IMPL_START_0(popf)
{ {
CHK_STACK(<=); CHK_STACK(<=);
// XXX // XXX
CHK_SUPERV(); CHK_SUPERV();
@ -76,4 +76,3 @@ IMPL_START_0(popf)
} }
IMPL_END; IMPL_END;

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "instrs.h" #include "instrs.h"

View File

@ -6,7 +6,7 @@
void log(const char *fmt, ...) void log(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);

View File

@ -1,4 +1,4 @@
// The OS/K Team licences this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include "arch.h" #include "arch.h"
@ -20,9 +20,9 @@ ushort bget(ctx_t *ctx)
} }
ushort c = ctx->mp[addr2real(ctx->r[RIP].val)]; ushort c = ctx->mp[addr2real(ctx->r[RIP].val)];
ctx->r[RIP].val += 2; ctx->r[RIP].val += 2;
return c; return c;
} }
@ -44,7 +44,7 @@ int main(int argc, char **argv)
{ {
ctx_t main_ctx; ctx_t main_ctx;
FILE *fwfile; FILE *fwfile;
main_ctx.r = arch_r; main_ctx.r = arch_r;
main_ctx.i = arch_i; main_ctx.i = arch_i;
@ -52,22 +52,22 @@ int main(int argc, char **argv)
log("Not enough arguments\n"); log("Not enough arguments\n");
exit(-3); exit(-3);
} }
fwprog = malloc(FWPROGSIZE); fwprog = malloc(FWPROGSIZE);
fwfile = fopen(argv[1], "rb"); fwfile = fopen(argv[1], "rb");
if (!fwprog) { if (!fwprog) {
log("Couldn't allocate firmware buffer\n"); log("Couldn't allocate firmware buffer\n");
exit(-1); exit(-1);
} }
if (!fwfile) { if (!fwfile) {
log("Couldn't open program file\n"); log("Couldn't open program file\n");
exit(-2); exit(-2);
} }
fwsize = fread(fwprog, 1, FWPROGSIZE, fwfile); fwsize = fread(fwprog, 1, FWPROGSIZE, fwfile);
//log("Loaded %lu bytes //log("Loaded %lu bytes
if (fwsize < 2) { if (fwsize < 2) {
@ -78,19 +78,19 @@ int main(int argc, char **argv)
if (!(argc > 2 && !strcmp(argv[2], "-d"))) { if (!(argc > 2 && !strcmp(argv[2], "-d"))) {
main_ctx.mp = malloc(MEMSIZE + 16); main_ctx.mp = malloc(MEMSIZE + 16);
main_ctx.mz = MEMSIZE; main_ctx.mz = MEMSIZE;
main_ctx.get = bget; main_ctx.get = bget;
main_ctx.disf = NULL; main_ctx.disf = NULL;
main_ctx.r[RIP].val = MEMOFF; main_ctx.r[RIP].val = MEMOFF;
if (main_ctx.mp == 0) { if (main_ctx.mp == 0) {
log("Couldn't allocate RAM\n"); log("Couldn't allocate RAM\n");
exit(-1); exit(-1);
} }
memcpy(&main_ctx.mp[addr2real(main_ctx.r[RIP].val)], fwprog, fwsize); memcpy(&main_ctx.mp[addr2real(main_ctx.r[RIP].val)], fwprog, fwsize);
while (1) { while (1) {
decode(&main_ctx); decode(&main_ctx);
} }
@ -99,7 +99,7 @@ int main(int argc, char **argv)
// Disassembly // Disassembly
else { else {
main_ctx.disf = fopen("fwprog.dis", "w"); main_ctx.disf = fopen("fwprog.dis", "w");
if (main_ctx.disf == NULL) { if (main_ctx.disf == NULL) {
log("Couldn't open fwprog.dis\n"); log("Couldn't open fwprog.dis\n");
exit(-2); exit(-2);
@ -109,7 +109,7 @@ int main(int argc, char **argv)
main_ctx.mz = 0; main_ctx.mz = 0;
main_ctx.get = dget; main_ctx.get = dget;
while (1) { while (1) {
disasm(&main_ctx); disasm(&main_ctx);
} }

View File

@ -47,7 +47,7 @@ ulong readmem8(ctx_t *ctx, ulong addr)
{ {
GETREAL(); GETREAL();
CHK_RANGE(); CHK_RANGE();
if (addr % 2 == 0) return (ulong)ctx->mp[real] & 0xFF; if (addr % 2 == 0) return (ulong)ctx->mp[real] & 0xFF;
else return ((ulong)ctx->mp[real] & 0xFF00) >> 8; else return ((ulong)ctx->mp[real] & 0xFF00) >> 8;
} }
@ -69,7 +69,7 @@ ulong readmem32(ctx_t *ctx, ulong addr)
ulong val = ctx->mp[real++]; ulong val = ctx->mp[real++];
val = val | ((ulong)ctx->mp[real] << 16); val = val | ((ulong)ctx->mp[real] << 16);
return val; return val;
} }
@ -83,7 +83,7 @@ ulong readmem64(ctx_t *ctx, ulong addr)
val = val | ((ulong)ctx->mp[real++] << 16); val = val | ((ulong)ctx->mp[real++] << 16);
val = val | ((ulong)ctx->mp[real++] << 32); val = val | ((ulong)ctx->mp[real++] << 32);
val = val | ((ulong)ctx->mp[real] << 48); val = val | ((ulong)ctx->mp[real] << 48);
return val; return val;
} }
@ -93,11 +93,11 @@ void writemem8(ctx_t *ctx, ulong val, ulong addr)
CHK_RANGE(); CHK_RANGE();
ushort v = ctx->mp[real]; ushort v = ctx->mp[real];
if (addr % 2) { if (addr % 2) {
ctx->mp[real] = (v & 0xFF00) | (val & 0xFF); ctx->mp[real] = (v & 0xFF00) | (val & 0xFF);
} }
else { else {
ctx->mp[real] = (v & 0xFF) | (((val & 0xFF) << 8)); ctx->mp[real] = (v & 0xFF) | (((val & 0xFF) << 8));
} }

View File

@ -46,10 +46,10 @@ reg_t arch_r[NREGS] =
// cr0: various flags // cr0: various flags
{ "cr0", "Control register 0", "Control", 0, CTL }, { "cr0", "Control register 0", "Control", 0, CTL },
// cr1: code offset // cr1: code offset
{ "cr1", "Control register 1", "Control", 0, CTL }, { "cr1", "Control register 1", "Control", 0, CTL },
// cr2: data offset // cr2: data offset
{ "cr2", "Control register 2", "Control", 0, CTL }, { "cr2", "Control register 2", "Control", 0, CTL },
@ -75,15 +75,15 @@ void dumpregs(ctx_t *ctx)
{ {
int i; int i;
reg_t *r; reg_t *r;
assert(ctx->r[INV].val == 0); assert(ctx->r[INV].val == 0);
log("\nRegisters:"); log("\nRegisters:");
for (i = RAX; i < CR4; i++) { for (i = RAX; i < CR4; i++) {
if ((i-1) % 4 == 0) if ((i-1) % 4 == 0)
log("\n"); log("\n");
r = &ctx->r[i]; r = &ctx->r[i];
log("%s%s=0x%-16lX ", r->name, log("%s%s=0x%-16lX ", r->name,
(strlen(r->name) == 2 ? "=" : ""), r->val); (strlen(r->name) == 2 ? "=" : ""), r->val);

View File

@ -28,7 +28,7 @@ enum
NX5, NX5,
NX6, NX6,
NX7, NX7,
AX0, AX0,
AX1, AX1,
AX2, AX2,
@ -37,7 +37,7 @@ enum
AX5, AX5,
AX6, AX6,
AX7, AX7,
CR0, CR0,
CR1, CR1,
CR2, CR2,
@ -46,7 +46,7 @@ enum
CR5, CR5,
CR6, CR6,
CR7, CR7,
SA0, SA0,
SA1, SA1,
SA2, SA2,
@ -59,7 +59,7 @@ enum
NREGS NREGS
}; };
enum enum
{ {
GPR = 1 << 0, // General GPR = 1 << 0, // General
CTL = 1 << 1, // Control CTL = 1 << 1, // Control
@ -78,7 +78,7 @@ enum
OV = 1 << 4, // Overflow flag OV = 1 << 4, // Overflow flag
DF = 1 << 5, // Direction flag DF = 1 << 5, // Direction flag
SF = 1 << 6, // Sign flag SF = 1 << 6, // Sign flag
UF = 1 << 16, // User-mode flag UF = 1 << 16, // User-mode flag
IF = 1 << 17, // Interrupts enable flag IF = 1 << 17, // Interrupts enable flag
}; };
@ -92,4 +92,3 @@ struct reg_t
ulong flags; ulong flags;
}; };