BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / master / task / switch.S

// Related

Nucleus

Barry Kernel threads + threads share address space 6217f0d (3 years, 1 month ago)
/*
 * This file contains the context switch routine.  This routine will switch the
 * current context, but will not save any state, so it should only be called by
 * the scheduler.  Since the stack and page directory will get switched, care
 * must be taken to read and set the registers in the correct order.
 */

.section .text
.global context_switch
.type copy_page_frame, @function
.align 4
context_switch:
.code32
	cli
	mov 4(%esp), %ecx
	mov 8(%esp), %ebx
	mov 12(%esp), %esi
	mov 16(%esp), %edi
	mov 20(%esp), %ebp
	mov 24(%esp), %esp
	sti
	jmp *%ecx