mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Get deathstar demo working again on metal
This commit is contained in:
parent
15ea0524b3
commit
bd6d9ff99a
6 changed files with 21 additions and 17 deletions
|
@ -45,7 +45,7 @@
|
|||
#ifdef __x86_64__
|
||||
|
||||
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
|
||||
#define NOPAGE ((uint64_t) - 1)
|
||||
#define NOPAGE ((uint64_t)-1)
|
||||
|
||||
#define APE_STACK_VADDR \
|
||||
({ \
|
||||
|
@ -69,9 +69,9 @@ texthead uint64_t __new_page(struct mman *mm) {
|
|||
if (p != NOPAGE) {
|
||||
uint64_t q;
|
||||
struct ReclaimedPage *rp = (struct ReclaimedPage *)(BANE + p);
|
||||
unassert(p == (p & PAGE_TA));
|
||||
/* unassert(p == (p & PAGE_TA)); */
|
||||
q = rp->next;
|
||||
unassert(q == (q & PAGE_TA) || q == NOPAGE);
|
||||
/* unassert(q == (q & PAGE_TA) || q == NOPAGE); */
|
||||
mm->frp = q;
|
||||
return p;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ void __ref_pages(struct mman *mm, uint64_t *pml4t, uint64_t ps, uint64_t size) {
|
|||
*/
|
||||
static void __reclaim_page(struct mman *mm, uint64_t p) {
|
||||
struct ReclaimedPage *rp = (struct ReclaimedPage *)(BANE + p);
|
||||
unassert(p == (p & PAGE_TA));
|
||||
/* unassert(p == (p & PAGE_TA)); */
|
||||
rp->next = mm->frp;
|
||||
mm->frp = p;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "libc/runtime/internal.h"
|
||||
#include "libc/thread/lock.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#include "third_party/nsync/mu.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,9 +27,12 @@
|
|||
struct Signals __sig;
|
||||
|
||||
sigset_t __sig_block(void) {
|
||||
if (IsWindows()) {
|
||||
return atomic_exchange_explicit(&__get_tls()->tib_sigmask, -1,
|
||||
memory_order_acquire);
|
||||
if (IsWindows() || IsMetal()) {
|
||||
if (__tls_enabled)
|
||||
return atomic_exchange_explicit(&__get_tls()->tib_sigmask, -1,
|
||||
memory_order_acquire);
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
sigset_t res, neu = -1;
|
||||
sys_sigprocmask(SIG_SETMASK, &neu, &res);
|
||||
|
@ -38,10 +41,12 @@ sigset_t __sig_block(void) {
|
|||
}
|
||||
|
||||
void __sig_unblock(sigset_t m) {
|
||||
if (IsWindows()) {
|
||||
atomic_store_explicit(&__get_tls()->tib_sigmask, m, memory_order_release);
|
||||
if (_weaken(__sig_check)) {
|
||||
_weaken(__sig_check)();
|
||||
if (IsWindows() || IsMetal()) {
|
||||
if (__tls_enabled) {
|
||||
atomic_store_explicit(&__get_tls()->tib_sigmask, m, memory_order_release);
|
||||
if (_weaken(__sig_check)) {
|
||||
_weaken(__sig_check)();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sys_sigprocmask(SIG_SETMASK, &m, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue