diff options
| author | Miguel <m.i@gmx.at> | 2018-08-22 00:52:30 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-08-22 00:52:30 +0200 |
| commit | 59038fc67c20a1f04e5d2fd5f9a444e707d1d3ea (patch) | |
| tree | 1b0161c1b6d5caefe900f419fed31cc7d7ad6017 /asm/task.s | |
| parent | 72c6e9763ca61bc9d7de5f7080ee1c8a1c7c1562 (diff) | |
userspace and kernelspace taskswitching
Diffstat (limited to 'asm/task.s')
| -rw-r--r-- | asm/task.s | 37 |
1 files changed, 31 insertions, 6 deletions
@@ -2,15 +2,21 @@ task_pusha: pushf - - push $0x8 + push $0x8 // code segment push $userfunc pusha + + push %ds + push %es + push %fs + push %gs + /* + now stack looks like: - param // esp+48 + param // esp+64 returnaddy eflags @@ -26,9 +32,14 @@ task_pusha: esi edi + ds + es + fs + gs + */ - mov 48(%esp),%eax // get address of alternative stack where we want to simulate the pusha + mov 64(%esp),%eax // get address of alternative stack where we want to simulate the pusha mov (%esp),%ecx mov %ecx,(%eax) @@ -66,10 +77,24 @@ task_pusha: mov 44(%esp),%ecx mov %ecx,44(%eax) + mov 48(%esp),%ecx + mov %ecx,48(%eax) + + mov 52(%esp),%ecx + mov %ecx,52(%eax) + + mov 56(%esp),%ecx + mov %ecx,56(%eax) + + pop %gs + pop %fs + pop %es + pop %ds + + popa + pop %eax pop %eax pop %eax - popa - ret |
