Changes some stuff related to Electronics.

This commit is contained in:
Felix Queißner 2015-10-10 01:41:38 +02:00
parent 3392d8e262
commit 4afac67f27
7 changed files with 153 additions and 13 deletions

View file

@ -26,9 +26,12 @@ LDFLAGS=-g -m32 -nostdlib -fno-builtin -Tkernel.ld
--
obj/main.o: scripts/main.spark
obj/main.o: scripts/main.cu
/home/felix/projects/Electronics/build-Electronics-Desktop-Debug/bin/copper \
scripts/main.cu > \
scripts/main.cu.spark
/home/felix/projects/Electronics/build-Electronics-Desktop-Debug/bin/spark \
scripts/main.spark \
scripts/main.cu.spark \
obj/main.ca
objcopy -B i386 -I binary -O elf32-i386 \
obj/main.ca obj/main.o

View file

@ -29,8 +29,8 @@ all: kernel
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/cpp-test.o obj/vm.o obj/cpustatetype.o obj/main.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/cpp-test.o obj/vm.o obj/cpustatetype.o obj/main.o conductance/assembly.o conductance/compoundtype.o conductance/opcodes.o conductance/string.o conductance/virtualmachine.o conductance/vmpointertype.o conductance/vmprimitivetype.o conductance/vmtype.o conductance/vmvalue.o conductance/vmvoidtype.o
$(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/cpp-test.o obj/vm.o obj/cpustatetype.o obj/main.o conductance/assembly.o conductance/compoundtype.o conductance/opcodes.o conductance/string.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/cpp-test.o obj/vm.o obj/cpustatetype.o obj/main.o conductance/assembly.o conductance/compoundtype.o conductance/opcodes.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
$(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/cpp-test.o obj/vm.o obj/cpustatetype.o obj/main.o conductance/assembly.o conductance/compoundtype.o conductance/opcodes.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
# src/console.c
obj/console.o: src/console.c include/console.h include/kstdlib.h \
@ -123,9 +123,12 @@ obj/start.o: asm/start.S
# Custom Targets
obj/main.o: scripts/main.spark
obj/main.o: scripts/main.cu
/home/felix/projects/Electronics/build-Electronics-Desktop-Debug/bin/copper \
scripts/main.cu > \
scripts/main.cu.spark
/home/felix/projects/Electronics/build-Electronics-Desktop-Debug/bin/spark \
scripts/main.spark \
scripts/main.cu.spark \
obj/main.ca
objcopy -B i386 -I binary -O elf32-i386 \
obj/main.ca obj/main.o

View file

@ -54,7 +54,9 @@ SOURCES = ../../Electronics/Electronics/Conductance/types/compoundtype.cpp
../../Electronics/Electronics/Conductance/virtualmachine.cpp \
../../Electronics/Electronics/Conductance/vmtype.cpp \
../../Electronics/Electronics/Conductance/vmvalue.cpp \
../ker/string.cpp
../ker/string.cpp \
../../Electronics/Electronics/Conductance/thread.cpp \
../../Electronics/Electronics/Conductance/process.cpp
OBJECTS = compoundtype.o \
vmpointertype.o \
vmprimitivetype.o \
@ -64,7 +66,9 @@ OBJECTS = compoundtype.o \
virtualmachine.o \
vmtype.o \
vmvalue.o \
string.o
string.o \
thread.o \
process.o
DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
/usr/lib/qt/mkspecs/common/unix.conf \
/usr/lib/qt/mkspecs/common/linux.conf \
@ -248,7 +252,9 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
../../Electronics/Electronics/Conductance/virtualmachine.cpp \
../../Electronics/Electronics/Conductance/vmtype.cpp \
../../Electronics/Electronics/Conductance/vmvalue.cpp \
../ker/string.cpp
../ker/string.cpp \
../../Electronics/Electronics/Conductance/thread.cpp \
../../Electronics/Electronics/Conductance/process.cpp
QMAKE_TARGET = Conductance
DESTDIR = #avoid trailing-slash linebreak
TARGET = libConductance.a
@ -817,6 +823,50 @@ string.o: ../ker/string.cpp ../include/ker/string.hpp \
../include/malloc.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o string.o ../ker/string.cpp
thread.o: ../../Electronics/Electronics/Conductance/thread.cpp ../include/kstdlib.h \
../include/varargs.h \
../include/config.h \
../include/malloc.h \
../../Electronics/Electronics/Conductance/vmtype.hpp \
../../Electronics/Electronics/Conductance/vmtypes.hpp \
../include/ker/string.hpp \
../include/ker/vector.hpp \
../include/ker/new.hpp \
../../Electronics/Electronics/Conductance/vmvalue.hpp \
../../Electronics/Electronics/Conductance/opcodes.hpp \
../include/ker/dictionary.hpp \
../include/kernel.h \
../include/ker/pair.hpp \
../../Electronics/Electronics/Tools/fixedstring.hpp \
../../Electronics/Electronics/Conductance/virtualmachine.hpp \
../../Electronics/Electronics/Tools/binaryreader.hpp \
../../Electronics/Electronics/Tools/refcounted.hpp \
../../Electronics/Electronics/Conductance/assembly.hpp \
../../Electronics/Electronics/Conductance/types/compoundtype.hpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o thread.o ../../Electronics/Electronics/Conductance/thread.cpp
process.o: ../../Electronics/Electronics/Conductance/process.cpp ../include/kstdlib.h \
../include/varargs.h \
../include/config.h \
../include/malloc.h \
../../Electronics/Electronics/Conductance/vmtype.hpp \
../../Electronics/Electronics/Conductance/vmtypes.hpp \
../include/ker/string.hpp \
../include/ker/vector.hpp \
../include/ker/new.hpp \
../../Electronics/Electronics/Conductance/vmvalue.hpp \
../../Electronics/Electronics/Conductance/opcodes.hpp \
../include/ker/dictionary.hpp \
../include/kernel.h \
../include/ker/pair.hpp \
../../Electronics/Electronics/Tools/fixedstring.hpp \
../../Electronics/Electronics/Conductance/virtualmachine.hpp \
../../Electronics/Electronics/Tools/binaryreader.hpp \
../../Electronics/Electronics/Tools/refcounted.hpp \
../../Electronics/Electronics/Conductance/assembly.hpp \
../../Electronics/Electronics/Conductance/types/compoundtype.hpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o process.o ../../Electronics/Electronics/Conductance/process.cpp
####### Install
install: FORCE

View file

@ -0,0 +1,25 @@
PUB main() | i : INT
BEGIN
native.print("Hello World!\n");
1 → i;
WHILE i <= 5 DO
native.print(i, "\n");
(i + 1) → i;
END
END
PUB irq(id : INT, data : INT)
BEGIN
native.print("irq:", id, ", ", data.eax, " ", data.ebx, "\n");
END
#!
Was noch gemacht werden muss, bis der Tastatur-Treiber funktionieren könnte:
- Support für beliebige Typen in Copper
- Pushen von Typen != INT
- erweiterung von pushi um typcode (u?int(8|16|32), bool)
- erweiterung von pushr um typcode
- Bitwise Operations
- outb und inb
- eventuell hex literals für Copper
!#

58
scripts/main.cu.spark Normal file
View file

@ -0,0 +1,58 @@
; =============================================
; compiled with Copper 1.0
; 2015-10-09 23:28:07
; =============================================
; fndecl
; 1, main
.export main
main:
pushnil ; return value
pushnil ; i:INT
; Here be dragons!
pusht "Hello World!\n"
calln print 1
pushi 1
store 1
_private_0:
load 1
pushi 5
op2 8
jmp_if_not _private_1
load 1
pusht "\n"
calln print 2
load 1
pushi 1
op2 0
store 1
jmp _private_0
_private_1:
ret
; end of main
; fndecl
; 1, irq
.export irq
irq:
pushnil ; return value
; Here be dragons!
pusht "irq:"
load -1
pusht ", "
load -2
readfld eax
pusht " "
load -2
readfld ebx
pusht "\n"
calln print 7
ret
; end of irq

View file

@ -7,19 +7,19 @@
; PUB main()
main:
pushi 0
pushi 2 0
pusht "Hello World from Conductance!\n"
calln print 1
_loop:
load 0
pushi 5
pushi 2 5
comp_less
jmp_if_not _end
load 0
pushi 1
pushi 2 1
add
store 0

View file

@ -54,7 +54,8 @@ DISTFILES += \
Makefile.new \
asm/dynamic.S \
README.md \
scripts/main.spark
scripts/main.spark \
scripts/main.cu
INCLUDEPATH += include
DEPENDPATH += include