Get GNU MPFR and MPC tests to pass

This change fixes more issues with our scanf() function.
This commit is contained in:
Justine Tunney 2023-08-21 12:16:52 -07:00
parent 63a1636e1f
commit 6ef2a471e4
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
37 changed files with 389 additions and 865 deletions

View file

@ -1,5 +1,6 @@
#ifndef _COSMO_H
#define _COSMO_H
#include "libc/stdbool.h"
#ifdef _COSMO_SOURCE
#define COSMO_ALREADY_DEFINED

60
libc/isystem/sys/procfs.h Normal file
View file

@ -0,0 +1,60 @@
#ifndef _SYS_PROCFS_H
#define _SYS_PROCFS_H
#include <sys/user.h>
#ifdef __cplusplus
extern "C" {
#endif
struct elf_siginfo {
int si_signo;
int si_code;
int si_errno;
};
struct elf_prstatus {
struct elf_siginfo pr_info;
short int pr_cursig;
unsigned long int pr_sigpend;
unsigned long int pr_sighold;
pid_t pr_pid;
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
struct {
long tv_sec, tv_usec;
} pr_utime, pr_stime, pr_cutime, pr_cstime;
elf_gregset_t pr_reg;
int pr_fpvalid;
};
#define ELF_PRARGSZ 80
struct elf_prpsinfo {
char pr_state;
char pr_sname;
char pr_zomb;
char pr_nice;
unsigned long int pr_flag;
#if UINTPTR_MAX == 0xffffffff
unsigned short int pr_uid;
unsigned short int pr_gid;
#else
unsigned int pr_uid;
unsigned int pr_gid;
#endif
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
char pr_fname[16];
char pr_psargs[ELF_PRARGSZ];
};
typedef void *psaddr_t;
typedef elf_gregset_t prgregset_t;
typedef elf_fpregset_t prfpregset_t;
typedef pid_t lwpid_t;
typedef struct elf_prstatus prstatus_t;
typedef struct elf_prpsinfo prpsinfo_t;
#ifdef __cplusplus
}
#endif
#endif

77
libc/isystem/sys/user.h Normal file
View file

@ -0,0 +1,77 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __x86_64__
#undef __WORDSIZE
#define __WORDSIZE 64
typedef struct user_fpregs_struct {
uint16_t cwd, swd, ftw, fop;
uint64_t rip, rdp;
uint32_t mxcsr, mxcr_mask;
uint32_t st_space[32], xmm_space[64], padding[24];
} elf_fpregset_t;
struct user_regs_struct {
unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
};
#define ELF_NGREG 27
typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
struct user {
struct user_regs_struct regs;
int u_fpvalid;
struct user_fpregs_struct i387;
unsigned long u_tsize;
unsigned long u_dsize;
unsigned long u_ssize;
unsigned long start_code;
unsigned long start_stack;
long signal;
int reserved;
struct user_regs_struct *u_ar0;
struct user_fpregs_struct *u_fpstate;
unsigned long magic;
char u_comm[32];
unsigned long u_debugreg[8];
};
#define PAGE_MASK (~(4096 - 1))
#define NBPG 4096
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
#elif defined(__aarch64__)
struct user_regs_struct {
unsigned long long regs[31];
unsigned long long sp;
unsigned long long pc;
unsigned long long pstate;
};
struct user_fpsimd_struct {
unsigned __int128 vregs[32];
unsigned int fpsr;
unsigned int fpcr;
};
#define ELF_NREG 34
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
typedef struct user_fpsimd_struct elf_fpregset_t;
#else
#error "unsupported architecture"
#endif
#ifdef __cplusplus
}
#endif
#endif