<commit_before><commit_msg>Added GDT code to i386 target, no header yet.<commit_after>
struct gdt_entry {
	short limit0;
	short base0;
	char  base1;
	char  access;
	char  limit1 : 4;
	char  flags  : 4;
	char  base2;
} __attribute__((packed));

struct gdt_descr {
	short size;
	int   offset;
} __attribute__((packed));

struct gdt_entry gdt_block[16];
struct gdt_descr gdt_descriptor;

void gdt_set_entry(int entry_id, unsigned long start_addr, unsigned long limit, short flags) {
	struct gdt_entry *entry = &gdt_block[entry_id];
	entry->base0 = (short)(start_addr & 0xFFFF);
	entry->base1 = (char)((start_addr >> 16) & 0xFF);
	entry->base2 = (char)((start_addr >> 24) & 0xFF);
	entry->limit0 = (short)(limit & 0xFFFF);
	entry->limit1 = (char)((limit >> 16) & 0xF);
	entry->access = (char)(flags & 0xFF);
	entry->flags = (char)((flags >> 8) & 0xF);
}

void gdt_commit(int entries) {
	extern void gdt_install(void *);
	gdt_descriptor.size = entries * sizeof(struct gdt_entry) - 1;
	gdt_descriptor.offset = (int)gdt_block;
	gdt_install(&gdt_descriptor);
}

{'fraction_non_alphanumeric': 0.1452991452991453, 'fraction_numerical': 0.030389363722697058, 'mean_word_length': 5.057471264367816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '3699694', 'n_tokens_mistral': 419, 'n_tokens_neox': 400, 'n_words': 95}