More compat work towards porting vim.

It now builds and runs in the small-featureset configuration. :^)
This commit is contained in:
Andreas Kling 2019-02-27 00:02:01 +01:00
parent 424368034b
commit e421c10735
Notes: sideshowbarker 2024-07-19 15:37:03 +09:00
8 changed files with 44 additions and 5 deletions

View file

@ -190,6 +190,13 @@ void Terminal::escape$u(const Vector<unsigned>&)
set_cursor(m_saved_cursor_row, m_saved_cursor_column);
}
void Terminal::escape$t(const Vector<unsigned>& params)
{
if (params.size() < 1)
return;
dbgprintf("escape$t: Ps: %u\n", params[0]);
}
void Terminal::escape$H(const Vector<unsigned>& params)
{
unsigned row = 1;
@ -380,6 +387,7 @@ void Terminal::execute_escape_sequence(byte final)
case 'm': escape$m(params); break;
case 's': escape$s(params); break;
case 'u': escape$u(params); break;
case 't': escape$t(params); break;
default:
dbgprintf("Terminal::execute_escape_sequence: Unhandled final '%c'\n", final);
break;

View file

@ -53,6 +53,7 @@ private:
void escape$m(const Vector<unsigned>&);
void escape$s(const Vector<unsigned>&);
void escape$u(const Vector<unsigned>&);
void escape$t(const Vector<unsigned>&);
void clear();

View file

@ -393,7 +393,13 @@ Region* FileDescriptor::mmap(Process& process, LinearAddress laddr, size_t offse
ASSERT(m_inode);
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
auto region_name = absolute_path();
String region_name;
#if 0
// FIXME: I would like to do this, but it would instantiate all the damn inodes.
region_name = absolute_path();
#else
region_name = "Memory-mapped file";
#endif
InterruptDisabler disabler;
// FIXME: Implement mapping at a client-specified address. Most of the support is already in plcae.
ASSERT(laddr.as_ptr() == nullptr);

View file

@ -313,7 +313,12 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
ProcessPagingScope paging_scope(*this);
auto vmo = VMObject::create_file_backed(descriptor->inode());
#if 0
// FIXME: I would like to do this, but it would instantiate all the damn inodes.
vmo->set_name(descriptor->absolute_path());
#else
vmo->set_name("ELF image");
#endif
RetainPtr<Region> region = allocate_region_with_vmo(LinearAddress(), descriptor->metadata().size, vmo.copy_ref(), 0, "executable", true, false);
// FIXME: Should we consider doing on-demand paging here? Is it actually useful?
@ -1547,6 +1552,7 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
return reaped_pid;
} else {
ASSERT(waitee > 0); // FIXME: Implement other PID specs.
InterruptDisabler disabler;
auto* waitee_process = Process::from_pid(waitee);
if (!waitee_process)
return -ECHILD;
@ -1967,9 +1973,7 @@ int Process::sys$select(const Syscall::SC_select_params* params)
auto* timeout = params->timeout;
// FIXME: Implement exceptfds support.
//ASSERT(!exceptfds);
if (exceptfds)
kprintf("%s(%u): FIXME: select() with exceptfds\n", name().characters(), pid());
(void)exceptfds;
if (timeout) {
m_select_timeout = *timeout;
@ -2006,6 +2010,9 @@ int Process::sys$select(const Syscall::SC_select_params* params)
error = transfer_fds(readfds, m_select_read_fds);
if (error)
return error;
error = transfer_fds(readfds, m_select_exceptional_fds);
if (error)
return error;
#ifdef DEBUG_IO
dbgprintf("%s<%u> selecting on (read:%u, write:%u), wakeup_req:%u, timeout=%p\n", name().characters(), pid(), m_select_read_fds.size(), m_select_write_fds.size(), m_wakeup_requested, timeout);
@ -2047,6 +2054,8 @@ int Process::sys$select(const Syscall::SC_select_params* params)
}
}
// FIXME: Check for exceptional conditions.
return markedfds;
}

View file

@ -353,6 +353,7 @@ private:
int m_blocked_fd { -1 };
Vector<int> m_select_read_fds;
Vector<int> m_select_write_fds;
Vector<int> m_select_exceptional_fds;
timeval m_select_timeout;
bool m_select_has_timeout { false };
size_t m_max_open_file_descriptors { 16 };

View file

@ -231,5 +231,7 @@ void syscall_trap_entry(RegisterDump& regs)
dword arg2 = regs.ecx;
dword arg3 = regs.ebx;
regs.eax = Syscall::handle(regs, function, arg1, arg2, arg3);
if (function == Syscall::SC_mkdir)
dbgprintf("->%d\n", regs.eax);
}

View file

@ -50,12 +50,16 @@ typedef __INTMAX_TYPE__ intmax_t;
#define INT8_MIN (-128)
#define INT16_MIN (-32767-1)
#define INT32_MIN (-2147483647-1)
#define INT64_MIN (-9223372036854775807LL-1LL)
#define INT8_MAX (127)
#define INT16_MAX (32767)
#define INT32_MAX (2147483647)
#define INT64_MAX (9223372036854775807LL)
#define UINT8_MAX (255)
#define UINT16_MAX (65535)
#define UINT32_MAX (4294967295U)
#define UINT64_MAX (18446744073709551615ULL)
#define INT64_C(x) x##LL
#define UINT64_C(x) x##ULL

View file

@ -33,7 +33,7 @@ struct MallocFooter {
uint32_t xorcheck;
};
#define CHUNK_SIZE 16
#define CHUNK_SIZE 32
#define POOL_SIZE 4 * 1048576
static const size_t malloc_budget = POOL_SIZE;
@ -250,6 +250,14 @@ int putenv(char* new_var)
return 0;
}
double strtod(const char* str, char** endptr)
{
(void)str;
(void)endptr;
dbgprintf("LibC: strtod: '%s'\n", str);
assert(false);
}
double atof(const char* str)
{
dbgprintf("LibC: atof: '%s'\n", str);