2019-05-04 10:41:42 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-02-11 09:47:28 -06:00
|
|
|
void yield() {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $1, %eax; \
|
|
|
|
int $80; \
|
|
|
|
");
|
|
|
|
}
|
2019-02-11 09:48:50 -06:00
|
|
|
|
|
|
|
void createTask(void* task) {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $2, %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::"b"(task));
|
|
|
|
}
|
2019-05-03 09:33:26 -05:00
|
|
|
|
|
|
|
void* get_msg(uint32_t* sender) {
|
|
|
|
void* msg;
|
|
|
|
asm volatile(" \
|
|
|
|
mov $6, %%eax; \
|
|
|
|
int $80; \
|
|
|
|
":"=b"(msg):"b"(sender));
|
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2019-05-04 10:58:52 -05:00
|
|
|
void send_msg(uint32_t pid,void* msg,uint32_t size) {
|
2019-05-03 09:33:26 -05:00
|
|
|
asm volatile(" \
|
|
|
|
mov $7, %%eax; \
|
|
|
|
int $80; \
|
2019-05-04 10:58:52 -05:00
|
|
|
"::"b"(pid),"c"(msg),"d"(size));
|
2019-05-03 09:33:26 -05:00
|
|
|
}
|
2019-05-05 13:30:01 -05:00
|
|
|
|
|
|
|
void createTaskCr3(void* task,void* cr3) {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $9, %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::"b"(task),"c"(cr3));
|
|
|
|
}
|