summaryrefslogtreecommitdiffstats
path: root/task/stack.c
blob: 396ab3ecd47bb1f05d0b998ddce48aed7d5083e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "tasking.h"
#include "string.h"
#include "assert.h"

void 
tcb_stack_push(tcb_t *tcb, void *data, size_t len)
{
    assert(tcb != NULL);
    void *spo = (void*)(tcb->ksp - len);
    assert(spo >= tcb->stack);

    memcpy(spo, data, len);
    tcb->ksp = (uintptr_t)spo;
}