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 whole words */ |
rep movsl /* copy as much as possible word by word */ |
|
movl MEMCPY_SIZE(%esp), %ecx |
andl $3, %ecx /* size % 4 */ |
106,8 → 106,7 |
paging_on: |
movl %cr0, %edx |
orl $(1 << 31), %edx # paging on |
# clear Cache Disable and not Write Though |
andl $~((1 << 30) | (1 << 29)), %edx |
andl $~((1<<30)|(1<<29)),%edx # clear Cache Disable and not Write Though |
movl %edx,%cr0 |
jmp 0f |
0: |
119,11 → 118,15 |
# 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 |
148,25 → 151,17 |
.macro handler i n |
|
.ifeq \i - 0x30 # Syscall handler |
pushl %ds |
pushl %es |
pushl %fs |
pushl %gs |
push %ds |
push %es |
push %fs |
push %gs |
|
# |
# 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 |
# Push arguments on stack |
push %edi |
push %esi |
push %edx |
push %ecx |
push %eax |
|
# we must fill the data segment registers |
movw $16, %ax |
174,15 → 169,15 |
movw %ax, %es |
|
sti |
# syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) |
call syscall_handler |
|
call syscall_handler # syscall_handler(ax,cx,dx,si,di) |
cli |
addl $28, %esp # clean-up of parameters |
addl $20, %esp # clean-up of parameters |
|
popl %gs |
popl %fs |
popl %es |
popl %ds |
pop %gs |
pop %fs |
pop %es |
pop %ds |
|
CLEAR_NT_FLAG |
iret |
211,22 → 206,22 |
subl $4, %esp |
.endif |
|
pushl %ds |
pushl %es |
pushl %fs |
pushl %gs |
push %ds |
push %es |
push %fs |
push %gs |
|
#ifdef CONFIG_DEBUG_ALLREGS |
pushl %ebx |
pushl %ebp |
pushl %edi |
pushl %esi |
push %ebx |
push %ebp |
push %edi |
push %esi |
#else |
subl $16, %esp |
sub $16, %esp |
#endif |
pushl %edx |
pushl %ecx |
pushl %eax |
push %edx |
push %ecx |
push %eax |
|
# we must fill the data segment registers |
movw $16, %ax |
240,22 → 235,22 |
|
CLEAR_NT_FLAG # Modifies %ecx |
|
popl %eax |
popl %ecx |
popl %edx |
pop %eax |
pop %ecx |
pop %edx |
#ifdef CONFIG_DEBUG_ALLREGS |
popl %esi |
popl %edi |
popl %ebp |
popl %ebx |
pop %esi |
pop %edi |
pop %ebp |
pop %ebx |
#else |
addl $16, %esp |
add $16, %esp |
#endif |
|
popl %gs |
popl %fs |
popl %es |
popl %ds |
pop %gs |
pop %fs |
pop %es |
pop %ds |
|
addl $4, %esp # Skip error word, no matter whether real or fake. |
iret |