mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Introduce CPUID detection for Blink
This commit is contained in:
parent
4922bc4890
commit
3da887c58f
12 changed files with 19 additions and 14 deletions
|
@ -239,7 +239,7 @@
|
|||
int pledge(const char *promises, const char *execpromises) {
|
||||
int e, rc;
|
||||
unsigned long ipromises, iexecpromises;
|
||||
if (IsGenuineCosmo()) {
|
||||
if (IsGenuineCosmo() || IsGenuineBlink()) {
|
||||
rc = 0; // blink doesn't support seccomp
|
||||
} else if (!ParsePromises(promises, &ipromises) &&
|
||||
!ParsePromises(execpromises, &iexecpromises)) {
|
||||
|
|
|
@ -354,7 +354,7 @@ int sys_unveil_linux(const char *path, const char *permissions) {
|
|||
int unveil(const char *path, const char *permissions) {
|
||||
int e, rc;
|
||||
e = errno;
|
||||
if (IsGenuineCosmo()) {
|
||||
if (IsGenuineCosmo() || IsGenuineBlink()) {
|
||||
rc = 0; // blink doesn't support landlock
|
||||
} else if (IsLinux()) {
|
||||
rc = sys_unveil_linux(path, permissions);
|
||||
|
|
|
@ -43,6 +43,7 @@ int IsDebuggerPresent(bool force) {
|
|||
int e, fd, res;
|
||||
char *p, buf[1024];
|
||||
if (!force && IsGenuineCosmo()) return 0;
|
||||
if (!force && IsGenuineBlink()) return 0;
|
||||
if (!force && __getenv(environ, "HEISENDEBUG")) return 0;
|
||||
if (IsWindows()) return IsBeingDebugged();
|
||||
if (__isworker) return false;
|
||||
|
|
|
@ -57,7 +57,8 @@ relegated int(AttachDebugger)(intptr_t continuetoaddr) {
|
|||
char pidstr[11], breakcmd[40];
|
||||
const char *se, *elf, *gdb, *rewind, *layout;
|
||||
__restore_tty();
|
||||
if (IsGenuineCosmo() || !(gdb = GetGdbPath()) || !isatty(0) || !isatty(1) ||
|
||||
if (IsGenuineCosmo() || IsGenuineBlink() || !(gdb = GetGdbPath()) ||
|
||||
!isatty(0) || !isatty(1) ||
|
||||
(ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -18,5 +18,10 @@
|
|||
kCpuids[KCPUIDS_0H][KCPUIDS_EDX] == 0x43656e69 /* ineC */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_ECX] == 0x6f6d736f /* osmo */)
|
||||
|
||||
#define IsGenuineBlink() \
|
||||
(kCpuids[KCPUIDS_0H][KCPUIDS_EBX] == 0x756e6547 /* Genu */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_EDX] == 0x42656e69 /* ineB */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_ECX] == 0x6b6e696c /* link */)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_VENDOR_H_ */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "libc/thread/semaphore.h"
|
||||
|
||||
/**
|
||||
* Destroys unnamed semaphore.
|
||||
* Returns semaphore value.
|
||||
*
|
||||
* @param sem was created by sem_init()
|
||||
* @param sval receives output value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue