Call gates
Call gates
What?s the differences between regular interrupt/trapgates and Call gates. Is there anything special that has to be done when I?d like to use call gates? (Or do I still use the IDT to set them up)?
Re:Call gates
They are set up like segment descriptors in the GDT.
Like this:
The offset is manually set (I do it like that).
They are used like this: "call gdtentrynumber:offset"
E.g.:
The offset is not important.
Like this:
Code: Select all
dw 0 ;Offset (low word)
dw 08h ;Code segment
db 0
db 11101100b ;present (1), ring3 (11), type (01100)
dw 0 ;Offset (high word)
They are used like this: "call gdtentrynumber:offset"
E.g.:
Code: Select all
call 28h:0h
Re:Call gates
you mean that the descriptors look like the GDT or that I actually set them in the GDT?
thank you!
thank you!
Re:Call gates
of course, because the offset is not used (not reserved, but not used) you can abuse it for your goals. Try using it as a first parameter, selector for which function it is, or something auxiliary.
Re:Call gates
alright
but I read that I can use call gates for syscalls.. how do I do that? Suppose I have a function written in C in my kernel, how do I make my call gate call it? and how do I "call" a call gate from C? Right now Im using trap gates using the INT command for syscalls, but I?d like to try with call gates
but I read that I can use call gates for syscalls.. how do I do that? Suppose I have a function written in C in my kernel, how do I make my call gate call it? and how do I "call" a call gate from C? Right now Im using trap gates using the INT command for syscalls, but I?d like to try with call gates
Re:Call gates
To call them, useEric wrote: alright
but I read that I can use call gates for syscalls.. how do I do that? Suppose I have a function written in C in my kernel, how do I make my call gate call it? and how do I "call" a call gate from C? Right now Im using trap gates using the INT command for syscalls, but I?d like to try with call gates
Code: Select all
asm ("call $<gate>:$<some number>");
Re:Call gates
I dont really understand how I set the function I?d like to call? Like in the IDT, I set a pointer to which function that should be executed, but dont really how I get a call gate a call a certain C function
Re:Call gates
You set the GDT gate to the function, instead of the IDT gate... Not much difference afaik.Eric wrote: I dont really understand how I set the function I?d like to call? Like in the IDT, I set a pointer to which function that should be executed, but dont really how I get a call gate a call a certain C function
Re:Call gates
But where in the GDT do I save the adress of the function I?d like to call? In the "base-address" spaces? That makes sense to me. If it?s correct?
But if I use C (GCC) I cant make a "call" like "call Segment:offset"(GCC is using a flat memory model). And can an application(ring 3) really do this?
But if I use C (GCC) I cant make a "call" like "call Segment:offset"(GCC is using a flat memory model). And can an application(ring 3) really do this?
Re:Call gates
OT
I tried to do it with pen&paper.. but could you please tell what's your dictionary size?
or better with how many bits have you encoded each "character"?
I guessed/tried on the calculater (23*8) mod x with x=5,6,7,8,9,10,11,12,13,.. but I always get some remainders..
If I succeed in decoding and get to see your bitmap, I'll make up a pen&paper riddle for you too if you want
(might be DCT, FFT, arithmetic coder or huffman)
yay nice homework02915721ada53213a49b4f4daba98b952ddb657125960c ->; if you know LZW, decode it. B&;W image, white is 0, 11x11 dimension. Enjoy
I tried to do it with pen&paper.. but could you please tell what's your dictionary size?
or better with how many bits have you encoded each "character"?
I guessed/tried on the calculater (23*8) mod x with x=5,6,7,8,9,10,11,12,13,.. but I always get some remainders..
If I succeed in decoding and get to see your bitmap, I'll make up a pen&paper riddle for you too if you want
(might be DCT, FFT, arithmetic coder or huffman)
Re:Call gates
If you do make one, please do a jpeg stream... gotta learn decoding themmpp.eox3 wrote: OTyay nice homework02915721ada53213a49b4f4daba98b952ddb657125960c ->; if you know LZW, decode it. B&;W image, white is 0, 11x11 dimension. Enjoy
I tried to do it with pen&paper.. but could you please tell what's your dictionary size?
or better with how many bits have you encoded each "character"?
I guessed/tried on the calculater (23*8) mod x with x=5,6,7,8,9,10,11,12,13,.. but I always get some remainders..
If I succeed in decoding and get to see your bitmap, I'll make up a pen&paper riddle for you too if you want
(might be DCT, FFT, arithmetic coder or huffman)
It's 1-bit btw, with 0=white, 1=black, 2=clearcode, 3=EOI. Thus it starts with 3-bit (5x), then 4-bit (8x), then 5-bit... etc
Think I've padded a bit there...
Got some hints to default quantization tables for jpeg? And preferably a nice calculation method to do the DCT?
Re:Call gates
I did as you told me but when I try it I get
call_protected: invalid CS descriptor
in bochs
call_protected: invalid CS descriptor
in bochs
Re:Call gates
I moved the descriptor to offset 0x26.. bochs doesnt halt but I get general protection fault..
Re:Call gates
it works now =)
just one thing I dont understand. The "far call" call 026h:0 sets cs = 026h. But how is the normal value of cs set back? (cause I dont do it) ? My code segment = 08h. Does the call gate set cs=08 automaticlly (spelling?) as soon as it gets called?
just one thing I dont understand. The "far call" call 026h:0 sets cs = 026h. But how is the normal value of cs set back? (cause I dont do it) ? My code segment = 08h. Does the call gate set cs=08 automaticlly (spelling?) as soon as it gets called?
Re:Call gates
CS is not set to 26h afaik, the CS loaded is the one specified in the call gate. The previous one is popped off the stack on return.Eric wrote: it works now =)
just one thing I dont understand. The "far call" call 026h:0 sets cs = 026h. But how is the normal value of cs set back? (cause I dont do it) ? My code segment = 08h. Does the call gate set cs=08 automaticlly (spelling?) as soon as it gets called?