bindings/native/gaspardos_x64_syscall.c¶
Native syscall ABI and transport used by the C++ bindings. Preserve the bindings/native/ layout alongside bindings/cpp/.
Source files · Download gaspardos_x64_syscall.c
#include "gaspardos_x64_syscall.h"
/* 0: Compteur de ticks du timer. */
int64_t GO64_ticks(void)
{
return GO64_syscall6(0, 0, 0, 0, 0, 0, 0);
}
/* 1: Ecrit sur la console serie, au maximum 4096 octets. */
int64_t GO64_console_write(const void* buffer, uint64_t size)
{
return GO64_syscall6(1, (uint64_t) (buffer), (uint64_t) (size), 0, 0, 0, 0);
}
/* 2: Cede le processeur et revient au prochain tour du scheduler. */
int64_t GO64_yield(void)
{
return GO64_syscall6(2, 0, 0, 0, 0, 0, 0);
}
/* 3: Termine le processus courant et libere ses ressources. Ne revient pas. */
GO64_NORETURN void GO64_exit(void)
{
GO64_syscall6(3, 0, 0, 0, 0, 0, 0);
__builtin_unreachable();
}
/* 4: Adresse privee alignee sur 4096 ou erreur negative. Au maximum 16 Mio par allocation. */
int64_t GO64_alloc(uint64_t size)
{
return GO64_syscall6(4, (uint64_t) (size), 0, 0, 0, 0, 0);
}
/* 5: Libere exactement une adresse de base retournee par alloc. */
int64_t GO64_free(void* pointer)
{
return GO64_syscall6(5, (uint64_t) (pointer), 0, 0, 0, 0, 0);
}
/* 100: Ouvre un fichier/dossier, retourne un descripteur >= 3. */
int64_t GO64_fs_open(const wchar_t* path, uint64_t flags)
{
return GO64_syscall6(100, (uint64_t) (path), (uint64_t) (flags), 0, 0, 0, 0);
}
/* 101: Ferme un fichier ou une socket. */
int64_t GO64_fs_close(int64_t fd)
{
return GO64_syscall6(101, (uint64_t) (fd), 0, 0, 0, 0, 0);
}
/* 102: Retourne le nombre lu, 0 a EOF ; accepte aussi une socket. */
int64_t GO64_fs_read(int64_t fd, void* buffer, uint64_t size)
{
return GO64_syscall6(102, (uint64_t) (fd), (uint64_t) (buffer), (uint64_t) (size), 0, 0, 0);
}
/* 103: Retourne le nombre ecrit ; accepte aussi une socket. */
int64_t GO64_fs_write(int64_t fd, const void* buffer, uint64_t size)
{
return GO64_syscall6(103, (uint64_t) (fd), (uint64_t) (buffer), (uint64_t) (size), 0, 0, 0);
}
/* 104: Offset signe 32 bits ; origines 0 debut, 1 courant, 2 fin ; retourne la position. */
int64_t GO64_fs_seek(int64_t fd, int64_t offset, uint64_t origin)
{
return GO64_syscall6(104, (uint64_t) (fd), (uint64_t) (offset), (uint64_t) (origin), 0, 0, 0);
}
/* 105: Remplit les informations du chemin. */
int64_t GO64_fs_stat(const wchar_t* path, GO64_FSInfo* info)
{
return GO64_syscall6(105, (uint64_t) (path), (uint64_t) (info), 0, 0, 0, 0);
}
/* 106: Remplit les informations du descripteur. */
int64_t GO64_fs_fstat(int64_t fd, GO64_FSInfo* info)
{
return GO64_syscall6(106, (uint64_t) (fd), (uint64_t) (info), 0, 0, 0, 0);
}
/* 107: Cree un dossier. */
int64_t GO64_fs_mkdir(const wchar_t* path)
{
return GO64_syscall6(107, (uint64_t) (path), 0, 0, 0, 0, 0);
}
/* 108: Supprime un fichier non ouvert. */
int64_t GO64_fs_unlink(const wchar_t* path)
{
return GO64_syscall6(108, (uint64_t) (path), 0, 0, 0, 0, 0);
}
/* 109: Supprime un dossier vide non ouvert. */
int64_t GO64_fs_rmdir(const wchar_t* path)
{
return GO64_syscall6(109, (uint64_t) (path), 0, 0, 0, 0, 0);
}
/* 110: Redimensionne le fichier ouvert en ecriture ; taille <= INT32_MAX. */
int64_t GO64_fs_truncate(int64_t fd, uint64_t size)
{
return GO64_syscall6(110, (uint64_t) (fd), (uint64_t) (size), 0, 0, 0, 0);
}
/* 111: Retourne 1 pour une entree, 0 en fin ; seek(fd,0,0) recommence. */
int64_t GO64_fs_readdir(int64_t fd, GO64_FSInfo* info)
{
return GO64_syscall6(111, (uint64_t) (fd), (uint64_t) (info), 0, 0, 0, 0);
}
/* 112: Renomme dans le meme dossier et volume ; -18 si parents/volumes differents. */
int64_t GO64_fs_rename(const wchar_t* oldpath, const wchar_t* newpath)
{
return GO64_syscall6(112, (uint64_t) (oldpath), (uint64_t) (newpath), 0, 0, 0, 0);
}
/* 113: Commandes 0 lire fd_flags, 1 fixer fd_flags&1, 2 lire flags, 3 fixer APPEND. */
int64_t GO64_fs_fcntl(int64_t fd, uint64_t command, uint64_t flags)
{
return GO64_syscall6(113, (uint64_t) (fd), (uint64_t) (command), (uint64_t) (flags), 0, 0, 0);
}
/* 120: Cree une socket IPv4 TCP/UDP ; retourne un descripteur >= 0x10000. */
int64_t GO64_socket(uint64_t family, uint64_t type, uint64_t protocol)
{
return GO64_syscall6(
120, (uint64_t) (family), (uint64_t) (type), (uint64_t) (protocol), 0, 0, 0);
}
/* 121: Associe une adresse locale ; adresse_size >= 8. */
int64_t GO64_bind(int64_t fd, const GO64_SocketAddress* address, uint64_t address_size)
{
return GO64_syscall6(
121, (uint64_t) (fd), (uint64_t) (address), (uint64_t) (address_size), 0, 0, 0);
}
/* 122: Met une socket TCP en ecoute. */
int64_t GO64_listen(int64_t fd, int64_t backlog)
{
return GO64_syscall6(122, (uint64_t) (fd), (uint64_t) (backlog), 0, 0, 0, 0);
}
/* 123: Retourne un nouveau descripteur ; adresse optionnelle, sinon initialiser *address_size=8. */
int64_t GO64_accept(int64_t fd, GO64_SocketAddress* address, uint32_t* address_size)
{
return GO64_syscall6(
123, (uint64_t) (fd), (uint64_t) (address), (uint64_t) (address_size), 0, 0, 0);
}
/* 124: Demarre la connexion ; -11 si elle est encore en cours. */
int64_t GO64_connect(int64_t fd, const GO64_SocketAddress* address, uint64_t address_size)
{
return GO64_syscall6(
124, (uint64_t) (fd), (uint64_t) (address), (uint64_t) (address_size), 0, 0, 0);
}
/* 125: Envoie des octets ; flags=0 ; envoi partiel possible. */
int64_t GO64_send(int64_t fd, const void* buffer, uint64_t size, uint64_t flags)
{
return GO64_syscall6(
125, (uint64_t) (fd), (uint64_t) (buffer), (uint64_t) (size), (uint64_t) (flags), 0, 0);
}
/* 126: Recoit des octets ; flags=0 ; 0 signifie EOF TCP. */
int64_t GO64_recv(int64_t fd, void* buffer, uint64_t size, uint64_t flags)
{
return GO64_syscall6(
126, (uint64_t) (fd), (uint64_t) (buffer), (uint64_t) (size), (uint64_t) (flags), 0, 0);
}
/* 127: Envoi vers une adresse ; NULL utilise le pair connecte. Flags=0. */
int64_t GO64_sendto(int64_t fd,
const void* buffer,
uint64_t size,
uint64_t flags,
const GO64_SocketAddress* address,
uint64_t address_size)
{
return GO64_syscall6(127,
(uint64_t) (fd),
(uint64_t) (buffer),
(uint64_t) (size),
(uint64_t) (flags),
(uint64_t) (address),
(uint64_t) (address_size));
}
/* 128: Reception et adresse source optionnelle ; flags=0 ; initialiser *address_size=8. */
int64_t GO64_recvfrom(int64_t fd,
void* buffer,
uint64_t size,
uint64_t flags,
GO64_SocketAddress* address,
uint32_t* address_size)
{
return GO64_syscall6(128,
(uint64_t) (fd),
(uint64_t) (buffer),
(uint64_t) (size),
(uint64_t) (flags),
(uint64_t) (address),
(uint64_t) (address_size));
}
/* 129: Adresse locale ; initialiser *address_size=8. */
int64_t GO64_getsockname(int64_t fd, GO64_SocketAddress* address, uint32_t* address_size)
{
return GO64_syscall6(
129, (uint64_t) (fd), (uint64_t) (address), (uint64_t) (address_size), 0, 0, 0);
}
/* 130: Adresse distante ; initialiser *address_size=8. */
int64_t GO64_getpeername(int64_t fd, GO64_SocketAddress* address, uint32_t* address_size)
{
return GO64_syscall6(
130, (uint64_t) (fd), (uint64_t) (address), (uint64_t) (address_size), 0, 0, 0);
}
/* 131: Ferme la socket ; -11 signifie reessayer apres yield. */
int64_t GO64_socket_close(int64_t fd)
{
return GO64_syscall6(131, (uint64_t) (fd), 0, 0, 0, 0, 0);
}
/* 132: Copie au plus 191 octets dans le journal RAM ; 0 succes, -11 file pleine, -12 aucun worker.
*/
int64_t GO64_log(const char* text)
{
return GO64_syscall6(132, (uint64_t) (text), 0, 0, 0, 0, 0);
}
/* 140: Retourne un handle positif reserve ; attendre READY=100 ou ERROR=101. */
int64_t GO64_window_create(const GO64_WindowOptions* options)
{
return GO64_syscall6(140, (uint64_t) (options), 0, 0, 0, 0, 0);
}
/* 141: Met la destruction en file UI. */
int64_t GO64_window_destroy(uint64_t window)
{
return GO64_syscall6(141, (uint64_t) (window), 0, 0, 0, 0, 0);
}
/* 142: Met un rectangle rempli en file UI. */
int64_t GO64_window_fill(uint64_t window, const GO64_Drawing* drawing)
{
return GO64_syscall6(142, (uint64_t) (window), (uint64_t) (drawing), 0, 0, 0, 0);
}
/* 143: Met un texte en file UI. */
int64_t GO64_window_text(uint64_t window, const GO64_Drawing* drawing)
{
return GO64_syscall6(143, (uint64_t) (window), (uint64_t) (drawing), 0, 0, 0, 0);
}
/* 144: Mode 0 attend avec yield, mode 1 teste sans attendre ; -11 si vide. */
int64_t GO64_window_event(uint64_t window, GO64_Event* event, uint64_t mode)
{
return GO64_syscall6(144, (uint64_t) (window), (uint64_t) (event), (uint64_t) (mode), 0, 0, 0);
}
/* 145: Met une demande de focus en file UI. */
int64_t GO64_window_focus(uint64_t window)
{
return GO64_syscall6(145, (uint64_t) (window), 0, 0, 0, 0, 0);
}
/* 146: Copy an RGBX8888 tile into the bounded kernel UI queue. */
int64_t GO64_window_blit(uint64_t window, const GO64_Blit* tile)
{
return GO64_syscall6(146, window, (uint64_t) tile, 0, 0, 0, 0);
}
/* 150: Copy an ELF image and argv, launch it, redirect stdout to this owner. */
int64_t GO64_process_spawn(const void* image, uint64_t size, uint64_t argc, const char* const* argv)
{
return GO64_syscall6(150, (uint64_t) image, size, argc, (uint64_t) argv, 0, 0);
}
/* 151: Drain at most 4096 bytes of this terminal's child output. Zero = empty. */
int64_t GO64_process_read(void* buffer, uint64_t size)
{
return GO64_syscall6(151, (uint64_t) buffer, size, 0, 0, 0, 0);
}
/* 152: Count this terminal's children that have not yet been reaped. */
int64_t GO64_process_status(void)
{
return GO64_syscall6(152, 0, 0, 0, 0, 0, 0);
}
/* UTF-8 cwd, owned by the process and inherited by children. */
int64_t GO64_process_getcwd(char* buffer, uint64_t size)
{
return GO64_syscall6(153, (uint64_t)buffer, size, 0, 0, 0, 0);
}
int64_t GO64_process_chdir(const char* path)
{
return GO64_syscall6(154, (uint64_t)path, 0, 0, 0, 0, 0);
}