Index: arch/ia32/src/asm.s
===================================================================
--- arch/ia32/src/asm.s	(revision ad36bd6b718c19bc3e77af6d6f92441a3d17a4d1)
+++ arch/ia32/src/asm.s	(revision d7568a9f69f58e260601d89047d089b639a4f5d6)
@@ -27,5 +27,5 @@
 #
 
-# very low and hardware-level functions
+## very low and hardware-level functions
 
 .text
@@ -54,6 +54,10 @@
 .global memcmp
 
-#
-# set priority level high
+
+## Set priority level high
+#
+# Disable interrupts and return previous
+# EFLAGS in EAX.
+#
 cpu_priority_high:
 	pushf
@@ -61,7 +65,11 @@
 	cli
 	ret
-    
-#
-# set priority level low
+
+
+## Set priority level low
+#
+# Enable interrupts and return previous
+# EFLAGS in EAX.
+#    
 cpu_priority_low:
         pushf
@@ -70,6 +78,9 @@
 	ret
 
-#
-# restore priority level
+
+## Restore priority level
+#
+# Restore EFLAGS.
+#
 cpu_priority_restore:
 	push 4(%esp)
@@ -77,5 +88,8 @@
 	ret
 
-# return raw priority level
+## Return raw priority level
+#
+# Return EFLAFS in EAX.
+#
 cpu_priority_read:
 	pushf
@@ -83,4 +97,9 @@
 	ret
 
+
+## Halt the CPU
+#
+# Halt the CPU using HLT.
+#
 cpu_halt:
 cpu_sleep:
@@ -88,4 +107,9 @@
 	ret
 
+
+## Turn paging on
+#
+# Enable paging and write-back caching in CR0.
+#
 paging_on:
 	pushl %eax
@@ -99,8 +123,18 @@
 	ret
 
+
+## Read CR3
+#
+# Store CR3 in EAX.
+#
 cpu_read_dba:
 	movl %cr3,%eax
 	ret
 
+
+## Write CR3
+#
+# Set CR3.
+#
 cpu_write_dba:
 	pushl %eax
@@ -110,8 +144,18 @@
 	ret
 
+
+## Read CR2
+#
+# Store CR2 in EAX.
+#
 cpu_read_cr2:
 	movl %cr2,%eax
 	ret
 
+
+## Enable local APIC
+#
+# Enable local APIC in MSR.
+#
 enable_l_apic_in_msr:
 	pusha
@@ -126,4 +170,13 @@
 	ret
 
+
+## Declare interrupt handlers
+#
+# Declare interrupt handlers for n interrupt
+# vectors starting at vector i.
+#
+# The handlers setup data segment registers
+# and call trap_dispatcher().
+#
 .macro handler i n
 	push %ebp
@@ -170,4 +223,8 @@
 
 
+## I/O input (byte)
+#
+# Get a byte from I/O port and store it AL.
+#
 inb:
 	push %edx
@@ -178,4 +235,9 @@
 	ret
 
+
+## I/O input (word)
+#
+# Get a word from I/O port and store it AX.
+#
 inw:
 	push %edx
@@ -186,4 +248,9 @@
 	ret
 
+
+## I/O input (dword)
+#
+# Get a dword from I/O port and store it EAX.
+#
 inl:
 	push %edx
@@ -194,4 +261,9 @@
 	ret
 
+
+## I/O output (byte)
+#
+# Send a byte to I/O port.
+#
 outb:
 	push %ebp
@@ -207,4 +279,9 @@
 	ret
 
+
+## I/O output (word)
+#
+# Send a word to I/O port.
+#
 outw:
 	push %ebp
@@ -220,4 +297,9 @@
 	ret
 
+
+## I/O output (dword)
+#
+# Send a dword to I/O port.
+#
 outl:
 	push %ebp
@@ -233,4 +315,12 @@
 	ret
 
+
+## Copy memory
+#
+# Copy a given number of bytes (3rd argument)
+# from the memory location defined by 1st argument
+# to the memory location defined by 2nd argument.
+# The memory areas cannot overlap.
+#
 SRC=8
 DST=12
@@ -252,4 +342,37 @@
 	ret
 
+
+## Fill memory with bytes
+#
+# Fill a given number of bytes (2nd argument)
+# at memory defined by 1st argument with the
+# byte value defined by 3rd argument.
+#
+DST=8
+CNT=12
+X=16
+memsetb:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	cld
+	movl CNT(%ebp),%ecx
+	movl DST(%ebp),%edi
+	movl X(%ebp),%eax
+    
+	rep stosb %al,%es:(%edi)
+    
+        popa
+	pop %ebp
+	ret
+
+
+## Fill memory with words
+#
+# Fill a given number of words (2nd argument)
+# at memory defined by 1st argument with the
+# word value defined by 3rd argument.
+#
 DST=8
 CNT=12
@@ -271,23 +394,12 @@
 	ret
 
-DST=8
-CNT=12
-X=16
-memsetb:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-    
-	cld
-	movl CNT(%ebp),%ecx
-	movl DST(%ebp),%edi
-	movl X(%ebp),%eax
-    
-	rep stosb %al,%es:(%edi)
-    
-        popa
-	pop %ebp
-	ret
-
+
+## Compare memory regions for equality
+#
+# Compare a given number of bytes (3rd argument)
+# at memory locations defined by 1st and 2nd argument
+# for equality. If the bytes are equal, EAX contains
+# 0.
+#
 SRC=12
 DST=16
