30 #define fb_lock_memory_fn( fn_name ) \
31 fb_dos_lock_code( fn_name, fn_name ## _end - fn_name )
33 #define fb_lock_memory_data( var_name ) \
34 fb_dos_lock_data( &var_name ## _start, &var_name ## _end - &var_name ## _start )
36 static int do_lock(
int is_code,
int (*
proc)(__dpmi_meminfo *),
const void *address,
size_t size)
41 if ( __dpmi_get_segment_base_address( is_code ? _go32_my_cs() : _go32_my_ds(), &base ) == -1 )
44 mi.address = base + (
unsigned long)address;
52 return do_lock(
FALSE, __dpmi_lock_linear_region, address, size);
57 return do_lock(
TRUE, __dpmi_lock_linear_region, address, size);
62 return do_lock(
FALSE, __dpmi_unlock_linear_region, address, size);
67 return do_lock(
TRUE, __dpmi_unlock_linear_region, address, size);
73 unsigned short result;
74 __asm__(
"movw %%es,%0" :
"=r" (result));
81 unsigned short result;
82 __asm__(
"movw %%fs,%0" :
"=r" (result));
89 unsigned short result;
90 __asm__(
"movw %%gs,%0" :
"=r" (result));
96 __dpmi_version_ret version;
106 if( __dpmi_get_version( &version )!=0 ) {
114 for( i=0; i!=8; ++i ) {
115 int irq_vector = version.master_pic + i;
117 if( __dpmi_set_protected_mode_interrupt_vector( irq_vector, offset ) != 0 ) {
125 for( i=0; i!=8; ++i ) {
126 int irq_vector = version.slave_pic + i;
128 if( __dpmi_set_protected_mode_interrupt_vector( irq_vector, offset ) != 0 ) {
143 __dpmi_version_ret version;
161 if( __dpmi_get_version( &version )!=0 ) {
167 for( i=0; i!=8; ++i ) {
168 int irq_vector = version.master_pic + i;
170 if( __dpmi_get_protected_mode_interrupt_vector( irq_vector, offset ) != 0 ) {
177 for( i=0; i!=8; ++i ) {
178 int irq_vector = version.slave_pic + i;
180 if( __dpmi_get_protected_mode_interrupt_vector( irq_vector, offset ) != 0 ) {
196 for( i=0; i!=8; ++i ) {
197 int irq_vector = version.master_pic + i;
200 (
unsigned short) _my_cs()
202 if( __dpmi_set_protected_mode_interrupt_vector( irq_vector, &offset )!=0 ) {
204 for( j=0; j!=i; ++j ) {
205 int irq_vector = version.master_pic + j;
207 __dpmi_set_protected_mode_interrupt_vector( irq_vector, offset );
215 for( i=0; i!=8; ++i ) {
216 int irq_vector = version.slave_pic + i;
219 (
unsigned short) _my_cs()
221 if( __dpmi_set_protected_mode_interrupt_vector( irq_vector, &offset )!=0 ) {
224 for( j=0; j!=8; ++j ) {
225 int irq_vector = version.master_pic + j;
227 __dpmi_set_protected_mode_interrupt_vector( irq_vector, offset );
229 for( j=0; j!=i; ++j ) {
230 int irq_vector = version.slave_pic + j;
232 __dpmi_set_protected_mode_interrupt_vector( irq_vector, offset );
271 if( stack_size!=0 ) {
272 if( stack_size < _go32_interrupt_stack_size )
273 stack_size = _go32_interrupt_stack_size;
274 if( stack_size < 512 )
277 pStack = malloc( stack_size );
292 __fb_hDrvIntStacks[irq_number].
offset = pStack;
293 __fb_hDrvIntStacks[irq_number].
size = stack_size;
318 pStack = __fb_hDrvIntStacks[irq_number].
offset;
319 stack_size = __fb_hDrvIntStacks[irq_number].
size;
321 __fb_hDrvIntStacks[irq_number].
size = 0;