Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new library loading modes #6312

Merged
merged 8 commits into from Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Utilities/GDBDebugServer.cpp
Expand Up @@ -567,7 +567,7 @@ bool GDBDebugServer::cmd_write_memory(gdb_cmd & cmd)
u32 len = hex_to_u32(cmd.data.substr(s + 1, s2 - s - 1));
const char* data_ptr = (cmd.data.c_str()) + s2 + 1;
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr + i, 1, vm::page_allocated | vm::page_writable)) {
if (vm::check_addr(addr + i, 1, vm::page_writable)) {
u8 val;
int res = sscanf_s(data_ptr, "%02hhX", &val);
if (!res) {
Expand Down
8 changes: 4 additions & 4 deletions Utilities/Thread.cpp
Expand Up @@ -1273,7 +1273,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
return true;
}

if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | (is_writing ? vm::page_writable : vm::page_readable)))
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
{
if (cpu && cpu->test_stopped())
{
Expand Down Expand Up @@ -1328,12 +1328,12 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
u64 data3;
{
vm::reader_lock rlock;
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | (is_writing ? vm::page_writable : vm::page_readable)))
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
{
// Memory was allocated inbetween, retry
return true;
}
else if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | vm::page_readable))
else if (vm::check_addr(addr, std::max<std::size_t>(1, d_size)))
{
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY; // TODO
}
Expand Down Expand Up @@ -2086,7 +2086,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
else
{
// zen(+)
// Ryzen 7, Threadripper
// Ryzen 7, Threadripper
// Assign threads 3-16
ppu_mask = 0b1111111100000000;
spu_mask = ppu_mask;
Expand Down
18 changes: 2 additions & 16 deletions Utilities/lockless.h
Expand Up @@ -388,27 +388,13 @@ class lf_queue : public lf_queue_base

// Apply func(data) to each element, return the total length
template <typename F>
std::size_t apply(F&& func)
std::size_t apply(F func)
{
std::size_t count = 0;

for (auto slice = pop_all(); slice; slice.pop_front())
{
std::invoke(std::forward<F>(func), *slice);
}

return count;
}

// apply() overload for callable template argument
template <auto F>
std::size_t apply()
{
std::size_t count = 0;

for (auto slice = pop_all(); slice; slice.pop_front())
{
std::invoke(F, *slice);
std::invoke(func, *slice);
}

return count;
Expand Down