# Path: VM/kernel/kernel.py
# class KernelMeta(type):   
# class Kernel(metaclass=KernelMeta):
#     def register(cls, syscall_number: int):
#         def actually_register(function: Callable[..., int]):
#     def __init__(self, cpu):
#     def __getitem__(self, syscall_number: int):
#     def kernel_read_string(self, address: int) -> bytes:


import struct
import ctypes
import logging
    import time
    import enum
from .kernel import Kernel, Uint, Int


@Kernel.register(0xfc)
def sys_exit_group(kernel: Kernel, code: Int):
    return sys_exit(kernel, code)


@Kernel.register(0x7a)
def sys_newuname(kernel: Kernel, buf_addr: Uint):
    """
    int sys_newuname(struct new_utsname *buf);
    """

    logger.debug(f'sys_newuname(struct new_utsname *buf=0x%08X)', buf_addr)

    uname = StructNewUtsname(
        sysname=b'PyVM_Linux',
        nodename=b'PyVM_Linux',
        release=b'3.14',
        version=b'3.14',
        machine=b'PyVM - Intel IA-32 on Python',
        domainname=b'PyVM_Linux.local'
    )

    kernel.cpu.mem.set_bytes(buf_addr, ctypes.sizeof(StructNewUtsname), bytes(uname))

    return 0


@Kernel.register(0xae)

# Path: VM/kernel/kernel.py
# class KernelMeta(type):   
# class Kernel(metaclass=KernelMeta):
#     def register(cls, syscall_number: int):
#         def actually_register(function: Callable[..., int]):
#     def __init__(self, cpu):
#     def __getitem__(self, syscall_number: int):
#     def kernel_read_string(self, address: int) -> bytes:


# Path: VM/kernel/kernel_sys.py
import struct
import ctypes
import logging
    import time
    import enum
from .kernel import Kernel, Uint, Int



@Kernel.register(0xfc)
def sys_exit_group(kernel: Kernel, code: Int):
    return sys_exit(kernel, code)


@Kernel.register(0x7a)
def sys_newuname(kernel: Kernel, buf_addr: Uint):
    """
    int sys_newuname(struct new_utsname *buf);
    """

    logger.debug(f'sys_newuname(struct new_utsname *buf=0x%08X)', buf_addr)

    uname = StructNewUtsname(
        sysname=b'PyVM_Linux',
        nodename=b'PyVM_Linux',
        release=b'3.14',
        version=b'3.14',
        machine=b'PyVM - Intel IA-32 on Python',
        domainname=b'PyVM_Linux.local'
    )

    kernel.cpu.mem.set_bytes(buf_addr, ctypes.sizeof(StructNewUtsname), bytes(uname))

    return 0


@Kernel.register(0xae)

def sys_sigaction(kernel: Kernel, signum: Int, act_addr: Uint, oldact_addr: Uint):