Really? You are programming in C++ to deal with registers?
You can use inline asm for that in gcc, clang and nvcc at the very least
I am programming in C right now without any stdlibs and I need to call OS
Use inline assembly then
Should use API. You mean BIOS call ?
#define SYSCALL(id) ret; __asm__ volatile("syscall" : "=a"(ret) : "a"(id) : "memory"); return ret // Syscalls ssize_t write(int fd, const void *buf, size_t count) { ssize_t SYSCALL(1); } void *mmap(void *addr, size_t length, int prot, int flags, int fd, size_t offset) { void *SYSCALL(9); }
Обсуждают сегодня