Age | Commit message (Collapse) | Author |
|
As @tzoz pointed out, SALC should set AL to 0xff when CF=1, not 0x01.
Fixes #2819.
|
|
I don't know why I went with the compact format here.
|
|
This allows us to quickly skip some auditing checks while we're inside
malloc/free themselves.
|
|
|
|
|
|
When we're making direct syscalls, there's no "errno" involved.
Thanks to Sergey for spotting these.
|
|
We can easily catch free() on never-malloced addresses, as well as
double calls to free() on the same address, so let's do it!
|
|
This patch introduces a "MallocTracer" to the UserspaceEmulator.
If this object is present on the Emulator, it can be notified whenever
the emulated program does a malloc() or free().
The notifications come in via a magic instruction sequence that we
embed in the LibC malloc() and free() functions. The sequence is:
"salc x2, push reg32 x2, pop reg32 x3"
The data about the malloc/free operation is in the three pushes.
We make sure the sequence is harmless when running natively.
Memory accesses on MmapRegion are then audited to see if they fall
inside a known-to-be-freed malloc chunk. If so, we complain loud
and red in the debugger output. :^)
This is very, very cool! :^)
It's also a whole lot slower than before, since now we're auditing
memory accesses against a new set of metadata. This will need to be
optimized (and running in this mode should be opt-in, perhaps even
a separate program, etc.)
|
|
Here's set_process_icon(), gettimeofday() and clock_gettime().
|
|
We don't support all the addressing modes yet, but it won't be very
hard to add the rest of them when needed.
|
|
We track these separately from regular mmap() regions, as they have
slightly different behaviors.
|
|
|
|
|
|
|
|
Here goes mkdir(), unlink(), socket(), getsockopt(), fchmod()
bind(), connect(), listen(), select() and recvfrom().
They're not perfect but they seem to work. :^)
|
|
|
|
|
|
The a32 bit tells us whether a memory address is 32-bit or not.
We already have this information in Instruction, so just plumb that
around instead of double-caching the bit.
|
|
|
|
Adds a new, more restrictive read-only state to TextEditor which
forbids copying, selecting, editor cursors, and context menus.
Provides a unique appearance on focus which accomodates ComboBox
widgets. All TextEditor modes are now accessed by enum and
set_mode() which sets the editor to Editable, ReadOnly or
DisplayOnly. Updates applications still using set_readonly().
|
|
Use some template hacks to force GCC to inline more of the instruction
decoding stuff into the UserspaceEmulator main execution loop.
This is my last optimization for today, and we've gone from ~60 seconds
when running "UserspaceEmulator UserspaceEmulator id" to ~8 seconds :^)
|
|
|
|
They don't actually get inlined yet, but at least this devirtualizes
them which is nice.
|
|
Since this code is performance-sensitive, let's have the compiler do
whatever it can to help us with the most important files.
This yields a ~8% speedup.
|
|
To avoid MMU region lookup on every single instruction fetch, we now
cache a raw pointer to the current instruction. This gets automatically
invalidated when we jump somewhere, but as long as we're executing
sequentially, instruction fetches will hit the cache and bypass all
the region lookup stuff.
This is about a ~2x speedup. :^)
|
|
I'm not sure the mask I'm using here is completely correct, but it's
not terribly important since we're a userspace-only emulator anyway.
|
|
|
|
|
|
|
|
We were forgetting to set the host CPU's carry flag before executing
the SBB instruction. This made the result a bit unpredictable. :^)
|
|
We don't need to move the result of shifts around like this, we can
just use inline assembly outputs to make it end up in the right place.
|
|
|
|
We can now unmap mapped memory, among other things. This is all very
ad-hoc as I'm trying to run UserspaceEmulator inside itself. :^)
|
|
MmapRegion now supports using an mmap'ed file descriptor as backing.
|
|
|
|
Here's the first time we get a taste of better information than the
real hardware can give us: unlike x86 CPUs, we can actually support
write-only memory, so now we do!
While this isn't immediately useful, it's still pretty cool. :^)
|
|
Ultimately we'll want to support passing some options to the emulator
as well, but for now just pass all arguments (except argv[0] of course)
through to the emulated process.
This is still not perfect, but slightly better than what we had before.
|
|
|
|
For now, we just pretend that the process name is "EMULATED". We can
probably do better though. :^)
|
|
We want the emulated program to appear without noise in the terminal.
|
|
|
|
|
|
Moving forward on getting /bin/id to run inside the emulator. :^)
|
|
With tracing turned on, it's just too slow when doing big operations
like initializing malloc freelists.
|
|
The emulated program can now find its own name in argv[0]. Very cool!
|
|
This gives you a nice, symbolicated backtrace at the current EIP. :^)
|
|
This patch adds gettid() and stubs out pledge() and unveil() for now.
|
|
|
|
We'll soon want to copy data in and out of the SoftMMU memory space.
|
|
|