aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/tasks/process.asm
blob: a46ac3d36e7bfcb79053665300049f836738d9b5 (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[GLOBAL read_eip]
read_eip:
    pop eax
    jmp eax

[GLOBAL copy_page_physical]
copy_page_physical:
    push ebx
    pushf

    cli

    mov ebx, [esp+12]
    mov ecx, [esp+16]

    mov edx, cr0
    and edx, 0x7fffffff
    mov cr0, edx

    mov edx, 1024

.loop:
    mov eax, [ebx]
    mov [ecx], eax
    add ebx, 4
    add ecx, 4
    dec edx
    jnz .loop

    mov edx, cr0
    or  edx, 0x80000000
    mov cr0, edx

    popf
    pop ebx
    ret

[GLOBAL perform_task_switch]
perform_task_switch:
     cli
     mov ecx, [esp+4]
     mov eax, [esp+8]
     mov ebp, [esp+12]
     mov esp, [esp+16]
     mov cr3, eax
     mov eax, 0x12345
     sti
     jmp ecx