I'm implementing a puts (print a string on screen) system call in a custom OS project I'm working on. The absolute memory address of the string is given to me by an `unsigned int` variable representing the `esi` register, and I need to initialize a pointer to an `unsigned char` array to read the string from.

The registers contents are represented by:

```
struct regs
{
    unsigned int gs, fs, es, ds;
    unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
    unsigned int int_no, err_code;
    unsigned int eip, cs, eflags, useresp, ss;
};

```

I have tried the following to initialize a pointer to the address in `esi`:

```
void fault_handler(struct regs *r) {
   void *p = (void*)r->esi;
   unsigned char* s = (unsigned char*)p;
   // take s and print it to the screen
}

```

But I don't get the "Hello\n" I'm supposed to get, instead I get garbage. I verified that the address of `esi` indeed points to the correct string. The problem I have is to initialize a pointer to this address.

Thanks!

Update: I will close this question and move the discussion to a new question as the original answer is answered. Thank you everyone!