.org 0
.code32
.global _start
-.align 4
+ .align 4
multiboot_hdr:
.long 0x1badb002 // Multi-boot magic
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
.global x86_int99_entry
x86_int99_entry:
- pushl %ecx
+ pushl %edx
pushl %eax
enterkernel %edx
exitkernel
popl %eax
- popl %ecx
- xorl %edx, %edx
+ xorl %ecx, %ecx
+ popl %edx
xorl %ebx, %ebx
xorl %ebp, %ebp
xorl %esi, %esi
xorl %edi, %edi
call sched_new_thread
- pop %eax
+ popl %eax
call *%eax
call exit_thread
ud2a
+
+ .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
+
+ movl $0x23, %ebx
+ movl %ebx, %ds
+ movl %ebx, %es
+
+ xorl %eax, %eax
+ xorl %ecx, %ecx
+ iret
- .section ".roshared","x"
+ .section ".roshared","ax"
+ .align 4096
// The vsyscall table must be the first thing in roshared
// (at vaddr 0x7fff0000).
int $0x99
ret
- .section ".rwshared",""
+ .global test_user_ptr
+ .align 4
+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
+ call *0x7fff0000
+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