ISSUES WITH ENTERING RING3
Posted: Thu Aug 17, 2023 1:30 am
Hello,
I am in the process of writing a small os in x86_32. I am currently trying to enter user mode. I'm using https://wiki.osdev.org/Getting_to_Ring_ ... ing_Ring_3 as a reference and this is my current assembly code:
However, my bochs emulator spits out the following and stops running:
Moreover, I have noticed that it stops running on the first line of the label "user_entry", regardless of what it may be. Also, I disabled the interrupts in the beginning in hopes of not having to deal with a tss (yet). Just trying to get a simple user program to run first.
I have been super stuck on this for a while and would appreciate any help/leads regarding this.
I'm relatively new to this and still learning, so I would greatly appreciate your patience with any gaps in my understanding.
Thanks!
UPDATE:
There was quite a bit of delay between me posting this and it getting approved (probably because this was my first post here) but this issue has been resolved. For anyone curious, I had not set the U/S flag bit on my pdt.
I am in the process of writing a small os in x86_32. I am currently trying to enter user mode. I'm using https://wiki.osdev.org/Getting_to_Ring_ ... ing_Ring_3 as a reference and this is my current assembly code:
Code: Select all
global enter_user_mode
USER_MODE_CODE_SEGMENT equ (0x18 | 0x3)
USER_MODE_DATA_SEGMENT equ (0x20| 0x3)
enter_user_mode:
cli ; disable interrupts
mov eax, esp
push USER_MODE_DATA_SEGMENT
push eax
pushf
push USER_MODE_CODE_SEGMENT
mov eax, user_entry
push eax
mov eax, USER_MODE_DATA_SEGMENT
mov ds, eax
mov gs, eax
mov es, eax
mov fs, eax
iret
user_entry:
mov eax, 0xc00b8000 ;framebuffer address
mov byte [eax], 'U'
mov eax, 0xc00b8001
mov byte [eax], 0xE
Code: Select all
(0).[310881190] [0x0000000000102710] 001b:00000000c0102710 (unk. ctxt): mov eax, 0xc00b8000 ; b800800bc0
Next at t=310881191
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
I have been super stuck on this for a while and would appreciate any help/leads regarding this.
I'm relatively new to this and still learning, so I would greatly appreciate your patience with any gaps in my understanding.
Thanks!
UPDATE:
There was quite a bit of delay between me posting this and it getting approved (probably because this was my first post here) but this issue has been resolved. For anyone curious, I had not set the U/S flag bit on my pdt.