pjht
51bb986d76
Instead of using PIDs to identify a destination, a process can have one or more mailboxes to send messages to.
26 lines
491 B
C
26 lines
491 B
C
#include <stdint.h>
|
|
#include <mailboxes.h>
|
|
|
|
uint32_t mailbox_new(uint16_t size) {
|
|
uint32_t box;
|
|
asm volatile(" \
|
|
mov $14, %%eax; \
|
|
int $80; \
|
|
":"=b"(box):"b"(size));
|
|
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));
|
|
}
|