- Replace int 0x80 with native x86-64 SYSCALL instruction for faster system calls - Add syscall number 16 for ioctl support with Linux-compatible ABI - Implement TIOCGWINSZ and TIOCNOTTY terminal ioctls for console size detection - Add ENOTTY error code definition for inappropriate ioctl operations - Increase ATA cache capacity from 128 to 16384 entries for better performance - Change ATA cache from LRU eviction to direct mapping using bitwise AND - Remove least recently used tracking from ATA cache entries -master
parent
235d07f7c3
commit
6340433fbe
21 changed files with 173 additions and 176 deletions
@ -1,33 +0,0 @@ |
|||||||
#!/usr/bin/env sh |
|
||||||
|
|
||||||
set -eu |
|
||||||
|
|
||||||
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) |
|
||||||
version=7.0.0 |
|
||||||
commit=7c2a178142625cc9852e59a1a090468c61a62d3b |
|
||||||
archive_sha256=56d62366a6a15bc3fd8741bebcb311ca543553f7b734b1e780aeae33691bd621 |
|
||||||
target="${project_dir}/thirdparty/mlibc" |
|
||||||
marker="${target}/.typephp-source-${version}" |
|
||||||
|
|
||||||
if [ -f "${marker}" ] && [ -f "${target}/meson.build" ]; then |
|
||||||
exit 0 |
|
||||||
fi |
|
||||||
|
|
||||||
temporary=$(mktemp -d "${TMPDIR:-/tmp}/typephp-os-mlibc.XXXXXX") |
|
||||||
trap 'rm -rf "${temporary}"' EXIT HUP INT TERM |
|
||||||
archive="${temporary}/mlibc.tar.gz" |
|
||||||
staging="${temporary}/installed" |
|
||||||
|
|
||||||
echo "Downloading mlibc v${version} (${commit})" |
|
||||||
curl -L --fail --retry 3 --silent --show-error -o "${archive}" \ |
|
||||||
"https://github.com/managarm/mlibc/archive/refs/tags/v${version}.tar.gz" |
|
||||||
printf '%s %s\n' "${archive_sha256}" "${archive}" | sha256sum -c - |
|
||||||
mkdir -p "${staging}" |
|
||||||
tar -xzf "${archive}" -C "${staging}" --strip-components=1 |
|
||||||
test -f "${staging}/LICENSE" |
|
||||||
|
|
||||||
mkdir -p "${project_dir}/thirdparty" |
|
||||||
rm -rf "${target}" |
|
||||||
mv "${staging}" "${target}" |
|
||||||
printf '%s\n' "${commit}" > "${marker}" |
|
||||||
echo "Installed mlibc v${version} in ${target}" |
|
||||||
@ -1,14 +0,0 @@ |
|||||||
[binaries] |
|
||||||
c = 'gcc' |
|
||||||
cpp = 'g++' |
|
||||||
ar = 'ar' |
|
||||||
strip = 'strip' |
|
||||||
|
|
||||||
[host_machine] |
|
||||||
system = 'demo' |
|
||||||
cpu_family = 'x86_64' |
|
||||||
cpu = 'x86_64' |
|
||||||
endian = 'little' |
|
||||||
|
|
||||||
[properties] |
|
||||||
needs_exe_wrapper = true |
|
||||||
@ -1,26 +0,0 @@ |
|||||||
#include <dirent.h> |
|
||||||
#include <fcntl.h> |
|
||||||
#include <stdint.h> |
|
||||||
#include <stdio.h> |
|
||||||
#include <stdlib.h> |
|
||||||
#include <string.h> |
|
||||||
#include <sys/mman.h> |
|
||||||
#include <sys/stat.h> |
|
||||||
#include <sys/utsname.h> |
|
||||||
#include <time.h> |
|
||||||
#include <unistd.h> |
|
||||||
|
|
||||||
_Static_assert(sizeof(uintptr_t) == 8, "TypePHP-OS requires a 64-bit mlibc ABI"); |
|
||||||
|
|
||||||
static void typecheck(void) |
|
||||||
{ |
|
||||||
struct dirent entry; |
|
||||||
struct stat status; |
|
||||||
struct timespec timestamp; |
|
||||||
struct utsname identity; |
|
||||||
|
|
||||||
(void) entry; |
|
||||||
(void) status; |
|
||||||
(void) timestamp; |
|
||||||
(void) identity; |
|
||||||
} |
|
||||||
@ -0,0 +1,18 @@ |
|||||||
|
#ifndef TYPEPHP_OS_USER_SYS_IOCTL_H |
||||||
|
#define TYPEPHP_OS_USER_SYS_IOCTL_H |
||||||
|
|
||||||
|
/* Linux-compatible terminal request values and winsize layout. */ |
||||||
|
struct winsize { |
||||||
|
unsigned short ws_row; |
||||||
|
unsigned short ws_col; |
||||||
|
unsigned short ws_xpixel; |
||||||
|
unsigned short ws_ypixel; |
||||||
|
}; |
||||||
|
|
||||||
|
#define TIOCGWINSZ 0x5413UL |
||||||
|
#define TIOCSWINSZ 0x5414UL |
||||||
|
#define TIOCNOTTY 0x5422UL |
||||||
|
|
||||||
|
int ioctl(int fd, unsigned long request, ...); |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
#include <stdarg.h> |
||||||
|
#include <sys/ioctl.h> |
||||||
|
#include <sys/syscall.h> |
||||||
|
|
||||||
|
int ioctl(int fd, unsigned long request, ...) |
||||||
|
{ |
||||||
|
void *argument = 0; |
||||||
|
|
||||||
|
/* TIOCNOTTY has no third argument. The currently supported window-size
|
||||||
|
* requests use a pointer, as required by the Linux userspace ABI. */ |
||||||
|
if (request != TIOCNOTTY) { |
||||||
|
va_list arguments; |
||||||
|
va_start(arguments, request); |
||||||
|
argument = va_arg(arguments, void *); |
||||||
|
va_end(arguments); |
||||||
|
} |
||||||
|
return (int) syscall(SYS_ioctl, fd, request, argument); |
||||||
|
} |
||||||
Loading…
Reference in new issue