Index: arch/ia32/src/asm.S
===================================================================
--- arch/ia32/src/asm.S	(revision 7248e312b6cb44906fb09708a87b418a6b46c576)
+++ arch/ia32/src/asm.S	(revision 24bd23a618e2bc2235c117d43b2fe92d199ebe83)
@@ -55,12 +55,10 @@
 #
 paging_on:
-	pushl %eax
-	movl %cr0,%eax
-	orl $(1<<31),%eax		# paging on
-	andl $~((1<<30)|(1<<29)),%eax	# clear Cache Disable and not Write Though
-	movl %eax,%cr0
+	movl %cr0,%edx
+	orl $(1<<31),%edx		# paging on
+	andl $~((1<<30)|(1<<29)),%edx	# clear Cache Disable and not Write Though
+	movl %edx,%cr0
 	jmp 0f
 0:
-	popl %eax
 	ret
 
@@ -71,6 +69,6 @@
 #
 enable_l_apic_in_msr:
-	pusha
-	
+	push %eax
+
 	movl $0x1b, %ecx
 	rdmsr
@@ -78,6 +76,6 @@
 	orl $(0xfee00000),%eax
 	wrmsr
-	
-	popa
+
+	pop %eax
 	ret
 
@@ -116,28 +114,28 @@
 
 # CLNT
-  pushfl;
-	pop %eax;
-	and $0xFFFFBFFF,%eax;
-	push %eax;
-	popfl;
+	pushfl
+	pop %eax
+	and $0xFFFFBFFF,%eax
+	push %eax
+	popfl
 	
 
 
 # Test if this is interrupt with error word or not
-	mov $\i,%cl;
-	movl $1,%eax;
-	test $0xe0,%cl;
-	jnz 0f;
-	and $0x1f,%cl;
-	shl %cl,%eax;
-	and $ERROR_WORD_INTERRUPT_LIST,%eax;
-	jz 0f;
+	mov $\i,%cl
+	movl $1,%eax
+	test $0xe0,%cl
+	jnz 0f
+	and $0x1f,%cl
+	shl %cl,%eax
+	and $ERROR_WORD_INTERRUPT_LIST,%eax
+	jz 0f
 
 
 # Return with error word
-	popa;
-	pop %ebp;
-	add $4,%esp;    # Skip error word
-	iret;
+	popa
+	pop %ebp
+	add $4,%esp	# Skip error word
+	iret
 
 0:
@@ -168,89 +166,74 @@
 #
 inb:
-	push %edx
 	xorl %eax,%eax
+	movl 4(%esp),%edx
+	inb %dx,%al
+	ret
+
+
+## I/O input (word)
+#
+# Get a word from I/O port and store it AX.
+#
+inw:
+	xorl %eax,%eax
+	movl 4(%esp),%edx
+	inw %dx,%ax
+	ret
+
+
+## I/O input (dword)
+#
+# Get a dword from I/O port and store it EAX.
+#
+inl:
+	xorl %eax,%eax
+	movl 4(%esp),%edx
+	inl %dx,%eax
+	ret
+
+
+## I/O output (byte)
+#
+# Send a byte to I/O port.
+#
+outb:
+	push %eax
+
 	movl 8(%esp),%edx
-	inb %dx,%al
-	pop %edx
-	ret
-
-
-## I/O input (word)
-#
-# Get a word from I/O port and store it AX.
-#
-inw:
-	push %edx
-	xorl %eax,%eax
+	movl 12(%esp),%eax
+	outb %al,%dx
+
+	pop %eax
+	ret
+
+
+## I/O output (word)
+#
+# Send a word to I/O port.
+#
+outw:
+	push %eax
+
 	movl 8(%esp),%edx
-	inw %dx,%ax
-	pop %edx
-	ret
-
-
-## I/O input (dword)
-#
-# Get a dword from I/O port and store it EAX.
-#
-inl:
-	push %edx
-	xorl %eax,%eax
+	movl 12(%esp),%eax
+	outw %ax,%dx
+
+	pop %eax
+	ret
+
+
+## I/O output (dword)
+#
+# Send a dword to I/O port.
+#
+outl:
+	push %eax
+
 	movl 8(%esp),%edx
-	inl %dx,%eax
-	pop %edx
-	ret
-
-
-## I/O output (byte)
-#
-# Send a byte to I/O port.
-#
-outb:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	movl 8(%ebp),%edx
-	movl 12(%ebp),%eax
-	outb %al,%dx
-
-	popa
-	pop %ebp
-	ret
-
-
-## I/O output (word)
-#
-# Send a word to I/O port.
-#
-outw:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	movl 8(%ebp),%edx
-	movl 12(%ebp),%eax
-	outw %ax,%dx
-
-	popa
-	pop %ebp
-	ret
-
-
-## I/O output (dword)
-#
-# Send a dword to I/O port.
-#
-outl:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	movl 8(%ebp),%edx
-	movl 12(%ebp),%eax
+	movl 12(%esp),%eax
 	outl %eax,%dx
 
-	popa
-	pop %ebp
+	pop %eax
 	ret
 
@@ -263,21 +246,19 @@
 # The memory areas cannot overlap.
 #
-SRC=12
-DST=8
-CNT=16
+SRC=16
+DST=12
+CNT=20
 memcpy:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	cld
-	movl CNT(%ebp),%ecx
-	movl DST(%ebp),%edi
-	movl SRC(%ebp),%esi
+	push %esi
+	push %edi
+
+	movl CNT(%esp),%ecx
+	movl DST(%esp),%edi
+	movl SRC(%esp),%esi
 
 	rep movsb %ds:(%esi),%es:(%edi)
 
-	popa
-	pop %ebp
+	pop %edi
+	pop %esi
 	ret
 
@@ -289,21 +270,19 @@
 # byte value defined by 3rd argument.
 #
-DST=8
-CNT=12
-X=16
+DST=12
+CNT=16
+X=20
 memsetb:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	cld
-	movl CNT(%ebp),%ecx
-	movl DST(%ebp),%edi
-	movl X(%ebp),%eax
+	push %eax
+	push %edi
+
+	movl CNT(%esp),%ecx
+	movl DST(%esp),%edi
+	movl X(%esp),%eax
 
 	rep stosb %al,%es:(%edi)
 
-	popa
-	pop %ebp
+	pop %edi
+	pop %eax
 	ret
 
@@ -315,21 +294,20 @@
 # word value defined by 3rd argument.
 #
-DST=8
-CNT=12
-X=16
+DST=12
+CNT=16
+X=20
 memsetw:
-	push %ebp
-	movl %esp,%ebp
-	pusha
-
-	cld
-	movl CNT(%ebp),%ecx
-	movl DST(%ebp),%edi
-	movl X(%ebp),%eax
+	push %eax
+	push %edi
+
+	movl CNT(%esp),%ecx
+	movl DST(%esp),%edi
+	movl X(%esp),%eax
 
 	rep stosw %ax,%es:(%edi)
 
-	popa
-	pop %ebp
+	pop %edi
+	pop %eax
+
 	ret
 
@@ -346,23 +324,16 @@
 CNT=20
 memcmp:
-	push %ebp
-	subl $4,%esp	
-	movl %esp,%ebp
-
-	pusha
-
-	cld
-	movl CNT(%ebp),%ecx
-	movl DST(%ebp),%edi
-	movl SRC(%ebp),%esi
+	push %esi
+	push %edi
+
+	movl CNT(%esp),%ecx
+	movl DST(%esp),%edi
+	movl SRC(%esp),%esi
 
 	repe cmpsb %es:(%edi),%ds:(%esi)
-	movl %ecx,(%ebp)
-
-	popa
-	
-	movl (%ebp),%eax	# return value => %eax (zero on success)
-	addl $4,%esp
-	pop %ebp
+	movl %ecx,%eax		# %ecx contains the return value (zero on success)
+
+	pop %edi
+	pop %esi
 	
 	ret
@@ -372,9 +343,9 @@
 .global utext
 utext:
-	xor %ax,%ax;
-	mov %ax,%ds;
-	mov %ax,%es;
-	mov %ax,%fs;
-	mov %ax,%gs;
+	xor %ax,%ax
+	mov %ax,%ds
+	mov %ax,%es
+	mov %ax,%fs
+	mov %ax,%gs
 0:
 	int $48
