summaryrefslogtreecommitdiff
path: root/arch/i386/kernel/jump_userspace.s
blob: fe69880eb7bfa8df7e0089ba170a3ee7739b8efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.global jump_userspace
.type jump_userspace, @function
jump_userspace:
        movw $0x23, %ax
        movw %ax, %ds
        movw %ax, %es
        movw %ax, %fs
        movw %ax, %gs

        movl %esp, %eax
        pushl $0x23
        pushl %eax
        pushf
        push $0x1B
        pushl $start_init

        pushl %esp
        call set_kernel_esp
        addl $4, %esp

        movl $0x0004, %eax
        orl $0x0002, %eax
        pushl %eax
        call init_page_dir
        addl $4, %esp

        movl %eax, %cr3

        iret