cosmopolitan/third_party/xed/x86isa.c
Jōshin e16a7d8f3b
flip et / noet in modelines
`et` means `expandtab`.

```sh
rg 'vi: .* :vi' -l -0 | \
  xargs -0 sed -i '' 's/vi: \(.*\) et\(.*\)  :vi/vi: \1 xoet\2:vi/'
rg 'vi: .*  :vi' -l -0 | \
  xargs -0 sed -i '' 's/vi: \(.*\)noet\(.*\):vi/vi: \1et\2  :vi/'
rg 'vi: .*  :vi' -l -0 | \
  xargs -0 sed -i '' 's/vi: \(.*\)xoet\(.*\):vi/vi: \1noet\2:vi/'
```
2023-12-07 22:17:11 -05:00

55 lines
2.7 KiB
C

/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2018 Intel Corporation │
│ Copyright 2019 Justine Alexandra Roberts Tunney │
│ │
│ Licensed under the Apache License, Version 2.0 (the "License"); │
│ you may not use this file except in compliance with the License. │
│ You may obtain a copy of the License at │
│ │
│ http://www.apache.org/licenses/LICENSE-2.0 │
│ │
│ Unless required by applicable law or agreed to in writing, software │
│ distributed under the License is distributed on an "AS IS" BASIS, │
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │
│ See the License for the specific language governing permissions and │
│ limitations under the License. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "third_party/xed/x86.h"
#include "third_party/xed/x86isa.h"
asm(".ident\t\"\\n\\n\
Xed (Apache 2.0)\\n\
Copyright 2018 Intel Corporation\\n\
Copyright 2019 Justine Alexandra Roberts Tunney\\n\
Modifications: Trimmed down to 3kb [2019-03-22 jart]\"");
asm(".include \"libc/disclaimer.inc\"");
bool xed_isa_set_is_valid_for_chip(int isa_set, int chip) {
unsigned n, r;
n = isa_set / 64;
r = isa_set - (64 * n);
return !!(kXedChipFeatures[chip][n] & (1ul << r));
}
bool xed_test_chip_features(struct XedChipFeatures *p, int isa_set) {
unsigned n, r;
n = isa_set / 64;
r = isa_set - (64 * n);
return !!(p->f[n] & (1ul << r));
}
void xed_get_chip_features(struct XedChipFeatures *p, int chip) {
if (p) {
if (chip < XED_CHIP_LAST) {
p->f[0] = kXedChipFeatures[chip][0];
p->f[1] = kXedChipFeatures[chip][1];
p->f[2] = kXedChipFeatures[chip][2];
} else {
p->f[0] = 0;
p->f[1] = 0;
p->f[2] = 0;
}
}
}