summaryrefslogtreecommitdiff
path: root/other/shellkit/mips_irix/chmod.s
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/shellkit/mips_irix/chmod.s
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/shellkit/mips_irix/chmod.s')
-rw-r--r--other/shellkit/mips_irix/chmod.s49
1 files changed, 49 insertions, 0 deletions
diff --git a/other/shellkit/mips_irix/chmod.s b/other/shellkit/mips_irix/chmod.s
new file mode 100644
index 0000000..181c123
--- /dev/null
+++ b/other/shellkit/mips_irix/chmod.s
@@ -0,0 +1,49 @@
1/* MIPS/IRIX PIC chmod code
2 *
3 * -sc.
4 */
5
6#include <sgidefs.h>
7#include <sys/regdef.h>
8#include <sys/asm.h>
9#include <sys.s>
10#include <sys/syscall.h>
11
12 .section .text
13
14 .globl cbegin
15 .globl cend
16
17 /* FIXME: its not workable atm */
18cbegin:
19 .set noreorder
20 .set nomacro
21
22lbl: bltzal zero, lbl
23
24 li a1, 0x4141 /* a1 = uid ^ 0x5555 */
25 xor a1, a1, 0x5555
26 li a2, 0x4242 /* a2 = gid ^ 0x5555 */
27 xor a2, a2, 0x555
28
29 addu a0, ra, 0x0180
30 sb zero, -(0x0148 + -(9))(a0)
31 subu a0, a0, 0x0148
32
33 /* chown (a0 = pathname, a1 = uid, a2 = gid) */
34 li v0, SYS_chown /* 0x03f8 */
35 syscall
36
37 /* chmod (a0 = pathname, a1 = 04755) */
38 li a1, 0x09ed /* a1 = 04755 = 0x09ed */
39 li v0, SYS_chmod /* 0x03f7 */
40 syscall
41
42 li v0, SYS_exit /* 0x03e9 */
43 syscall
44 li t8, 0x72ec /* sane ds */
45
46 .end cbegin
47cend:
48
49 /* XXX: append pathname here, will get NUL terminated */