flat assembler
Message board for the users of flat assembler.

Index > Main > Some questions: [edi+ecx*3] | PUSH | RAM limit | IDT PIT

Goto page Previous  1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
Quote:
Why aren't you worried about this sequence:

because push eax will atomicly advance stack and copy register
ok not atimicly but interrupt wont happen inside instruction. cpu check its interrupt pins before executing instruction.

Quote:
It won't matter for ring3 code. Each ring has its own stack pointer so an interrupt into the ring0 kernel won't affect anything.

I can setup idt gate with ring3 selector.
Post 01 Mar 2011, 20:33
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
question Exclamation
there is a way to shift bits filling them with 1's:

0000 0011
0000 1111 ; shl 2
1111 1111 ; shl 6

1100 0000
1111 1100 ; shr 4

_________________
Sorry if bad english.
Post 02 Mar 2011, 11:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
rcl, rcl + stc
only for one shift.

Code:
stc
rcl op1,1

stc 
rcr op1,1
    




or for many shifts:
Code:
mov ah,0FFh
shl al,n
shl ah,n
not ah
or al,ah

mov ah,0FFh
shr ah
shr al
not ah
or al,ah
    


Last edited by edfed on 02 Mar 2011, 11:27; edited 1 time in total
Post 02 Mar 2011, 11:27
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
The closet in x86 with a single instruction is sar. Otherwise just do an or after the shift.

[edit]
Just to slightly improve on edfed's suggestion:
Code:
shl reg,bits
or reg,1 shl bits - 1    
Post 02 Mar 2011, 11:27
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
use shld:
Code:
or   reg1,-1
shld reg2,reg1,n
    


Last edited by Madis731 on 02 Mar 2011, 14:34; edited 1 time in total
Post 02 Mar 2011, 14:29
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Code:
not eax
shl eax, n
not eax
    
Post 02 Mar 2011, 14:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
.

Teehee wrote:
4. in PMode, do i really need to define a IDT


NO. As long as no interrupts arrive and no exceptions occur, then you need no IDCT. If nevertheless: BOOM (TripleFault) Shocked
Post 03 Mar 2011, 06:47
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
so why in that tutorial teaches to define one if there is no interupts or exceptions in PM? o.o
Post 03 Mar 2011, 10:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Teehee wrote:
so why in that tutorial teaches to define one if there is no interupts or exceptions in PM? o.o
It would not be a very useful PM OS if you don't allow interrupts or exceptions. While an IDT is not required it is certainly desired.
Post 03 Mar 2011, 10:51
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Smile Try this: "you are not required to put on clothes when you go to work"

With interrupts you can:
1) catch mouse and keyboard movement - very useful
2) catch time events - less useful, but you can update clock and measure time Smile (of course there are other ways)
3) usually system functions are implemented through interrupting. For example int 64 (with eax=123), you can "call" system function number 123, which can be helpful to draw images or other stuff...
Post 03 Mar 2011, 12:23
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
yep, IRQ (interupt request) is the link to the outside of the CPU.

without them, the computer is just a non interactive calculator.
with them, it becomes a video game, a web browser, a mp3 player, a porn watcher, a pic programmer, etc...
Post 03 Mar 2011, 12:37
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
but if i cant use INTs in PM, how to catch mouse & keyboard in PM then? o.o
Post 03 Mar 2011, 13:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Teehee wrote:
but if i cant use INTs in PM, how to catch mouse & keyboard in PM then? o.o
You can't, that is why it is wise to setup an IDT. Without a proper IDT then no interrupts allowed. With an IDT then interrupt away to your OS requirements.
Post 03 Mar 2011, 13:31
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
hmm okay.
Post 03 Mar 2011, 13:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Just to clarify, you can't catch events, but you can poll for them without using interrupts. It is usually not as convenient to use polling. But one never knows your particular requirements may just be perfect for a polling non-interrupt OS.


Last edited by revolution on 03 Mar 2011, 15:09; edited 1 time in total
Post 03 Mar 2011, 13:37
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
to catch events form keyboard and mouse in PM, first switch in PM with interrupts disabled.
get a good video driver and lib to display infos, it will be usefull for debug later.

and then, reprogram pic to revector IRQ0 to 7 to a non reserved vector (INT 20h is the first allowed vector for user in PM), and relocate IRQ 8 to 15 to the next, then, INT 28h.
declare a vector for IRQ1 (INT21h) to the keyboard handler
declare a vector for IRQ12 (INT2Ch) to the mouse handler.

and then, it is ok, you can exploit any jkeyboard and mouse driver source code, by converting them to work in PM memory interface, basically, use32 and assume DS=linear0
Post 03 Mar 2011, 14:50
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
If you look at http://board.flatassembler.net/topic.php?p=118339#118339 and open VESA64_15.11_resize.7z , browse to Stage2\PIC_PIT.inc , you can see that the code to do that is really simple. Sorry that I haven't had more time to comment the code, but you can always find support from this site: http://wiki.osdev.org/PIC
Post 03 Mar 2011, 15:21
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
I will check.
But first lets go back a lil bit. I need ask why its faster to use a double buffer instead to access directly the video memory.
Post 04 Mar 2011, 22:34
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
take as an example:
you put an image, then, over the image, you put a box, inside the box, you put a text and another image.

some pixels will be writen many times before to have their final values.

if you do the writes directlly in video memory (that is slow), you will loose a lot of time.
that's why it is better to first fill a buffer located in fast RAM, and transfert it in video memory ones it is done.
each pixels in video memory will be writen only one time.
Post 04 Mar 2011, 23:15
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
Thank you, ed.
Post 04 Mar 2011, 23:23
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.