mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
structure
This commit is contained in:
parent
488701f0e8
commit
0dfd37b628
27
Makefile
27
Makefile
@ -4,28 +4,27 @@
|
||||
all: kas
|
||||
|
||||
kpc:
|
||||
@cd pc && make --no-print-directory
|
||||
@mv pc/k.exe out/k.exe
|
||||
@cd vm && make --no-print-directory
|
||||
|
||||
kas: kpc as/k-as.py as/regs.lst
|
||||
@cp pc/instrs/instrs.lst as
|
||||
@rm -f pc/instrs/instrs.lst
|
||||
@cp vm/in/instrs.lst as
|
||||
@rm -f vm/in/instrs.lst
|
||||
|
||||
DOSK = $(shell find dos -name '*.k')
|
||||
DOSK = $(shell find ka -name '*.k')
|
||||
|
||||
out/a.out: $(DOSK)
|
||||
@cd dos && ../as/k-as.py dos.k 0x100000 ../out/a.out
|
||||
vm/a.out: $(DOSK)
|
||||
@cd ka && ../as/k-as.py dos.k 0x100000 ../vm/a.out
|
||||
|
||||
test: kas out/a.out
|
||||
@out/k.exe out/a.out > out/stdout.txt
|
||||
test: kas vm/a.out
|
||||
@vm/k.exe vm/a.out > vm/stdout.txt
|
||||
@rm -f vm/a.out
|
||||
@echo "output:"
|
||||
@echo ">>>>>>>>"
|
||||
@cat -v out/stdout.txt
|
||||
@cat -v vm/stdout.txt
|
||||
@echo
|
||||
@echo "<<<<<<<<"
|
||||
@echo
|
||||
@rm -f out/a.out
|
||||
|
||||
disasm: kas out/a.out
|
||||
@out/k.exe os/a.out -d
|
||||
@mv fwprog.dis out
|
||||
disasm: kas vm/a.out
|
||||
@vm/k.exe vm/a.out -d
|
||||
@mv fwprog.dis vm
|
||||
|
33
pc/Makefile
33
pc/Makefile
@ -1,33 +0,0 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
all: k.exe
|
||||
|
||||
src = instrs/instrs.c main.c regs.c dump.c \
|
||||
instrs/jumps.c except.c decd.c mem.c instrs/logic.c \
|
||||
instrs/stack.c instrs/super.c instrs/arith.c log.c \
|
||||
instrs/debug.c instrs/mov.c
|
||||
|
||||
obj = disd.o $(patsubst %.c,%.o,$(src))
|
||||
|
||||
CFLAGS=-O2 -g -Wall -fno-builtin-log
|
||||
|
||||
disd.o: i_arch.h *.h */*.h
|
||||
@cc $(CFLAGS) -D_NEED_DISASM -c decd.c -o $@
|
||||
|
||||
%.o: %.c i_arch.h *.h */*.h $(src)
|
||||
@cc $(CFLAGS) -c $< -o $@
|
||||
|
||||
i_arch.h: instrs/INSTRS instrs/arch_i.py
|
||||
@cd instrs && python3 arch_i.py
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
@rm *.o */*.o instrs/arch_i.h
|
||||
|
||||
k.exe: i_arch.h $(obj)
|
||||
@gcc -O2 -Wall $(obj) -o k.exe
|
||||
@rm instrs/arch_i.h
|
||||
@rm *.o */*.o
|
||||
|
32
vm/Makefile
Normal file
32
vm/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
all: k.exe
|
||||
|
||||
.PHONY: clean
|
||||
.INTERMEDIATE: %.o
|
||||
|
||||
in_src = $(shell ls in/*.c)
|
||||
pc_src = $(shell ls pc/*.c)
|
||||
|
||||
obj = disd.o $(patsubst %.c,%.o,$(pc_src)) $(patsubst %.c,%.o,$(in_src))
|
||||
|
||||
FLAGS=-O2 -g -Wall -fno-builtin-log -I.
|
||||
|
||||
disd.o: i_arch.h */*.h pc/decd.c
|
||||
@cc $(FLAGS) -D_NEED_DISASM -c pc/decd.c -o $@
|
||||
|
||||
%.o: %.c i_arch.h */*.h $(src)
|
||||
@cc $(FLAGS) -c $< -o $@
|
||||
|
||||
i_arch.h: in/INSTRS in/arch_i.py
|
||||
@cd in && python3 arch_i.py
|
||||
|
||||
clean:
|
||||
@rm -f */*.o in/arch_i.h
|
||||
|
||||
k.exe: i_arch.h $(obj)
|
||||
@gcc -O2 -Wall $(obj) -o k.exe
|
||||
@rm in/arch_i.h
|
||||
@rm -f */*.o
|
||||
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(inc);
|
||||
IMPL_COND(dec);
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(break);
|
||||
|
@ -1,11 +1,10 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
#define _NEED_ARCH_I
|
||||
#include "arch_i.h"
|
||||
#include <in/arch_i.h>
|
||||
|
||||
IMPL_START_0(nop)
|
||||
{
|
@ -1,7 +1,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.
|
||||
|
||||
#include "../arch.h"
|
||||
#include <pc/arch.h>
|
||||
#include <in/arch_i.h>
|
||||
|
||||
#define IMPL_START_0(name) \
|
||||
void i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2) \
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(jmp);
|
||||
IMPL_COND(loop);
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(not);
|
||||
IMPL_COND(and);
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(lea);
|
||||
IMPL_COND(mov);
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_COND(push);
|
||||
IMPL_COND(pop);
|
@ -1,8 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "instrs.h"
|
||||
#include "arch_i.h"
|
||||
#include <in/instrs.h>
|
||||
|
||||
//
|
||||
// Supervisor only instructions
|
@ -154,8 +154,8 @@ void writemem32(ctx_t *, ulong val, ulong addr);
|
||||
void writemem64(ctx_t *, ulong val, ulong addr);
|
||||
void writemem(ctx_t *, ulong val, ulong addr, uint len);
|
||||
|
||||
#include "regs.h"
|
||||
#include "instrs/arch_i.h"
|
||||
#include <pc/regs.h>
|
||||
#include <in/arch_i.h>
|
||||
|
||||
extern reg_t arch_r[NREGS];
|
||||
extern instr_t arch_i[NINSTRS];
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
#ifdef _NEED_DISASM
|
||||
#define _except __except
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
void dumpmem(ctx_t *ctx, ulong start, ulong size)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
void _except(ctx_t *ctx, int code, char *fmt, ...)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
void log(const char *fmt, ...)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
#define FWPROGSIZE (1024 * 1024 * 1024)
|
||||
static ssize_t fwsize;
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
ulong readmem(ctx_t *ctx, ulong addr, uint len)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include "arch.h"
|
||||
#include <pc/arch.h>
|
||||
|
||||
reg_t arch_r[NREGS] =
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user