Skip to content

Commit

Permalink
[tp1] fix initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
agantet committed Oct 10, 2023
1 parent 9c7a1f9 commit d254ee8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tp1/tp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* GPLv2 (c) Airbus */
#include <debug.h>
#include <segmem.h>

void userland() {
asm volatile ("mov %eax, %cr0");
Expand All @@ -9,7 +10,7 @@ void print_gdt_content(gdt_reg_t gdtr_ptr) {
seg_desc_t* gdt_ptr;
gdt_ptr = (seg_desc_t*)(gdtr_ptr.addr);
int i=0;
while ((uint32_t)gdt_ptr < ((gdtr_ptr.addr) + gdtr_ptr.limit*sizeof(seg_desc_t))) {
while ((uint32_t)gdt_ptr < ((gdtr_ptr.addr) + gdtr_ptr.limit)) {
uint32_t start = gdt_ptr->base_3<<24 | gdt_ptr->base_2<<16 | gdt_ptr->base_1;
uint32_t end;
if (gdt_ptr->g) {
Expand All @@ -20,7 +21,7 @@ void print_gdt_content(gdt_reg_t gdtr_ptr) {
debug("%d ", i);
debug("[0x%x ", start);
debug("- 0x%x] ", end);
debug("seg_t: %03b ", gdt_ptr->type);
debug("seg_t: 0x%x ", gdt_ptr->type);
debug("desc_t: %d ", gdt_ptr->s);
debug("priv: %d ", gdt_ptr->dpl);
debug("present: %d ", gdt_ptr->p);
Expand Down

0 comments on commit d254ee8

Please sign in to comment.