- devfs.vp: string.split 传 PATH_BUFFER_SIZE(配合 split 新增容量参数) - fat32_types.vp: lfn_extract 越界钳制(base+i > MAX_LFN 返回 -1) - sheet.vp: gfx.Renderer 实参修正为 (fb, zb, w, h)(原单参导致 w/h=0 渲染空操作) - 同批包含 VKernel 其余既有移植改动与 vpsdk/Apps/Libs 工作区内容
118 lines
4.7 KiB
Plaintext
118 lines
4.7 KiB
Plaintext
import t, c
|
|
|
|
CREATE_WINDOW: t.CDefine = 1
|
|
DRAW_TEXT: t.CDefine = 2
|
|
EXIT: t.CDefine = 3
|
|
OPEN: t.CDefine = 4
|
|
CLOSE: t.CDefine = 5
|
|
READ: t.CDefine = 6
|
|
WRITE: t.CDefine = 7
|
|
SEEK: t.CDefine = 8
|
|
TELL: t.CDefine = 9
|
|
SIZE: t.CDefine = 10
|
|
MKDIR: t.CDefine = 11
|
|
REMOVE: t.CDefine = 12
|
|
OPENDIR: t.CDefine = 13
|
|
READDIR: t.CDefine = 14
|
|
CLOSEDIR: t.CDefine = 15
|
|
STAT: t.CDefine = 16
|
|
WAIT_WINDOW: t.CDefine = 17
|
|
SERIAL_PUTS: t.CDefine = 18
|
|
LOAD_SO: t.CDefine = 19
|
|
SO_CALL1: t.CDefine = 20
|
|
GET_WINBUF: t.CDefine = 21
|
|
WIN_FLUSH: t.CDefine = 22
|
|
POLL_EVENT: t.CDefine = 23
|
|
SET_CURSOR: t.CDefine = 24
|
|
|
|
YIELD: t.CDefine = 25
|
|
SET_TITLE: t.CDefine = 26
|
|
SET_GEOMETRY: t.CDefine = 27
|
|
SPAWN: t.CDefine = 28
|
|
MMAP: t.CDefine = 29
|
|
MUNMAP: t.CDefine = 30
|
|
SET_RESIZABLE: t.CDefine = 31
|
|
GET_WIN_SIZE: t.CDefine = 32
|
|
THREAD_CREATE: t.CDefine = 33
|
|
|
|
# SYSCALL_* 别名(vpsdk.stdlib 等模块引用;数值与内核 VKernel/intr/syscall.vp 一致)
|
|
SYSCALL_MMAP: t.CDefine = 29
|
|
|
|
def _syscall0(num: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11])
|
|
return ret
|
|
|
|
def _syscall1(num: uint64, a1: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rdi, {c.AsmInp(a1, t.ASM_DESCR.REG_ANY)}
|
|
mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11, t.ASM_DESCR.CLOBBER_RDI])
|
|
return ret
|
|
|
|
def _syscall2(num: uint64, a1: uint64, a2: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rdi, {c.AsmInp(a1, t.ASM_DESCR.REG_ANY)}
|
|
mov rsi, {c.AsmInp(a2, t.ASM_DESCR.REG_ANY)}
|
|
mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11, t.ASM_DESCR.CLOBBER_RDI,
|
|
t.ASM_DESCR.CLOBBER_RSI])
|
|
return ret
|
|
|
|
def _syscall3(num: uint64, a1: uint64, a2: uint64, a3: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rdi, {c.AsmInp(a1, t.ASM_DESCR.REG_ANY)}
|
|
mov rsi, {c.AsmInp(a2, t.ASM_DESCR.REG_ANY)}
|
|
mov rdx, {c.AsmInp(a3, t.ASM_DESCR.REG_ANY)}
|
|
mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11, t.ASM_DESCR.CLOBBER_RDI,
|
|
t.ASM_DESCR.CLOBBER_RSI, t.ASM_DESCR.CLOBBER_RDX])
|
|
return ret
|
|
|
|
def _syscall5(num: uint64, a1: uint64, a2: uint64, a3: uint64, a4: uint64, a5: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rdi, {c.AsmInp(a1, t.ASM_DESCR.REG_ANY)}
|
|
mov rsi, {c.AsmInp(a2, t.ASM_DESCR.REG_ANY)}
|
|
mov rdx, {c.AsmInp(a3, t.ASM_DESCR.REG_ANY)}
|
|
mov r10, {c.AsmInp(a4, t.ASM_DESCR.REG_ANY)}
|
|
mov r8, {c.AsmInp(a5, t.ASM_DESCR.REG_ANY)}
|
|
mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11, t.ASM_DESCR.CLOBBER_RDI,
|
|
t.ASM_DESCR.CLOBBER_RSI, t.ASM_DESCR.CLOBBER_RDX,
|
|
t.ASM_DESCR.CLOBBER_R10, t.ASM_DESCR.CLOBBER_R8])
|
|
return ret
|
|
|
|
def _syscall6(num: uint64, a1: uint64, a2: uint64, a3: uint64, a4: uint64, a5: uint64, a6: uint64) -> uint64:
|
|
ret: uint64
|
|
c.Asm(f"""mov rdi, {c.AsmInp(a1, t.ASM_DESCR.REG_ANY)}
|
|
mov rsi, {c.AsmInp(a2, t.ASM_DESCR.REG_ANY)}
|
|
mov rdx, {c.AsmInp(a3, t.ASM_DESCR.REG_ANY)}
|
|
mov r10, {c.AsmInp(a4, t.ASM_DESCR.REG_ANY)}
|
|
mov r8, {c.AsmInp(a5, t.ASM_DESCR.REG_ANY)}
|
|
mov r9, {c.AsmInp(a6, t.ASM_DESCR.REG_ANY)}
|
|
mov rax, {c.AsmInp(num, t.ASM_DESCR.REG_ANY)}
|
|
syscall""",
|
|
out=[c.AsmOut(ret, t.ASM_DESCR.OUTPUT_REG)],
|
|
op=[t.ASM_DESCR.CLOBBER_MEMORY, t.ASM_DESCR.CLOBBER_RCX,
|
|
t.ASM_DESCR.CLOBBER_R11, t.ASM_DESCR.CLOBBER_RDI,
|
|
t.ASM_DESCR.CLOBBER_RSI, t.ASM_DESCR.CLOBBER_RDX,
|
|
t.ASM_DESCR.CLOBBER_R10, t.ASM_DESCR.CLOBBER_R8,
|
|
t.ASM_DESCR.CLOBBER_R9])
|
|
return ret
|