Chapter 14: 80x86 Port
Register Model and Addressing
OS_CPU.H
OS_CPU.H
OS_CPU_C.C OSTaskStkInit OSTaskStkInit_FPE_x86 Hook functions Borland floating point emulator Hook functions OSTaskCreateHook() OSTaskDelHook() OSTaskSwHook() OSTaskIdleHook() OSTaskStatHook() OSTimeTickHook() OSInitHookBegin()
OS_CPU_C.C
OS_CPU.C – OSStkInit()
OS_CPU.C – OSStkInit() @OSTaskDel 0xFFFF
OS_CPU.C – OSStkInit() void OSTaskDelSelf() { OSTaskDel(OS_PRIO_SELF); }
OS_CPU_A.ASM OSStartHighRdy OSCtxSw OSIntCtxSw OSTickISR
OSStartHighRdy()
LDS, LES, LFS, LGS, and LSS … AX 89 BX (6F2A) 30 … 6F 2A DS:_OSTCBHighRdy … … … CS DS(1000) ES(8930) … 10000
OSCtxSw() The system call which change certain tasks state needs to activate the scheduler and throw an software interrupt. (the macro OS_TASK_SW) The software trap vectors to the OSCtxSw.
OSCtxSw()
OSCtxSw()
OSIntCtxSw() OSIntCtxSw is called by OSIntExit to perform a context switch from an ISR. All registers have been saved onto the interrupted task’s stack Stack pointer is also saved into the beginning of the ISR has already done that.
OSIntCtxSw()
OSTickISR() – the Setup Procedure void main(): Call OSInit PC_DOSSaveReturn PC_VecSet //install switch vector at vector 0x80 Create at least one application Call OSStart The first task: Install OSTickISR (Change the tick rate)
Pseudocode
OSTickISR()
OSTickISR()
Using OSTaskStkInit_FPE_x86()
ptos ptos Size-384 size pbos pbos SS:0000 before after