os/libc/mailboxes.c

26 lines
512 B
C
Raw Normal View History

#include <stdint.h>
#include <mailboxes.h>
2019-09-01 13:52:32 -05:00
uint32_t mailbox_new(uint16_t size,char* name) {
uint32_t box;
asm volatile(" \
mov $14, %%eax; \
int $80; \
2019-09-01 13:52:32 -05:00
":"=b"(box):"b"(size),"c"(name));
return box;
}
void mailbox_send_msg(Message* msg) {
asm volatile(" \
mov $7, %%eax; \
int $80; \
"::"b"(msg));
}
void mailbox_get_msg(uint32_t box, Message* recv_msg, uint32_t buffer_sz) {
asm volatile(" \
mov $6, %%eax; \
int $80; \
"::"b"(box),"c"(recv_msg),"d"(buffer_sz));
}