flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > What's wrong with GDT |
Author |
|
revolution 03 Apr 2011, 07:09
Igor1024 wrote:
You need to specify a valid GDT selector for CS. Something like 8, 0x10 or 0x18. Anything higher and there are no more GDT entries. |
|||
03 Apr 2011, 07:09 |
|
Igor1024 03 Apr 2011, 08:29
Oh, understood...
Code: jmp 00001000:ENTRY_POINT But it doesn't work... Or I'm wrong again? Last edited by Igor1024 on 03 Apr 2011, 10:20; edited 2 times in total |
|||
03 Apr 2011, 08:29 |
|
Igor1024 03 Apr 2011, 08:42
Or do by this way:
Code: mov eax,0100h;calculate linear address of entry point add eax,PROTECTED_ENTRY mov dword[ENTRY_OFF],eax Code: dd 66h db 0EAh;jmp far instruction ENTRY_OFF dd ?;address dw 00001000b;selector But this code doesn't work too. _________________ The God is real,unless he is declared as integer. |
|||
03 Apr 2011, 08:42 |
|
revolution 03 Apr 2011, 09:18
To set CS to a GDT entry value you can use something like this:
Code: jmp 8:ENTRY If you want a dynamic (calculated) address then use a pword pointer rather than self modifying code. |
|||
03 Apr 2011, 09:18 |
|
Igor1024 03 Apr 2011, 10:25
*00001*0*00*b
# TI RPL That's the struture of segment selector. It should be ok in my code now, but when I try this code on VMware an error occurs. |
|||
03 Apr 2011, 10:25 |
|
egos 03 Apr 2011, 11:47
Code: PROTECTED_ENTRY: ... sti mov ax, 0x5301 ;and shutdown computer xor bx, bx int 0x15 mov ax, 0x5308 mov bx, 1 mov cx, bx int 0x15 mov ax, 0x530D mov bx, 1 mov cx, bx int 0x15 mov ax, 0x530F mov bx, 1 mov cx, bx int 0x15 mov ax, 0x530E xor bx, bx mov cx, 0x102 int 15h mov ax, 0x5307 mov bx, 1 mov cx, 3 int 0x15 jmp $ _________________ If you have seen bad English in my words, tell me what's wrong, please. |
|||
03 Apr 2011, 11:47 |
|
Igor1024 03 Apr 2011, 12:11
egos, that's the best way to find out whether code works.
|
|||
03 Apr 2011, 12:11 |
|
egos 04 Apr 2011, 13:53
You didn't understand what I meant. This code will not work in PM correctly. And don't allow interrupts until you have done interrupt initialization.
|
|||
04 Apr 2011, 13:53 |
|
Igor1024 09 Apr 2011, 11:58
The problem has been successfully solved at wasm.ru/forum.
|
|||
09 Apr 2011, 11:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.