mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-29 15:58:47 +00:00
More compat work.
Move syscall to int 0x82 since using int 0x80 was kinda prone to fork bombs when building things on Linux. :^)
This commit is contained in:
parent
f6b41d166d
commit
cccc8d8aeb
Notes:
sideshowbarker
2024-07-19 15:37:24 +09:00
Author: https://github.com/awesomekling
Commit: cccc8d8aeb
17 changed files with 81 additions and 9 deletions
|
@ -886,8 +886,8 @@ ShouldUnblockProcess Process::dispatch_signal(byte signal)
|
||||||
*code_ptr++ = 0xb8; // mov eax, <dword>
|
*code_ptr++ = 0xb8; // mov eax, <dword>
|
||||||
*(dword*)code_ptr = Syscall::SC_sigreturn;
|
*(dword*)code_ptr = Syscall::SC_sigreturn;
|
||||||
code_ptr += sizeof(dword);
|
code_ptr += sizeof(dword);
|
||||||
*code_ptr++ = 0xcd; // int 0x80
|
*code_ptr++ = 0xcd; // int 0x82
|
||||||
*code_ptr++ = 0x80;
|
*code_ptr++ = 0x82;
|
||||||
*code_ptr++ = 0x0f; // ud2
|
*code_ptr++ = 0x0f; // ud2
|
||||||
*code_ptr++ = 0x0b;
|
*code_ptr++ = 0x0b;
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace Syscall {
|
||||||
|
|
||||||
void initialize()
|
void initialize()
|
||||||
{
|
{
|
||||||
register_user_callable_interrupt_handler(0x80, syscall_trap_handler);
|
register_user_callable_interrupt_handler(0x82, syscall_trap_handler);
|
||||||
kprintf("Syscall: int 0x80 handler installed\n");
|
kprintf("Syscall: int 0x82 handler installed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int sync()
|
int sync()
|
||||||
|
|
|
@ -131,7 +131,7 @@ int sync();
|
||||||
inline dword invoke(Function function)
|
inline dword invoke(Function function)
|
||||||
{
|
{
|
||||||
dword result;
|
dword result;
|
||||||
asm volatile("int $0x80":"=a"(result):"a"(function):"memory");
|
asm volatile("int $0x82":"=a"(result):"a"(function):"memory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ template<typename T1>
|
||||||
inline dword invoke(Function function, T1 arg1)
|
inline dword invoke(Function function, T1 arg1)
|
||||||
{
|
{
|
||||||
dword result;
|
dword result;
|
||||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"((dword)arg1):"memory");
|
asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1):"memory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ template<typename T1, typename T2>
|
||||||
inline dword invoke(Function function, T1 arg1, T2 arg2)
|
inline dword invoke(Function function, T1 arg1, T2 arg2)
|
||||||
{
|
{
|
||||||
dword result;
|
dword result;
|
||||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2):"memory");
|
asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2):"memory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ template<typename T1, typename T2, typename T3>
|
||||||
inline dword invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
|
inline dword invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
|
||||||
{
|
{
|
||||||
dword result;
|
dword result;
|
||||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2),"b"((dword)arg3):"memory");
|
asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2),"b"((dword)arg3):"memory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,4 +10,9 @@ char* setlocale(int category, const char* locale)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct lconv* localeconv()
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,11 @@ enum {
|
||||||
LC_NUMERIC,
|
LC_NUMERIC,
|
||||||
LC_CTYPE,
|
LC_CTYPE,
|
||||||
LC_COLLATE,
|
LC_COLLATE,
|
||||||
|
LC_TIME,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lconv {
|
struct lconv {
|
||||||
|
char *decimal_point;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lconv* localeconv();
|
struct lconv* localeconv();
|
||||||
|
|
|
@ -384,5 +384,22 @@ int rename(const char* oldpath, const char* newpath)
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* tmpnam(char*)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE* popen(const char* command, const char* type)
|
||||||
|
{
|
||||||
|
(void)command;
|
||||||
|
(void)type;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pclose(FILE*)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,9 @@ void setbuf(FILE*, char* buf);
|
||||||
void setlinebuf(FILE*);
|
void setlinebuf(FILE*);
|
||||||
int rename(const char* oldpath, const char* newpath);
|
int rename(const char* oldpath, const char* newpath);
|
||||||
FILE* tmpfile();
|
FILE* tmpfile();
|
||||||
|
char* tmpnam(char*);
|
||||||
|
FILE* popen(const char* command, const char* type);
|
||||||
|
int pclose(FILE*);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,11 @@ char* getenv(const char* name)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int putenv(char*)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
double atof(const char*)
|
double atof(const char*)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
|
@ -14,6 +14,7 @@ __attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nm
|
||||||
void free(void*);
|
void free(void*);
|
||||||
void* realloc(void *ptr, size_t);
|
void* realloc(void *ptr, size_t);
|
||||||
char* getenv(const char* name);
|
char* getenv(const char* name);
|
||||||
|
int putenv(char*);
|
||||||
int atoi(const char*);
|
int atoi(const char*);
|
||||||
long atol(const char*);
|
long atol(const char*);
|
||||||
double strtod(const char*, char** endptr);
|
double strtod(const char*, char** endptr);
|
||||||
|
|
|
@ -293,5 +293,12 @@ char* strpbrk(const char* s, const char* accept)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *strtok(char* str, const char* delim)
|
||||||
|
{
|
||||||
|
(void)str;
|
||||||
|
(void)delim;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,12 @@ __BEGIN_DECLS
|
||||||
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
|
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
|
||||||
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
|
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
|
||||||
|
|
||||||
struct fd_set {
|
struct __fd_set {
|
||||||
unsigned char bits[FD_SETSIZE / 8];
|
unsigned char bits[FD_SETSIZE / 8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct __fd_set fd_set;
|
||||||
|
|
||||||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
|
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
|
@ -55,6 +55,11 @@ struct stat {
|
||||||
time_t st_ctime; /* time of last status change */
|
time_t st_ctime; /* time of last status change */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct utimbuf {
|
||||||
|
time_t actime;
|
||||||
|
time_t modtime;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define NULL nullptr
|
#define NULL nullptr
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define WNOHANG 1
|
||||||
pid_t wait(int* wstatus);
|
pid_t wait(int* wstatus);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
|
@ -32,5 +32,17 @@ int tcflow(int fd, int action)
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tcflush(int fd, int queue_selector)
|
||||||
|
{
|
||||||
|
(void)fd;
|
||||||
|
(void)queue_selector;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
speed_t cfgetospeed(const struct termios*)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ __BEGIN_DECLS
|
||||||
|
|
||||||
typedef uint32_t tcflag_t;
|
typedef uint32_t tcflag_t;
|
||||||
typedef uint8_t cc_t;
|
typedef uint8_t cc_t;
|
||||||
|
typedef uint32_t speed_t;
|
||||||
|
|
||||||
struct termios {
|
struct termios {
|
||||||
tcflag_t c_iflag;
|
tcflag_t c_iflag;
|
||||||
|
@ -21,6 +22,7 @@ struct termios {
|
||||||
int tcgetattr(int fd, struct termios*);
|
int tcgetattr(int fd, struct termios*);
|
||||||
int tcsetattr(int fd, int optional_actions, const struct termios*);
|
int tcsetattr(int fd, int optional_actions, const struct termios*);
|
||||||
int tcflow(int fd, int action);
|
int tcflow(int fd, int action);
|
||||||
|
int tcflush(int fd, int queue_selector);
|
||||||
|
|
||||||
/* c_cc characters */
|
/* c_cc characters */
|
||||||
#define VINTR 0
|
#define VINTR 0
|
||||||
|
|
|
@ -379,4 +379,9 @@ int release_shared_buffer(int shared_buffer_id)
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* getlogin()
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,14 @@
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define HZ 1000
|
#define HZ 1000
|
||||||
|
#define STDIN_FILENO 0
|
||||||
|
#define STDOUT_FILENO 1
|
||||||
|
#define STDERR_FILENO 2
|
||||||
|
|
||||||
extern char** environ;
|
extern char** environ;
|
||||||
|
|
||||||
|
@ -68,6 +72,7 @@ int isatty(int fd);
|
||||||
int mknod(const char* pathname, mode_t, dev_t);
|
int mknod(const char* pathname, mode_t, dev_t);
|
||||||
long fpathconf(int fd, int name);
|
long fpathconf(int fd, int name);
|
||||||
long pathconf(const char *path, int name);
|
long pathconf(const char *path, int name);
|
||||||
|
char* getlogin();
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
_PC_NAME_MAX,
|
_PC_NAME_MAX,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue