Skip to content

Agent API_p19

grisun0 edited this page Oct 23, 2026 · 12 revisions

API (page 19 of 21)

Previous: API_p18.md

progs/src/lzss.c

progs/src/mmreuse.c

progs/src/mprot.c

progs/src/mthreads.h

Depends on: progs/minios_abi.h Imported by: progs/src/fptest.c, progs/src/scfuzz.c, progs/src/thdemo.c

  • m_syscall6 (function) progs/src/mthreads.h:50 static inline long m_syscall6(long n, long a, long b, long c)
  • myield (function) progs/src/mthreads.h:59 static inline void myield(void)
  • mfutex_wait (function) progs/src/mthreads.h:63 static inline long mfutex_wait(volatile int *addr, int val)
  • mfutex_wake (function) progs/src/mthreads.h:67 static inline long mfutex_wake(volatile int *addr, int n)
  • mmutex_init (function) progs/src/mthreads.h:71 static inline void mmutex_init(mmutex_t *m)
  • mmutex_lock (function) progs/src/mthreads.h:75 static inline void mmutex_lock(mmutex_t *m)
  • mmutex_unlock (function) progs/src/mthreads.h:90 static inline void mmutex_unlock(mmutex_t *m)
  • mthread_entry (function) progs/src/mthreads.h:98 static void mthread_entry(void *p) -- Thread entry trampoline: runs fn(arg), stores the return, exits 0. * The exit code is always 0; join reads retval...
  • mthread_create (function) progs/src/mthreads.h:117 static int mthread_create(mthread_t *t, void *(*fn)(void *), void *arg)
  • mthread_join (function) progs/src/mthreads.h:144 static int mthread_join(mthread_t t, void **retval) -- Join: wait4 (Linux semantics) answers the reaped pid and stores the status word; the thread always exits 0, so a...

progs/src/mtop.c

progs/src/mvrn.c

progs/src/nx.c

progs/src/opl3.c

Depends on: kernel/string.c, progs/minios_abi.h Imported by: progs/piano/piano.c

  • sys_time (function) progs/src/opl3.c:36 static long sys_time(void)
  • sys_open (function) progs/src/opl3.c:39 static long sys_open(long on)
  • sys_submit (function) progs/src/opl3.c:42 static long sys_submit(const void *buf, long len)
  • busy_ms (function) progs/src/opl3.c:46 static void busy_ms(long ms)
  • opl3_set_instrument (function) progs/src/opl3.c:52 static void opl3_set_instrument(opl3_chip *chip) -- } static long sys_open(long on) { long r; asm volatile("syscall":"=a"(r):"a"(SYS_SB16_OPEN),"D"(on):"rcx","r11","...
  • opl3_note (function) progs/src/opl3.c:69 static void opl3_note(opl3_chip *chip, unsigned block, unsigned fnum, int on)
  • render (function) progs/src/opl3.c:77 static void render(opl3_chip *chip, long ms, long *fail) -- Render ms of the current note and stream it to the SB16.
  • main (function) progs/src/opl3.c:107 int main(void)

progs/src/pcmap.c

progs/src/pip.c

Depends on: kernel/string.c, progs/minios_abi.h

  • main (function) progs/src/pip.c:45 int main(int argc, char **argv) -- uint32_t namesz; uint32_t descsz; uint32_t type; char name[sizeof MINIOS_NOTE_NAME]; uint32_t desc; }...

progs/src/pollready.c

progs/src/sbtone.c

Depends on: progs/minios_abi.h

  • Exit code is the number of submitted buffers (0 on failure to open). */

#include <stdio.h>...`

progs/src/scfuzz.c

Depends on: progs/src/mthreads.h

  • guest (function) progs/src/scfuzz.c:7 `* the guest (the BDD timeout then talks). All fuzz maps stay inside
  • one private 4 MB arena (pa...`

progs/src/shell.py

Depends on: progs/lua/minios.c

progs/src/sign.c

  • printf (function) progs/src/sign.c:28 int printf();
  • strcmp (function) progs/src/sign.c:29 int strcmp();
  • fopen (function) progs/src/sign.c:30 void *fopen();
  • fclose (function) progs/src/sign.c:31 int fclose();
  • fread (function) progs/src/sign.c:32 int fread();
  • fwrite (function) progs/src/sign.c:33 int fwrite();
  • fseek (function) progs/src/sign.c:34 int fseek();
  • ftell (function) progs/src/sign.c:35 int ftell();
  • malloc (function) progs/src/sign.c:36 void *malloc();
  • free (function) progs/src/sign.c:37 void free();
  • sign_hexval (function) progs/src/sign.c:89 static unsigned int sign_hexval(char c) -- static unsigned int sign_k[160]; static unsigned int sign_h[16]; static unsigned int sign_w[160]; static char...
  • sign_unhex (function) progs/src/sign.c:100 static void sign_unhex(char *out, char *in, int n) -- static unsigned int sign_ga[32]; /** Docstring: Hex digit value, 0 outside hex. static unsigned int sign_hexval(char...
  • sign_byte (function) progs/src/sign.c:111 static unsigned int sign_byte(char *p, int i) -- } /** Docstring: Decode 2*n hex chars into n bytes. static void sign_unhex(char *out, char *in, int n) { int i = 0...
  • sign_copy (function) progs/src/sign.c:119 static void sign_copy(char *dst, char *src, int n) -- out[i] = (char)((hi << 4) | lo); i++; } } /** Docstring: Unsigned byte at index, the aes.c masking idiom. static...
  • sign_strlen (function) progs/src/sign.c:128 static int sign_strlen(char *s) -- v = v + 256; return (unsigned int)v; } /** Docstring: Copy n bytes. static void sign_copy(char *dst, char *src, int...
  • sign_le16 (function) progs/src/sign.c:136 static unsigned int sign_le16(char *p, int off) -- dst[i] = src[i]; i++; } } /** Docstring: String length. static int sign_strlen(char *s) { int n = 0; while (s[n] !=...
  • sign_le32 (function) progs/src/sign.c:141 static unsigned int sign_le32(char *p, int off) -- /** Docstring: String length. static int sign_strlen(char *s) { int n = 0; while (s[n] != 0) n = n + 1; return n; }...
  • sign_put32 (function) progs/src/sign.c:147 static void sign_put32(char *p, int off, unsigned int v) -- } /** Docstring: Little-endian u16 at offset. static unsigned int sign_le16(char *p, int off) { return sign_byte(p...
  • sign_offok (function) progs/src/sign.c:180 static int sign_offok(char *p, int off, int *lo) -- if (hi < 10) out[2 * i] = (char)(48 + hi); else out[2 * i] = (char)(87 + hi); if (lo < 10) out[2 * i + 1] =...
  • below (function) progs/src/sign.c:195 * every other op below (|, <<) is low-32 exact. */ static void sign_rotr(unsigned int *lo, un...
  • sign_borrow2 (function) progs/src/sign.c:230 static unsigned int sign_borrow2(unsigned int x, unsigned int y, unsigned int s) -- Docstring: Borrow out of x minus y into s, without comparisons. * Same miniGCC rationale as sign_carry2: sanitize...
  • sign_add3 (function) progs/src/sign.c:237 static unsigned int sign_add3(unsigned int *s, unsigned int a, unsigned int b, unsigned int c) -- Docstring: Borrow out of x minus y into s, without comparisons. * Same miniGCC rationale as sign_carry2: sanitize...
  • sign_be32 (function) progs/src/sign.c:247 static unsigned int sign_be32(char *p, int off) -- return (t >> 31) & 1; } /** Docstring: Add three words with carry, returning the new carry. static unsigned int...
  • sign_block (function) progs/src/sign.c:253 static void sign_block(void) -- unsigned int cy = sign_carry2(a, b, t); unsigned int u = t + c; cy = cy + sign_carry2(t, c, u); s = u; return cy; }...
  • sign_sha_init (function) progs/src/sign.c:387 static void sign_sha_init(void) -- i = 0; while (i < 16) { unsigned int n = sign_h[i] + st[i]; unsigned int cy = 0; cy = sign_carry2(sign_h[i], st[i]...
  • sign_sha_update (function) progs/src/sign.c:410 static void sign_sha_update(char *data, int len) -- sign_h[8] = 0xade682d1; sign_h[9] = 0x510e527f; sign_h[10] = 0x2b3e6c1f; sign_h[11] = 0x9b05688c; sign_h[12] =...
  • sign_sha_final (function) progs/src/sign.c:442 static void sign_sha_final(char *out) -- Docstring: Finish the digest into 64 bytes.
  • sign_feed32 (function) progs/src/sign.c:490 static void sign_feed32(unsigned int v) -- while (s < 8) { int ww = 0; if (s < 4) ww = (int)((sign_h[2 * i + 1] >> (24 - 8 * s)) & 255); else ww =...
  • sign_key_init (function) progs/src/sign.c:500 static void sign_key_init(void) -- } } /** Docstring: Feed a u32 into the digest little-endian. static void sign_feed32(unsigned int v) { char b[4]...
  • fe_copy (function) progs/src/sign.c:549 static void fe_copy(unsigned int *r, unsigned int *a) -- sign_q4[5] = 4294967295; sign_q4[6] = 4294967295; sign_q4[7] = 2147483647; sign_l8[0] = 1559614445; sign_l8[1] =...
  • fe_zero (function) progs/src/sign.c:558 static void fe_zero(unsigned int *r) -- sign_l8[6] = 0; sign_l8[7] = 268435456; } /** Docstring: Copy eight limbs. static void fe_copy(unsigned int *r...
  • fe_one (function) progs/src/sign.c:567 static void fe_one(unsigned int *r) -- i = i + 1; } } /** Docstring: Zero eight limbs. static void fe_zero(unsigned int *r) { int i = 0; while (i < 8) {...
  • fe_cmov (function) progs/src/sign.c:573 static void fe_cmov(unsigned int *r, unsigned int *b, unsigned int flag) -- int i = 0; while (i < 8) { r[i] = 0; i = i + 1; } } /** Docstring: One as eight limbs. static void fe_one(unsigned...
  • fe_ge (function) progs/src/sign.c:586 static unsigned int fe_ge(unsigned int *a, unsigned int *b) -- Docstring: 1 when a holds at least b, else 0.
  • fe_rawsub (function) progs/src/sign.c:601 static void fe_rawsub(unsigned int *r, unsigned int *a, unsigned int *b) -- unsigned int borrow = 0; int i = 0; while (i < 8) { unsigned int t1 = a[i] - borrow; unsigned int c0 =...
  • fe_add (function) progs/src/sign.c:617 static void fe_add(unsigned int *r, unsigned int *a, unsigned int *b) -- int i = 0; while (i < 8) { unsigned int ai = a[i]; unsigned int t1 = ai - borrow; unsigned int c0 = sign_borrow2(ai...
  • fe_sub (function) progs/src/sign.c:636 static void fe_sub(unsigned int *r, unsigned int *a, unsigned int *b) -- unsigned int s1 = a[i] + b[i]; unsigned int c0 = sign_carry2(a[i], b[i], s1); unsigned int s2 = s1 + carry; unsigned...
  • bits (function) progs/src/sign.c:672 `* values here always fit 32 bits (limbs below 2^16, carries and
  • products below 2^32), so the s...`
  • fe_foldadd (function) progs/src/sign.c:690 static void fe_foldadd(unsigned int *row, int at, unsigned int x) -- unsigned int carry = 0; carry = (v << 32) >> 32; while (i < 32 && carry != 0) { unsigned int rv = 0; unsigned int s...
  • fe_mul (function) progs/src/sign.c:696 static void fe_mul(unsigned int *r, unsigned int *a, unsigned int *b) -- s = rv + carry; row[i] = s & 65535; carry = s >> 16; i = i + 1; } } /** Docstring: Fold 38 times a sub-2^16 limb...
  • fe_sq (function) progs/src/sign.c:766 static void fe_sq(unsigned int *r, unsigned int *a) -- fe_zero(back); back[0] = acc[16] * 38; fe_add(t, t, back); k = 0; while (k < 3) { if (fe_ge(t, sign_q4) == 1)...
  • fe_inv (function) progs/src/sign.c:771 static void fe_inv(unsigned int *r, unsigned int *a) -- if (fe_ge(t, sign_q4) == 1) fe_rawsub(t, t, sign_q4); k = k + 1; } fe_copy(r, t); } } /** Docstring: Square mod q....
  • fe_frombytes (function) progs/src/sign.c:790 static void fe_frombytes(unsigned int *r, char *b) -- while (i < 255) { unsigned int bit = 1; if (i == 252 || i == 250) bit = 0; fe_sq(tmp, acc); fe_copy(acc, tmp)...
  • fe_tobytes (function) progs/src/sign.c:800 static void fe_tobytes(char *b, unsigned int *a) -- fe_copy(r, acc); } /** Docstring: Load 32 bytes into eight limbs. static void fe_frombytes(unsigned int *r, char *b)...
  • fe_curved (function) progs/src/sign.c:812 static void fe_curved(unsigned int *d, unsigned int *d2) -- /** Docstring: Store eight limbs as 32 bytes. static void fe_tobytes(char *b, unsigned int *a) { int i = 0; while (i...
  • ge_copy (function) progs/src/sign.c:829 static void ge_copy(unsigned int *r, unsigned int *a) -- unsigned int inv[8]; unsigned int zero[8]; fe_zero(num); fe_zero(den); num[0] = 121665; den[0] = 121666; fe_inv(inv...
  • fe_off (function) progs/src/sign.c:845 static unsigned int *fe_off(unsigned int *p, int n) -- Docstring: Address of limb n from a limb base. miniGCC scales a[i] by 8 (its unsigned int slot) but adds raw...
  • ge_cmov (function) progs/src/sign.c:850 static void ge_cmov(unsigned int *r, unsigned int *b, unsigned int flag) -- Docstring: Address of limb n from a limb base. miniGCC scales a[i] by 8 (its unsigned int slot) but adds raw...
  • ge_add (function) progs/src/sign.c:860 static void ge_add(unsigned int *r, unsigned int *p, unsigned int *q, unsigned int *d2) -- return p + n * 8; } /** Docstring: Masked point select, no secret branches. static void ge_cmov(unsigned int *r...
  • ge_double (function) progs/src/sign.c:892 static void ge_double(unsigned int *r, unsigned int *p) -- fe_mul(c, t0, d2); fe_add(t0, fe_off(p, 16), fe_off(p, 16)); fe_mul(d, t0, fe_off(q, 16)); fe_sub(e, b, a)...
  • ge_scalarmult (function) progs/src/sign.c:926 static void ge_scalarmult(unsigned int *r, unsigned int *p, char *s, unsigned int *d2) -- fe_zero(na); fe_sub(na, na, a); fe_add(g, na, b); fe_sub(f, g, c); fe_zero(nb); fe_sub(nb, nb, b); fe_add(h, na...
  • sc_mod_l (function) progs/src/sign.c:951 static void sc_mod_l(unsigned int *r, unsigned int *t16) -- while (i >= 0) { unsigned int bit = 0; if (((sign_byte(s, i >> 3) >> (i & 7)) & 1) == 1) bit = 1; ge_double(dbl...
  • sc_mul_add (function) progs/src/sign.c:1013 static void sc_mul_add(unsigned int *r, unsigned int *a, unsigned int *b, unsigned int *c) -- rem[8] = rem[8] - borrow; } s = s + 1; } b = b + 1; } k = 0; while (k < 8) { r[k] = rem[k]; k = k + 1; } } /**...
  • sign_rev32 (function) progs/src/sign.c:1070 static void sign_rev32(char *b) -- carry = c0 | c1; i = i + 1; } while (i < 16) { unsigned int s = t16[i] + carry; carry = sign_carry2(t16[i], carry...
  • sign_points_init (function) progs/src/sign.c:1081 static void sign_points_init(void) -- } /** Docstring: Reverse 32 bytes in place, big-endian hex to limbs. static void sign_rev32(char *b) { int i = 0...
  • sign_digest (function) progs/src/sign.c:1112 static void sign_digest(char *sig, char *digest) -- fe_copy(fe_off(sign_gb, 8), t); fe_one(fe_off(sign_gb, 16)); fe_mul(t, sign_gb, fe_off(sign_gb, 8))...
  • sign_read (function) progs/src/sign.c:1232 static char *sign_read(char *name, int *len) -- while (i < 16) { t16[i] = sign_byte(hrambytes, 4 * i) | (sign_byte(hrambytes, 4 * i + 1) << 8) |...
  • sign_write (function) progs/src/sign.c:1260 static int sign_write(char *name, char *data, int len) -- len = 1; buf = malloc(*len); if (buf == 0) { fclose(f); return 0; } got = fread(buf, 1, *len, f); fclose(f); if (got...
  • sign_note_span (function) progs/src/sign.c:1273 static int sign_note_span(char *img, int off, int len, int *desc) -- /** Docstring: Write a whole file, 0 on success. static int sign_write(char *name, char *data, int len) { void *f =...
  • sign_digest_of (function) progs/src/sign.c:1307 static int sign_digest_of(char *img, int size, int entry, char *ph, int phnum, char *digest) -- Docstring: Build the canonical digest over entry plus PT_LOADs.
  • sign_patch_notes (function) progs/src/sign.c:1356 static int sign_patch_notes(char *img, int size, char *ph, int phnum, char *desc) -- sign_feed32(0); start = poff; if (start < SIGN_EHDR_SIZE) start = SIGN_EHDR_SIZE; end = poff + pfilesz; if (start <...
  • sign_append (function) progs/src/sign.c:1393 static int sign_append(char *name, char *img, int size, int shoff, int shnum, int shentsize, ... -- rc = sign_note_span(img, poff, pfilesz, &slot); if (rc == 1 && img[slot] == SIGN_KEY_ID) { while (k <...
  • sign_file (function) progs/src/sign.c:1529 static int sign_file(char *name) -- int sn = shnum + 1; out[60] = (char)(sn & 255); out[61] = (char)((sn >> 8) & 255); } } if (sign_write(name, out...
  • sign_selftest (function) progs/src/sign.c:1637 static int sign_selftest(void) -- Docstring: In-OS differential selftest, pinned by BDD.
  • main (function) progs/src/sign.c:1657 int main(int argc, char **argv)

progs/src/spin.c

progs/src/thdemo.c

Depends on: progs/minios_abi.h, progs/src/mthreads.h

progs/src/w1.c

progs/tls_u/tls_u_main.c

Depends on: headers/tls.h, headers/tls_port.h, kernel/string.c

  • The kernel keeps servi...`
  • parse_port (function) progs/tls_u/tls_u_main.c:47 static int parse_port(const char *s) -- Strict port parser (clang-tidy cert-err34-c: atoi reports no errors, so "abc" and overflow both become 0 and fail...
  • main (function) progs/tls_u/tls_u_main.c:61 int main(int argc, char **argv)

progs/tls_u/tls_u_port.c

Depends on: kernel/string.c, kernel/time.c

  • openssl-s_server interop test), insi...`
  • tls_u_recv (function) progs/tls_u/tls_u_port.c:39 int tls_u_recv(int fd, char *buf, int len)
  • tls_u_recv_timeout (function) progs/tls_u/tls_u_port.c:44 int tls_u_recv_timeout(int fd, char *buf, int len, unsigned long ms)
  • tls_u_close (function) progs/tls_u/tls_u_port.c:55 void tls_u_close(int fd)
  • tls_free_fd (function) progs/tls_u/tls_u_port.c:66 void tls_free_fd(int fd); -- Session-aware close for multi-fetch processes (freedom follows redirects and linked stylesheets, reusing the lowest...
  • tls_close (function) progs/tls_u/tls_u_port.c:67 void tls_close(int fd) -- Session-aware close for multi-fetch processes (freedom follows redirects and linked stylesheets, reusing the lowest...
  • tls_now_days (function) progs/tls_u/tls_u_port.c:72 long tls_now_days(void)
  • tls_random (function) progs/tls_u/tls_u_port.c:78 void tls_random(unsigned char *out, unsigned len)
  • u_raw_syscall3 (function) progs/tls_u/tls_u_port.c:99 static long u_raw_syscall3(long n, long a1, long a2, long a3)
  • parse_quad (function) progs/tls_u/tls_u_port.c:122 static int parse_quad(const char *s, unsigned *ip_out) -- Strict dotted-quad parser (clang-tidy cert-err34-c: sscanf %u has undefined overflow and accepts whitespace/sign, so...
  • tls_u_resolve (function) progs/tls_u/tls_u_port.c:147 int tls_u_resolve(const char *host, unsigned *ip_out)
  • answer (function) progs/tls_u/tls_u_port.c:163 * answer (some resolvers go IPv6-only on the first query). */ memset(&hints, 0, sizeof(hints));
  • net_dns_resolve (function) progs/tls_u/tls_u_port.c:183 int net_dns_resolve(const char *host) -- freedom's resolver name: kernel DNS value semantics (u32 host order, * -1 on failure).

progs/topogpt3/topogpt3.c

Depends on: kernel/string.c

Next: API_p20.md

Start

Wiki

Agent Docs

Recipes

Clone this wiki locally