X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=kernel%2Farch%2Fx86%2Fentry.S;h=8308fb7330cb32ce2530fbad7028392cab8b3b77;hp=098d6d71dfe584bb7b1a612d11304cbe2f049fdf;hb=139f54779f6395a1828261423cd8013ca940ff36;hpb=65882ba5c51e36bb639a41e0be5b1d4822a3995f diff --git a/kernel/arch/x86/entry.S b/kernel/arch/x86/entry.S index 098d6d7..8308fb7 100644 --- a/kernel/arch/x86/entry.S +++ b/kernel/arch/x86/entry.S @@ -14,12 +14,12 @@ #include -#define ROSHARED_PTR(x) (x - x86_syscall_ptr + 0x7fff0000) +#define ROSHARED_PTR(x) (x - roshared + 0x7fff0000) .org 0 .code32 .global _start -.align 4 + .align 4 multiboot_hdr: .long 0x1badb002 // Multi-boot magic @@ -104,8 +104,9 @@ using_our_gdt: movl $0x87, x86_init_ptbl_l2 + 0x800 - KERNEL_START ljmp $0x10, $paging_on - KERNEL_START + -paging_on: +paging_on: lgdt x86_gdtr + 6 movl %esi, x86_boot_info_phys @@ -301,7 +302,7 @@ x86_int98_entry: .global x86_int99_entry x86_int99_entry: - pushl %ecx + pushl %edx pushl %eax enterkernel %edx @@ -311,8 +312,8 @@ x86_int99_entry: exitkernel popl %eax - popl %ecx - xorl %edx, %edx + xorl %ecx, %ecx + popl %edx xorl %ebx, %ebx xorl %ebp, %ebp xorl %esi, %esi @@ -320,6 +321,38 @@ x86_int99_entry: movl $ROSHARED_PTR(x86_shared_int98_ret), (%esp) iret + .global x86_int9a_entry +x86_int9a_entry: + pushl %edx + pushl %eax + enterkernel %edx + + pushl %esp + call x86_new_object + addl $4, %esp + + exitkernel + popl %eax + xorl %ecx, %ecx + xorl %edx, %edx + iret + + .global x86_int9b_entry +x86_int9b_entry: + pushl %edx + pushl %eax + enterkernel %edx + + pushl %esp + call x86_get_iface_hash + addl $4, %esp + + exitkernel + popl %eax + xorl %ecx, %ecx + xorl %edx, %edx + iret + .global x86_irq x86_irq: pushvolatilesnoeax @@ -381,24 +414,31 @@ x86_new_thread: xorl %edi, %edi call sched_new_thread - pop %eax + popl %eax call *%eax call exit_thread ud2a - - .section ".roshared","x" - // The vsyscall table must be the first thing in roshared - // (at vaddr 0x7fff0000). + .global arch_new_user_thread +arch_new_user_thread: + movl 4(%esp), %eax // arg1: user entry + movl 8(%esp), %ecx // arg2: user stack + pushl $0x23 // SS + pushl %ecx // ESP + pushl $0x202 // EFLAGS + pushl $0x2b // CS + pushl %eax // EIP - .global x86_syscall_ptr -x86_syscall_ptr: - .long ROSHARED_PTR(x86_shared_int98) - - .global x86_sysret_ptr -x86_sysret_ptr: - .long ROSHARED_PTR(x86_shared_int99) + movl $0x23, %ebx + movl %ebx, %ds + movl %ebx, %es + + xorl %eax, %eax + xorl %ecx, %ecx + iret + .section ".roshared","ax" +roshared: x86_shared_int98: // FIXME: This must be unpreemptible by traps pushl %gs @@ -417,11 +457,44 @@ x86_shared_int98_ret: popl %gs ret + . = roshared + 0x80 x86_shared_int99: int $0x99 ret - .section ".rwshared","" + . = roshared + 0x100 +x86_shared_int9a: + int $0x9a + ret + + . = roshared + 0x180 +x86_shared_int9b: + int $0x9b + ret + + .global test_user_ptr +test_user_ptr: + .long ROSHARED_PTR(test_user) + +test_pib: + .long 0 + .long 0 + .long ROSHARED_PTR(test_objlist) + .long 1 + .long 0 + +test_objlist: + .long 0 + .space 128 + +test_user: + movl $ROSHARED_PTR(test_pib), %eax + movl $0x7fff0000, %ecx + call *%ecx +1: jmp 1b + + .section ".rwshared","a" + .align 4096 // Userspace must set this to an appropriate entry point // prior to registering objects with the kernel. It should