OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [go32/] [go32func.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
#include <sys/types.h>
2
#include "go32.h"
3
#include "dpmi.h"
4
#include "dos.h"
5
 
6
u_short _go32_my_cs()
7
{
8
  asm("movw %cs,%ax");
9
}
10
 
11
u_short _go32_my_ds()
12
{
13
  asm("movw %ds,%ax");
14
}
15
 
16
u_short _go32_my_ss()
17
{
18
  asm("movw %ss,%ax");
19
}
20
 
21
u_short _go32_conventional_mem_selector()
22
{
23
  return _go32_info_block.selector_for_linear_memory;
24
}
25
 
26
static _go32_dpmi_registers regs;
27
static volatile u_long ctrl_break_count = 0;
28
static int ctrl_break_hooked = 0;
29
static _go32_dpmi_seginfo old_vector;
30
static _go32_dpmi_seginfo new_vector;
31
 
32
static ctrl_break_isr(_go32_dpmi_registers *regs)
33
{
34
  ctrl_break_count ++;
35
}
36
 
37
u_long _go32_was_ctrl_break_hit()
38
{
39
  u_long cnt;
40
  _go32_want_ctrl_break(1);
41
  cnt = ctrl_break_count;
42
  ctrl_break_count = 0;
43
  return cnt;
44
}
45
 
46
void _go32_want_ctrl_break(int yes)
47
{
48
  if (yes)
49
  {
50
    if (ctrl_break_hooked)
51
      return;
52
    _go32_dpmi_get_real_mode_interrupt_vector(0x1b, &old_vector);
53
 
54
    new_vector.pm_offset = (int)ctrl_break_isr;
55
    _go32_dpmi_allocate_real_mode_callback_iret(&new_vector, &regs);
56
    _go32_dpmi_set_real_mode_interrupt_vector(0x1b, &new_vector);
57
    ctrl_break_count = 0;
58
    ctrl_break_hooked = 1;
59
  }
60
  else
61
  {
62
    if (!ctrl_break_hooked)
63
      return;
64
    _go32_dpmi_set_real_mode_interrupt_vector(0x1b, &old_vector);
65
    _go32_dpmi_free_real_mode_callback(&new_vector);
66
    ctrl_break_count = 0;
67
    ctrl_break_hooked = 0;
68
  }
69
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.