Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
e42cad9a
Commit
e42cad9a
authored
35 years ago
by
ch
Browse files
Options
Downloads
Patches
Plain Diff
Added interrupt context saving.
parent
41fdc402
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ldb/interrupt.c
+50
-20
50 additions, 20 deletions
ldb/interrupt.c
with
50 additions
and
20 deletions
ldb/interrupt.c
+
50
−
20
View file @
e42cad9a
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.
2
1990/03/2
8
2
2:51:10
ch Exp $ */
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.
3
1990/03/2
9
2
1:19:34
ch Exp $ */
/* Interrupt handing magic. */
/* Interrupt handing magic. */
...
@@ -9,40 +9,30 @@
...
@@ -9,40 +9,30 @@
#include
"ldb.h"
#include
"ldb.h"
#include
"globals.h"
#include
"globals.h"
#include
"lispregs.h"
#include
"lispregs.h"
#include
"interrupt.h"
#define
MAX_INTERRUPTS
(4096)
struct
sigcontext
*
lisp_interrupt_contexts
[
MAX_INTERRUPTS
];
struct
sigcontext
interrupt_contexts
[
MAX_INTERRUPTS
];
union
interrupt_handler
interrupt_handlers
[
NSIG
];
static
union
handler
{
lispobj
lisp
;
int
(
*
c
)();
}
Handler
[
NSIG
];
static
int
pending_signal
,
pending_code
,
pending_mask
;
static
int
pending_signal
,
pending_code
,
pending_mask
;
#define BLOCKABLE (sigmask(SIGHUP) | sigmask(SIGINT) | \
sigmask(SIGQUIT) | sigmask(SIGPIPE) | \
sigmask(SIGALRM) | sigmask(SIGURG) | \
sigmask(SIGTSTP) | sigmask(SIGCHLD) | \
sigmask(SIGIO) | sigmask(SIGXCPU) | \
sigmask(SIGXFSZ) | sigmask(SIGVTALRM) | \
sigmask(SIGPROF) | sigmask(SIGWINCH) | \
sigmask(SIGUSR1) | sigmask(SIGUSR2))
static
handle_now
(
signal
,
code
,
context
)
static
handle_now
(
signal
,
code
,
context
)
int
signal
,
code
;
int
signal
,
code
;
struct
sigcontext
*
context
;
struct
sigcontext
*
context
;
{
{
int
were_in_lisp
;
int
were_in_lisp
;
union
handler
handler
=
H
andler
[
signal
]
;
union
interrupt_
handler
h
andler
;
lispobj
args
[
6
];
/* Six is the minimum */
lispobj
args
[
6
];
/* Six is the minimum */
lispobj
callname
,
function
;
lispobj
callname
,
function
;
handler
=
interrupt_handlers
[
signal
];
were_in_lisp
=
!
foreign_function_call_active
;
were_in_lisp
=
!
foreign_function_call_active
;
if
(
were_in_lisp
)
{
if
(
were_in_lisp
)
{
int
context_index
;
/* Get current LISP state from context */
/* Get current LISP state from context */
current_dynamic_space_free_pointer
=
current_dynamic_space_free_pointer
=
(
lispobj
*
)
context
->
sc_regs
[
ALLOC
];
(
lispobj
*
)
context
->
sc_regs
[
ALLOC
];
...
@@ -55,6 +45,22 @@ struct sigcontext *context;
...
@@ -55,6 +45,22 @@ struct sigcontext *context;
/* Restore the GP */
/* Restore the GP */
set_global_pointer
(
saved_global_pointer
);
set_global_pointer
(
saved_global_pointer
);
/* Do dynamic binding of the active interrupt context index
and save the context in the context array. */
context_index
=
SymbolValue
(
FREE_INTERRUPT_CONTEXT_INDEX
)
>>
2
;
if
(
context_index
>=
MAX_INTERRUPTS
)
{
fprintf
(
"Maximum number (%d) of interrupts exceeded. Exiting.
\n
"
,
MAX_INTERRUPTS
);
exit
(
1
);
}
bind_variable
(
FREE_INTERRUPT_CONTEXT_INDEX
,
fixnum
(
context_index
+
1
));
lisp_interrupt_contexts
[
context_index
]
=
context
;
/* No longer in Lisp now. */
foreign_function_call_active
=
1
;
foreign_function_call_active
=
1
;
}
}
...
@@ -74,12 +80,22 @@ struct sigcontext *context;
...
@@ -74,12 +80,22 @@ struct sigcontext *context;
}
}
if
(
were_in_lisp
)
{
if
(
were_in_lisp
)
{
int
context_index
;
/* Block all blockable signals */
sigblock
(
BLOCKABLE
);
sigblock
(
BLOCKABLE
);
/* Going back into lisp. */
foreign_function_call_active
=
0
;
foreign_function_call_active
=
0
;
/* Undo dynamic binding. */
/* ### Do I really need to unbind_to_here()? */
unbind
();
/* Put the dynamic space free pointer back into the context. */
/* Put the dynamic space free pointer back into the context. */
context
->
sc_regs
[
ALLOC
]
=
context
->
sc_regs
[
ALLOC
]
=
(
unsigned
long
)
current_dynamic_space_free_pointer
;
(
unsigned
long
)
current_dynamic_space_free_pointer
;
}
}
}
}
...
@@ -152,7 +168,7 @@ struct sigcontext *context;
...
@@ -152,7 +168,7 @@ struct sigcontext *context;
void
install_handler
(
signal
,
handler
)
void
install_handler
(
signal
,
handler
)
int
signal
;
int
signal
;
union
handler
handler
;
union
interrupt_
handler
handler
;
{
{
struct
sigvec
sv
;
struct
sigvec
sv
;
...
@@ -169,7 +185,21 @@ union handler handler;
...
@@ -169,7 +185,21 @@ union handler handler;
sv
.
sv_mask
=
BLOCKABLE
;
sv
.
sv_mask
=
BLOCKABLE
;
sv
.
sv_flags
=
0
;
sv
.
sv_flags
=
0
;
H
andler
[
signal
]
=
handler
;
interrupt_h
andler
s
[
signal
]
=
handler
;
sigvec
(
signal
,
&
sv
,
NULL
);
sigvec
(
signal
,
&
sv
,
NULL
);
}
}
void
unistall_handler
(
signal
)
int
signal
;
{
}
interrupt_init
()
{
int
i
;
for
(
i
=
0
;
i
<
NSIG
;
i
++
)
interrupt_handlers
[
i
].
lisp
=
(
lispobj
)
fixnum
(
0
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment