some work on x11 ext

This commit is contained in:
veclavtlica
2026-10-13 04:30:06 +03:00
parent 964e623644
commit 5789cafd4e
13 changed files with 262 additions and 144 deletions
+1 -1
View File
@@ -71,6 +71,6 @@ bool com_std_connect(com_std_fd fd, bool isnetwork, char const *address) {
return NULL;
}
void com_std_exit(uint32_t status) { exit(status); }
void com_std_exit(int32_t status) { exit(status); }
void com_std_close(com_std_fd fd) { fclose(fd); }
+1 -1
View File
@@ -101,7 +101,7 @@ inline bool com_std_connect(com_std_fd fd, bool isnetwork,
return NULL;
}
inline void com_std_exit(uint32_t status) {
inline void com_std_exit(int32_t status) {
__asm__ volatile("syscall" : : "a"(60), "D"(status) : "rcx", "r11", "memory");
__builtin_unreachable();
}
+1 -1
View File
@@ -101,7 +101,7 @@ inline bool com_std_connect(com_std_fd fd, bool isnetwork,
return NULL;
}
inline void com_std_exit(uint32_t status) {
inline void com_std_exit(int32_t status) {
__asm__ volatile("int $0x80" : : "a"(1), "b"(status) : "memory", "cc");
__builtin_unreachable();
}
+2
View File
@@ -12,3 +12,5 @@ void *com_std_alloc(void *ptr, size_t size) { return NULL; }
double com_std_sqrt(double v) { return __builtin_sqrt(v); }
double com_std_fabs(double v) { return __builtin_fabs(v); }
double com_std_sin(double v) { return __builtin_sin(v); }
double com_std_cos(double v) { return __builtin_cos(v); }
+22 -17
View File
@@ -24,23 +24,28 @@ size_t strlen(char const *s) {
return p - s;
}
double com_std_sin(double v) {
double result;
__asm__ __volatile__("fldl %1\n\t"
"fsin\n\t"
"fstpl %0"
: "=g"(result)
: "m"(v)
: "st", "st(1)");
return result;
double sin(double v) {
double r;
__asm__ __volatile__("fsin" : "=t"(r) : "0"(v));
return r;
}
double com_std_cos(double v) {
double result;
__asm__ __volatile__("fldl %1\n\t"
"fcos\n\t"
"fstpl %0"
: "=g"(result)
: "m"(v));
return result;
double cos(double v) {
double r;
__asm__ __volatile__("fcos" : "=t"(r) : "0"(v));
return r;
}
void sincos(double v, double *s, double *c) {
double sv, cv;
__asm__ __volatile__("fsincos" : "=t"(cv), "=u"(sv) : "0"(v));
*s = sv;
*c = cv;
}
double sqrt(double v) {
double r;
__asm__ volatile("sqrtss %1, %0" : "=x"(r) : "x"(v));
return r;
}