diff --git a/Kernel/Makefile b/Kernel/Makefile index 8d5afee..ad2467f 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -41,6 +41,10 @@ obj/src/%.nao : src/%.asm @echo "[i] Assembling $*.asm..." @$(AS) -f elf64 -o obj/src/$*.nao src/$*.asm +obj/src/%.lo : src/%.lua + @echo "[i] Packing $*.lua..." + @contrib/luapack.py src/$*.lua obj/src/$*.lo + obj/src/%.o : src/%.c @echo "[i] Compiling $*.c ..." @if [ -e obj/src/$*.o ] ; then rm obj/src/$*.o ; fi diff --git a/Kernel/contrib/luapack.py b/Kernel/contrib/luapack.py new file mode 100644 index 0000000..1782f1f --- /dev/null +++ b/Kernel/contrib/luapack.py @@ -0,0 +1,20 @@ +#!/usr/bin/python2 + +import sys +import struct + +path = sys.argv[1] +target = sys.argv[2] +f = open(path, "r") +source = f.read() +f.close() + +fs_path = path.replace("src/", "") +data = struct.pack(">H", len(fs_path)) +data += fs_path +data += struct.pack(">L", len(source)) +data += source + +f = open(target, "wb") +f.write(data) +f.close() \ No newline at end of file diff --git a/Kernel/include/Alentours/pci.lua b/Kernel/include/Alentours/pci.lua new file mode 100644 index 0000000..0ff0ce7 --- /dev/null +++ b/Kernel/include/Alentours/pci.lua @@ -0,0 +1,34 @@ +alentours.pci.Device = {} + +alentours.pci.buses = {} +alentours.pci.devices = {} + +function alentours.pci.Initialize() + local Devices = alentours.pci.__GetAllDevices() + for Location, DeviceRaw in pairs(Devices) do + local BusID = Location.Bus + local DeviceID = Location.Device + + if alentours.pci.buses[BusID] == nil then + alentours.pci.buses[BusID] = {} + end + + local Device = {} + Device.__raw = DeviceRaw + setmetatable(Device, alentours.pci.Device) + + alentours.pci.buses[BusID][DeviceID] = Device + end +end + +function alentours.pci.Device:GetVendor() + return self.__raw.VID, self.__raw.VendorString +end + +function alentours.pci.Device:GetProduct() + return self.__raw.PID, self.__raw.ProductName, self.__raw.ProductDescrption +end + +function alentours.pci.Device:WriteControl32(Offset, Data) + +end \ No newline at end of file