Removes casts.?pp and moves it to Electronics.
This commit is contained in:
parent
ebb537d5e1
commit
8339b7e8e6
6 changed files with 67 additions and 85 deletions
16
Makefile
16
Makefile
|
@ -13,8 +13,8 @@ TEMPLE = mono temple.exe
|
|||
# File Lists
|
||||
SRCS_AS = asm/dynamic.S asm/intr_common_handler.S asm/multiboot.S asm/start.S
|
||||
SRCS_CC = src/console.c src/init.c src/interrupts.c src/malloc.c src/pmm.c src/serial.c src/stdlib.c src/timer.c src/vmm.c
|
||||
SRCS_CXX = src/cplusplus.cpp src/vm.cpp csl/casts.cpp csl/cpustatetype.cpp csl/io.cpp
|
||||
OBJS = obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/casts.o obj/cpustatetype.o obj/io.o
|
||||
SRCS_CXX = src/cplusplus.cpp src/vm.cpp csl/cpustatetype.cpp csl/io.cpp
|
||||
OBJS = obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/cpustatetype.o obj/io.o
|
||||
|
||||
# Flags
|
||||
FLAGS = -g -Wall -Wextra -m32 -DCIRCUIT_OS -Dnullptr=0 -D__cdecl="__attribute__((cdecl))" -mno-sse -mno-sse2 -mno-mmx -I/home/felix/projects/Electronics/Electronics/Conductance -I/home/felix/projects/Electronics/Electronics/Tools
|
||||
|
@ -28,10 +28,10 @@ all: kernel
|
|||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/casts.o obj/cpustatetype.o obj/io.o
|
||||
$(RM) obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/cpustatetype.o obj/io.o
|
||||
|
||||
kernel: obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/casts.o obj/cpustatetype.o obj/io.o conductance/assembly.o conductance/compoundtype.o conductance/instructions.o conductance/process.o conductance/string.o conductance/thread.o conductance/virtualmachine.o conductance/vmpointertype.o conductance/vmprimitivetype.o conductance/vmtype.o conductance/vmvalue.o conductance/vmvoidtype.o obj/main.in obj/keyboard.in
|
||||
$(LD) $(FLAGS) $(LDFLAGS) -o $@ obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/casts.o obj/cpustatetype.o obj/io.o conductance/assembly.o conductance/compoundtype.o conductance/instructions.o conductance/process.o conductance/string.o conductance/thread.o conductance/virtualmachine.o conductance/vmpointertype.o conductance/vmprimitivetype.o conductance/vmtype.o conductance/vmvalue.o conductance/vmvoidtype.o
|
||||
kernel: obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/cpustatetype.o obj/io.o conductance/assembly.o conductance/casts.o conductance/compoundtype.o conductance/instructions.o conductance/process.o conductance/string.o conductance/thread.o conductance/virtualmachine.o conductance/vmpointertype.o conductance/vmprimitivetype.o conductance/vmprocessidtype.o conductance/vmtype.o conductance/vmvalue.o conductance/vmvoidtype.o obj/main.in obj/keyboard.in
|
||||
$(LD) $(FLAGS) $(LDFLAGS) -o $@ obj/dynamic.o obj/intr_common_handler.o obj/multiboot.o obj/start.o obj/console.o obj/init.o obj/interrupts.o obj/malloc.o obj/pmm.o obj/serial.o obj/stdlib.o obj/timer.o obj/vmm.o obj/cplusplus.o obj/vm.o obj/cpustatetype.o obj/io.o conductance/assembly.o conductance/casts.o conductance/compoundtype.o conductance/instructions.o conductance/process.o conductance/string.o conductance/thread.o conductance/virtualmachine.o conductance/vmpointertype.o conductance/vmprimitivetype.o conductance/vmprocessidtype.o conductance/vmtype.o conductance/vmvalue.o conductance/vmvoidtype.o
|
||||
|
||||
# src/console.c
|
||||
obj/console.o: src/console.c include/console.h include/kstdlib.h \
|
||||
|
@ -93,13 +93,9 @@ obj/cplusplus.o: src/cplusplus.cpp include/kstdlib.h include/varargs.h \
|
|||
obj/vm.o: src/vm.cpp include/kstdlib.h include/varargs.h include/config.h \
|
||||
include/malloc.h include/timer.h include/dynamic.h include/console.h \
|
||||
include/multiboot.h include/interrupts.h include/cpustate.h \
|
||||
src/../csl/cpustatetype.hpp src/../csl/io.hpp src/../csl/casts.hpp
|
||||
src/../csl/cpustatetype.hpp src/../csl/io.hpp
|
||||
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c src/vm.cpp
|
||||
|
||||
# csl/casts.cpp
|
||||
obj/casts.o: csl/casts.cpp csl/casts.hpp
|
||||
$(CXX) -iquoteobj $(FLAGS) $(CXXFLAGS) -o $@ -c csl/casts.cpp
|
||||
|
||||
# csl/cpustatetype.cpp
|
||||
obj/cpustatetype.o: csl/cpustatetype.cpp csl/cpustatetype.hpp \
|
||||
include/cpustate.h include/console.h
|
||||
|
|
|
@ -56,7 +56,9 @@ SOURCES = ../../Electronics/Electronics/Conductance/types/compoundtype.cpp
|
|||
../ker/string.cpp \
|
||||
../../Electronics/Electronics/Conductance/thread.cpp \
|
||||
../../Electronics/Electronics/Conductance/process.cpp \
|
||||
../../Electronics/Electronics/Conductance/instructions.cpp
|
||||
../../Electronics/Electronics/Conductance/instructions.cpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprocessidtype.cpp \
|
||||
../../Electronics/Electronics/Conductance/csl/casts.cpp
|
||||
OBJECTS = compoundtype.o \
|
||||
vmpointertype.o \
|
||||
vmprimitivetype.o \
|
||||
|
@ -68,7 +70,9 @@ OBJECTS = compoundtype.o \
|
|||
string.o \
|
||||
thread.o \
|
||||
process.o \
|
||||
instructions.o
|
||||
instructions.o \
|
||||
vmprocessidtype.o \
|
||||
casts.o
|
||||
DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
|
||||
/usr/lib/qt/mkspecs/common/unix.conf \
|
||||
/usr/lib/qt/mkspecs/common/linux.conf \
|
||||
|
@ -225,7 +229,9 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
|
|||
../Tools/binaryreader.hpp \
|
||||
../Tools/binarywriter.hpp \
|
||||
../Tools/fixedstring.hpp \
|
||||
../Tools/refcounted.hpp ../../Electronics/Electronics/Conductance/types/compoundtype.cpp \
|
||||
../Tools/refcounted.hpp \
|
||||
types/vmprocessidtype.hpp \
|
||||
csl/casts.hpp ../../Electronics/Electronics/Conductance/types/compoundtype.cpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmpointertype.cpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprimitivetype.cpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmvoidtype.cpp \
|
||||
|
@ -236,7 +242,9 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
|
|||
../ker/string.cpp \
|
||||
../../Electronics/Electronics/Conductance/thread.cpp \
|
||||
../../Electronics/Electronics/Conductance/process.cpp \
|
||||
../../Electronics/Electronics/Conductance/instructions.cpp
|
||||
../../Electronics/Electronics/Conductance/instructions.cpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprocessidtype.cpp \
|
||||
../../Electronics/Electronics/Conductance/csl/casts.cpp
|
||||
QMAKE_TARGET = Conductance
|
||||
DESTDIR = #avoid trailing-slash linebreak
|
||||
TARGET = libConductance.a
|
||||
|
@ -715,7 +723,10 @@ virtualmachine.o: ../../Electronics/Electronics/Conductance/virtualmachine.cpp /
|
|||
../../Electronics/Electronics/Tools/binaryreader.hpp \
|
||||
../../Electronics/Electronics/Tools/refcounted.hpp \
|
||||
../../Electronics/Electronics/Conductance/assembly.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/compoundtype.hpp
|
||||
../../Electronics/Electronics/Conductance/types/compoundtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprocessidtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprimitivetype.hpp \
|
||||
../../Electronics/Electronics/Conductance/csl/casts.hpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o virtualmachine.o ../../Electronics/Electronics/Conductance/virtualmachine.cpp
|
||||
|
||||
vmtype.o: ../../Electronics/Electronics/Conductance/vmtype.cpp ../../Electronics/Electronics/Conductance/vmtype.hpp \
|
||||
|
@ -735,7 +746,8 @@ vmtype.o: ../../Electronics/Electronics/Conductance/vmtype.cpp ../../Electronics
|
|||
/home/felix/projects/trainOS/include/ker/pair.hpp \
|
||||
../../Electronics/Electronics/Tools/fixedstring.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmvoidtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprimitivetype.hpp
|
||||
../../Electronics/Electronics/Conductance/types/vmprimitivetype.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprocessidtype.hpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o vmtype.o ../../Electronics/Electronics/Conductance/vmtype.cpp
|
||||
|
||||
vmvalue.o: ../../Electronics/Electronics/Conductance/vmvalue.cpp ../../Electronics/Electronics/Conductance/vmvalue.hpp \
|
||||
|
@ -833,6 +845,45 @@ instructions.o: ../../Electronics/Electronics/Conductance/instructions.cpp /home
|
|||
../../Electronics/Electronics/Conductance/types/compoundtype.hpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o instructions.o ../../Electronics/Electronics/Conductance/instructions.cpp
|
||||
|
||||
vmprocessidtype.o: ../../Electronics/Electronics/Conductance/types/vmprocessidtype.cpp ../../Electronics/Electronics/Conductance/types/vmprocessidtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/types/vmprimitivetype.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/string.hpp \
|
||||
/home/felix/projects/trainOS/include/kstdlib.h \
|
||||
/home/felix/projects/trainOS/include/varargs.h \
|
||||
/home/felix/projects/trainOS/include/config.h \
|
||||
/home/felix/projects/trainOS/include/malloc.h \
|
||||
/home/felix/projects/trainOS/include/ker/config.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmtypes.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/vector.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/new.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmvalue.hpp \
|
||||
../../Electronics/Electronics/Conductance/opcodes.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/dictionary.hpp \
|
||||
/home/felix/projects/trainOS/include/kernel.h \
|
||||
/home/felix/projects/trainOS/include/ker/pair.hpp \
|
||||
../../Electronics/Electronics/Tools/fixedstring.hpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o vmprocessidtype.o ../../Electronics/Electronics/Conductance/types/vmprocessidtype.cpp
|
||||
|
||||
casts.o: ../../Electronics/Electronics/Conductance/csl/casts.cpp ../../Electronics/Electronics/Conductance/csl/casts.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmvalue.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmtypes.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/string.hpp \
|
||||
/home/felix/projects/trainOS/include/kstdlib.h \
|
||||
/home/felix/projects/trainOS/include/varargs.h \
|
||||
/home/felix/projects/trainOS/include/config.h \
|
||||
/home/felix/projects/trainOS/include/malloc.h \
|
||||
/home/felix/projects/trainOS/include/ker/config.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/vector.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/new.hpp \
|
||||
../../Electronics/Electronics/Conductance/vmtype.hpp \
|
||||
../../Electronics/Electronics/Conductance/opcodes.hpp \
|
||||
/home/felix/projects/trainOS/include/ker/dictionary.hpp \
|
||||
/home/felix/projects/trainOS/include/kernel.h \
|
||||
/home/felix/projects/trainOS/include/ker/pair.hpp \
|
||||
../../Electronics/Electronics/Tools/fixedstring.hpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o casts.o ../../Electronics/Electronics/Conductance/csl/casts.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#include "casts.hpp"
|
||||
|
||||
#include <vmtype.hpp>
|
||||
|
||||
namespace csl
|
||||
{
|
||||
#define CONVERT(_from, _to) if(source.type() == VMType::_from) { \
|
||||
res = VMValue::_to(source.value<VM##_from>()); \
|
||||
return ExceptionCode::None; \
|
||||
}
|
||||
#define TOINT(targetType) ExceptionCode to##targetType(VMValue &res, const VMArray &args) \
|
||||
{ \
|
||||
if(args.length() != 1) return ExceptionCode::InvalidArgument; \
|
||||
const VMValue &source = args[0]; \
|
||||
if(source.type() == VMType::targetType) { \
|
||||
res = source; \
|
||||
return ExceptionCode::None; \
|
||||
} \
|
||||
CONVERT(Int8, targetType) \
|
||||
CONVERT(Int16, targetType) \
|
||||
CONVERT(Int32, targetType) \
|
||||
CONVERT(UInt8, targetType) \
|
||||
CONVERT(UInt16, targetType) \
|
||||
CONVERT(UInt32, targetType) \
|
||||
return ExceptionCode::InvalidType; \
|
||||
}
|
||||
|
||||
TOINT(Int8)
|
||||
TOINT(Int16)
|
||||
TOINT(Int32)
|
||||
TOINT(UInt8)
|
||||
TOINT(UInt16)
|
||||
TOINT(UInt32)
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <vmvalue.hpp>
|
||||
|
||||
namespace csl
|
||||
{
|
||||
ExceptionCode toInt8(VMValue &res, const VMArray &args);
|
||||
ExceptionCode toInt16(VMValue &res, const VMArray &args);
|
||||
ExceptionCode toInt32(VMValue &res, const VMArray &args);
|
||||
|
||||
ExceptionCode toUInt8(VMValue &res, const VMArray &args);
|
||||
ExceptionCode toUInt16(VMValue &res, const VMArray &args);
|
||||
ExceptionCode toUInt32(VMValue &res, const VMArray &args);
|
||||
|
||||
ExceptionCode toBool(VMValue &res, const VMArray &args);
|
||||
ExceptionCode toText(VMValue &res, const VMArray &args);
|
||||
}
|
20
src/vm.cpp
20
src/vm.cpp
|
@ -12,7 +12,9 @@
|
|||
|
||||
#include "../csl/cpustatetype.hpp"
|
||||
#include "../csl/io.hpp"
|
||||
#include "../csl/casts.hpp"
|
||||
|
||||
// Some static assertions
|
||||
static_assert(sizeof(uint32_t) == sizeof(void*), "void* is not 32 bit wide.");
|
||||
|
||||
void printVMValue(const VMValue &value)
|
||||
{
|
||||
|
@ -46,13 +48,6 @@ ExceptionCode printArguments(VMValue &, const VMArray &args)
|
|||
return ExceptionCode::None;
|
||||
}
|
||||
|
||||
struct dtortest {
|
||||
void *mem;
|
||||
|
||||
dtortest() : mem(malloc(42)) { kprintf("[alloc]"); }
|
||||
~dtortest() { free(mem); kprintf("[free]"); }
|
||||
} ;// object;
|
||||
|
||||
struct IrqList {
|
||||
static const size_t length = 64;
|
||||
volatile uint32_t read;
|
||||
|
@ -67,7 +62,7 @@ extern "C" void vm_handle_interrupt(CpuState *state)
|
|||
irqFiFo.items[irqFiFo.write] = *state;
|
||||
irqFiFo.write += 1;
|
||||
if(irqFiFo.write >= irqFiFo.length) {
|
||||
// TODO: Don't die!
|
||||
// TODO: No, don't die!
|
||||
// Logging, statistics...
|
||||
die("irqFiFo overflow.");
|
||||
}
|
||||
|
@ -123,13 +118,6 @@ extern "C" void vm_start(const MultibootStructure *mbHeader)
|
|||
machine.import("inb") = csl::inb;
|
||||
machine.import("outb") = csl::outb;
|
||||
|
||||
machine.import("toInt8") = csl::toInt8;
|
||||
machine.import("toInt16") = csl::toInt16;
|
||||
machine.import("toInt32") = csl::toInt32;
|
||||
machine.import("toUInt8") = csl::toUInt8;
|
||||
machine.import("toUInt16") = csl::toUInt16;
|
||||
machine.import("toUInt32") = csl::toUInt32;
|
||||
|
||||
using DriverProcess = ker::Pair<Process*,uint32_t>;
|
||||
ker::Vector<DriverProcess> drivers;
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ SOURCES += \
|
|||
src/vm.cpp \
|
||||
src/serial.c \
|
||||
csl/cpustatetype.cpp \
|
||||
csl/casts.cpp \
|
||||
csl/io.cpp
|
||||
|
||||
HEADERS += \
|
||||
|
@ -43,7 +42,6 @@ HEADERS += \
|
|||
include/serial.h \
|
||||
include/malloc.h \
|
||||
csl/cpustatetype.hpp \
|
||||
csl/casts.hpp \
|
||||
csl/io.hpp \
|
||||
include/ker/config.hpp
|
||||
|
||||
|
|
Loading…
Reference in a new issue