<commit_before>/*
 * Copyright © Enable Software Pty Ltd 2013 - All rights reserved
 */

var kernel = {
    init: function() {
        this.threadMax = 5;
        this.threadMaxSymbol = this.GetElfSymbol("_kernel_threadMax");
        if (this.threadMaxSymbol !== undefined) {
            this.threadMax = cpu.ReadRam32(this.threadMaxSymbol.st_value);
        }
        this.threadTable = this.GetThreadTable();
        
        this.currentThreadAddress = this.GetElfSymbol("_currentThread").st_value;
    }, 
    
    ReadRam32: function(address) {
         return simulator.ram[(address- cpu.ramStart) >>> 2]
    },
    
    Read: function(index, offset) {
        return kernel.ReadRam32((index*(kernel.threadTable.st_size/kernel.threadMax))+kernel.threadTable.st_value+(offset*4))
    },
    
    Address: function(index, offset) {
       return (index*(kernel.threadTable.st_size/kernel.threadMax))+kernel.threadTable.st_value+(offset*4);
   },
   
   ReadRamString: function(address)
    {
        var baseAddress = address;
        var data = "", c;
        
        for (; c !== 0 && (address-baseAddress) < 1024; address++) {
            c = cpu.Read8(address);
            if (c !== 0) {
                data += String.fromCharCode(c);
            }
        }
        return data;
    },

    CurrentPid : function()
    {
        return kernel.ReadRam32(simulator.ram[(this.currentThreadAddress - cpu.ramStart) >>> 2]);
    },
    
    IsImageAddress: function(pid, address)
    {
        for (var i = 0; i < kernel.threadMax; i++) {
            if (kernel.Read(i, 0) == pid) {
                var image = kernel.Read(i, 5);
                var imageSize = kernel.Read(i, 8);         
                return address >= image && address < (image+imageSize);
            }
        }
       
       return false;
    },
<commit_msg>Debugging code<commit_after>/*
 * Copyright © Enable Software Pty Ltd 2013 - All rights reserved
 */

var kernel = {
    init: function() {
        this.threadMax = 5;
        this.threadMaxSymbol = this.GetElfSymbol("_kernel_threadMax");
        if (this.threadMaxSymbol !== undefined) {
            this.threadMax = cpu.ReadRam32(this.threadMaxSymbol.st_value);
        }
        this.threadTable = this.GetThreadTable();
        
        this.currentThreadAddress = this.GetElfSymbol("_currentThread").st_value;
    }, 
    
    ReadRam32: function(address) {
         return simulator.ram[(address- cpu.ramStart) >>> 2]
    },
    
    Read: function(index, offset) {
        return kernel.ReadRam32((index*(kernel.threadTable.st_size/kernel.threadMax))+kernel.threadTable.st_value+(offset*4))
    },
    
    Address: function(index, offset) {
       return (index*(kernel.threadTable.st_size/kernel.threadMax))+kernel.threadTable.st_value+(offset*4);
   },
   
   ReadRamString: function(address)
    {
        var baseAddress = address;
        var data = "", c;
        
        for (; c !== 0 && (address-baseAddress) < 1024; address++) {
            c = cpu.Read8(address);
            if (c !== 0) {
                data += String.fromCharCode(c);
            }
        }
        return data;
    },

    CurrentPid : function()
    {
        return kernel.ReadRam32(this.currentThreadAddress);
    },
    
    IsImageAddress: function(pid, address)
    {
        for (var i = 0; i < kernel.threadMax; i++) {
            if (kernel.Read(i, 0) == pid) {
                var image = kernel.Read(i, 5);
                var imageSize = kernel.Read(i, 8);         
                return address >= image && address < (image+imageSize);
            }
        }
       
       return false;
    },

{'fraction_non_alphanumeric': 0.1323085369201208, 'fraction_numerical': 0.015097447158934943, 'mean_word_length': 1.989335520918786, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1572659', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1067, 'n_words': 203}