28,9 → 28,9 |
|
## very low and hardware-level functions |
|
# Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word |
# and 1 means interrupt with error word |
#define ERROR_WORD_INTERRUPT_LIST 0x00027D00 |
# Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error |
# word and 1 means interrupt with error word |
#define ERROR_WORD_INTERRUPT_LIST 0x00027d00 |
|
.text |
|
74,7 → 74,7 |
movl MEMCPY_DST(%esp), %edi |
movl MEMCPY_SRC(%esp), %esi |
|
rep movsl /* copy as much as possible word by word */ |
rep movsl /* copy whole words */ |
|
movl MEMCPY_SIZE(%esp), %ecx |
andl $3, %ecx /* size % 4 */ |
106,7 → 106,8 |
paging_on: |
movl %cr0,%edx |
orl $(1<<31),%edx # paging on |
andl $~((1<<30)|(1<<29)),%edx # clear Cache Disable and not Write Though |
# clear Cache Disable and not Write Though |
andl $~((1 << 30) | (1 << 29)), %edx |
movl %edx,%cr0 |
jmp 0f |
0: |
118,15 → 119,11 |
# Enable local APIC in MSR. |
# |
enable_l_apic_in_msr: |
push %eax |
|
movl $0x1b, %ecx |
rdmsr |
orl $(1<<11),%eax |
orl $(0xfee00000),%eax |
wrmsr |
|
pop %eax |
ret |
|
# Clear nested flag |
151,17 → 148,25 |
.macro handler i n |
|
.ifeq \i-0x30 # Syscall handler |
push %ds |
push %es |
push %fs |
push %gs |
pushl %ds |
pushl %es |
pushl %fs |
pushl %gs |
|
# Push arguments on stack |
push %edi |
push %esi |
push %edx |
push %ecx |
push %eax |
# |
# Push syscall arguments onto the stack |
# |
# NOTE: The idea behind the order of arguments passed in registers is to |
# use all scratch registers first and preserved registers next. |
# An optimized libc syscall wrapper can make use of this setup. |
# |
pushl %eax |
pushl %ebp |
pushl %edi |
pushl %esi |
pushl %ebx |
pushl %ecx |
pushl %edx |
|
# we must fill the data segment registers |
movw $16,%ax |
169,15 → 174,15 |
movw %ax,%es |
|
sti |
|
call syscall_handler # syscall_handler(ax,cx,dx,si,di) |
# syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) |
call syscall_handler |
cli |
addl $20, %esp # clean-up of parameters |
addl $28, %esp # clean-up of parameters |
|
pop %gs |
pop %fs |
pop %es |
pop %ds |
popl %gs |
popl %fs |
popl %es |
popl %ds |
|
CLEAR_NT_FLAG |
iret |
206,22 → 211,22 |
subl $4, %esp |
.endif |
|
push %ds |
push %es |
push %fs |
push %gs |
pushl %ds |
pushl %es |
pushl %fs |
pushl %gs |
|
#ifdef CONFIG_DEBUG_ALLREGS |
push %ebx |
push %ebp |
push %edi |
push %esi |
pushl %ebx |
pushl %ebp |
pushl %edi |
pushl %esi |
#else |
sub $16, %esp |
subl $16, %esp |
#endif |
push %edx |
push %ecx |
push %eax |
pushl %edx |
pushl %ecx |
pushl %eax |
|
# we must fill the data segment registers |
movw $16,%ax |
235,22 → 240,22 |
|
CLEAR_NT_FLAG # Modifies %ecx |
|
pop %eax |
pop %ecx |
pop %edx |
popl %eax |
popl %ecx |
popl %edx |
#ifdef CONFIG_DEBUG_ALLREGS |
pop %esi |
pop %edi |
pop %ebp |
pop %ebx |
popl %esi |
popl %edi |
popl %ebp |
popl %ebx |
#else |
add $16, %esp |
addl $16, %esp |
#endif |
|
pop %gs |
pop %fs |
pop %es |
pop %ds |
popl %gs |
popl %fs |
popl %es |
popl %ds |
|
addl $4,%esp # Skip error word, no matter whether real or fake. |
iret |