Fix JMK bug, update architecture docs
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index 436339a..41cf104 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -15,7 +15,9 @@
             "cStandard": "c11",
             "intelliSenseMode": "linux-gcc-x86",
             "compilerArgs": [
-                "-nostdinc -nostdlib -O2 -m32 -g"
+                "-O2",
+                "-m32",
+                "-g"
             ]
         }
     ],
diff --git a/doc/architecture.rst b/doc/architecture.rst
index 0c8fe0f..a515f34 100644
--- a/doc/architecture.rst
+++ b/doc/architecture.rst
@@ -35,8 +35,26 @@
 Drivers
 -------
 
-So far I have only written very low level drivers (stuff like ATA PIO, PCI, VGA
-text mode, etc). These drivers have all been "bare-metal", ie: interfacing with
-hardware through ``in`` and ``out`` instructions. Higher level drivers will be
-built on top of existing ones. An interface will be created for defining, for
-example, PCI device drivers, or USB device drivers.
+So far drivers must be written either using plain ``in`` and ``out``
+instructions or on top of the existing PCI driver.
+
+PCI Device Drivers
+~~~~~~~~~~~~~~~~~~
+
+PCI device drivers must register a ``struct pci_device_driver`` in order to
+interface with a certain device (or class of devices). The relevant fields of
+``struct pci_device_driver`` are shown here:
+
+.. code-block::
+
+    bool (* supports)(struct pci_device *dev);
+    void (* init)(struct pci_device dev, uchar bus, uchar slot, uchar func);
+    char *generic_name;
+
+A PCI device driver must pass an instance of this structure to
+``pci_register_device_driver`` (in ``include/kernel/dri/pci/pci.h``. If
+``supports`` returns true, (for example, if the class and subclass of the
+``struct pci_device`` are supported by teh driver) ``init`` will be called. At
+this point the driver may do whatever it wishes with the PCI device, although
+all blocking operations should be done in another thread (using ``spawn_thread``
+in ``include/kernel/task.h`` for example).
diff --git a/include/kernel/task.h b/include/kernel/task.h
index 487c143..87b412b 100644
--- a/include/kernel/task.h
+++ b/include/kernel/task.h
@@ -48,7 +48,11 @@
 // For compatibility I guess
 #define getpid get_process_id
 
-void spawn_thread(void (*function)(void *), void *data);
+typedef void (*task_function_t)(void *data);
+
+#define TASK_FUNCTION(f) ((task_function_t)(f))
+
+void spawn_thread(task_function_t function, void *data);
 void kill_this_thread();
 extern void switch_task();
 void switch_to_task(struct task *task);
diff --git a/share/jmk/jmk.m4 b/share/jmk/jmk.m4
index cbcf3a4..656aa8e 100644
--- a/share/jmk/jmk.m4
+++ b/share/jmk/jmk.m4
@@ -70,7 +70,7 @@
 	@DO_MAKE -C $2 clean')
 
 dnl lib is used to list an external dependency declared with depends()
-define(`lib', `$(jmk_lib_path_$1)/$(jmk_lib_target_$1)')
+define(`lib', `ifelse($1,,``$0'',$(jmk_lib_path_$1)/$(jmk_lib_target_$1))')
 
 define(`phony', `jmk_custom_phony += $1')
 
diff --git a/src/kernel/boot.s b/src/kernel/boot.s
index bf97a56..043c42c 100644
--- a/src/kernel/boot.s
+++ b/src/kernel/boot.s
@@ -37,7 +37,7 @@
 	db 0						; base high
 
 	;; Second entry, code segment
-	dw 0xffffffff				; max limit
+	dw 0xffff					; max limit
 	dw 0
 
 	db 0
@@ -46,7 +46,7 @@
 	db 0
 
 	;; Third entry, data segment
-	dw 0xffffffff				; max limit
+	dw 0xffff					; max limit
 	dw 0
 
 	db 0
@@ -55,7 +55,7 @@
 	db 0
 
 	;; Fourth entry, user code segment
-	dw 0xffffffff				; max limit
+	dw 0xffff					; max limit
 	dw 0
 
 	db 0
@@ -64,7 +64,7 @@
 	db 0
 
 	;; Fifth entry, user data segment
-	dw 0xffffffff				; max limit
+	dw 0xffff					; max limit
 	dw 0
 
 	db 0
diff --git a/src/kernel/dri/ide/ide.c b/src/kernel/dri/ide/ide.c
index c5a5241..b42873d 100644
--- a/src/kernel/dri/ide/ide.c
+++ b/src/kernel/dri/ide/ide.c
@@ -1,6 +1,7 @@
 #include <dri/ide/ide.h>
 #include <task.h>
 #include <alloc.h>
+#include <log.h>
 
 struct ide_thread_data
 {
@@ -26,7 +27,7 @@
     data->slot = slot;
     data->func = func;
 
-    spawn_thread(ide_thread, data);
+    spawn_thread(TASK_FUNCTION(ide_thread), data);
 }
 
 void ide_register()
diff --git a/src/lisp/Jmk b/src/lisp/Jmk
index 4d0825f..673f586 100644
--- a/src/lisp/Jmk
+++ b/src/lisp/Jmk
@@ -33,7 +33,7 @@
 type(executable)
 
 run: lisp
-	status_log(RUN, ./lisp)
+	status_log(LISP, test.lisp)
 	@./lisp ./test.lisp
 
 format: