Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a474de0a
Commit
a474de0a
authored
Jan 25, 2008
by
Jesper Nilsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRIS v32: Update vcs_hook.c for ETRAX FS.
- Clean up some formatting and whitespace.
parent
09160d7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
66 deletions
+70
-66
arch/cris/arch-v32/mach-fs/vcs_hook.c
arch/cris/arch-v32/mach-fs/vcs_hook.c
+66
-62
arch/cris/arch-v32/mach-fs/vcs_hook.h
arch/cris/arch-v32/mach-fs/vcs_hook.h
+4
-4
No files found.
arch/cris/arch-v32/mach-fs/vcs_hook.c
View file @
a474de0a
// $Id: vcs_hook.c,v 1.2 2003/08/12 12:01:06 starvik Exp $
/*
//
* Call simulator hook. This is the part running in the
// Call simulator hook. This is the part running in the
* simulated program.
// simulated program.
*/
//
#include "vcs_hook.h"
#include "vcs_hook.h"
#include <stdarg.h>
#include <stdarg.h>
...
@@ -12,14 +11,16 @@
...
@@ -12,14 +11,16 @@
#define HOOK_TRIG_ADDR 0xb7000000
/* hook cvlog model reg address */
#define HOOK_TRIG_ADDR 0xb7000000
/* hook cvlog model reg address */
#define HOOK_MEM_BASE_ADDR 0xa0000000
/* csp4 (shared mem) base addr */
#define HOOK_MEM_BASE_ADDR 0xa0000000
/* csp4 (shared mem) base addr */
#define HOOK_DATA(offset) ((unsigned*) HOOK_MEM_BASE_ADDR)[offset]
#define HOOK_DATA(offset) ((unsigned *)HOOK_MEM_BASE_ADDR)[offset]
#define VHOOK_DATA(offset) ((volatile unsigned*) HOOK_MEM_BASE_ADDR)[offset]
#define VHOOK_DATA(offset) ((volatile unsigned *)HOOK_MEM_BASE_ADDR)[offset]
#define HOOK_TRIG(funcid) do { *((unsigned *) HOOK_TRIG_ADDR) = funcid; } while(0)
#define HOOK_TRIG(funcid) \
#define HOOK_DATA_BYTE(offset) ((unsigned char*) HOOK_MEM_BASE_ADDR)[offset]
do { \
*((unsigned *) HOOK_TRIG_ADDR) = funcid; \
} while (0)
#define HOOK_DATA_BYTE(offset) ((unsigned char *)HOOK_MEM_BASE_ADDR)[offset]
int
hook_call
(
unsigned
id
,
unsigned
pcnt
,
...)
// ------------------------------------------------------------------ hook_call
{
int
hook_call
(
unsigned
id
,
unsigned
pcnt
,
...)
{
va_list
ap
;
va_list
ap
;
unsigned
i
;
unsigned
i
;
unsigned
ret
;
unsigned
ret
;
...
@@ -27,12 +28,12 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
...
@@ -27,12 +28,12 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
PREEMPT_OFF_SAVE
();
PREEMPT_OFF_SAVE
();
#endif
#endif
// pass parameters
/* pass parameters */
HOOK_DATA
(
0
)
=
id
;
HOOK_DATA
(
0
)
=
id
;
/* Have to make hook_print_str a special case since we call with a
/* Have to make hook_print_str a special case since we call with a
parameter of byte type. Should perhaps be a separate
*
parameter of byte type. Should perhaps be a separate
hook_call. */
*
hook_call. */
if
(
id
==
hook_print_str
)
{
if
(
id
==
hook_print_str
)
{
int
i
;
int
i
;
...
@@ -41,29 +42,30 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
...
@@ -41,29 +42,30 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
HOOK_DATA
(
1
)
=
pcnt
;
HOOK_DATA
(
1
)
=
pcnt
;
va_start
(
ap
,
pcnt
);
va_start
(
ap
,
pcnt
);
str
=
(
char
*
)
va_arg
(
ap
,
unsigned
);
str
=
(
char
*
)
va_arg
(
ap
,
unsigned
);
for
(
i
=
0
;
i
!=
pcnt
;
i
++
)
{
for
(
i
=
0
;
i
!=
pcnt
;
i
++
)
HOOK_DATA_BYTE
(
8
+
i
)
=
str
[
i
];
HOOK_DATA_BYTE
(
8
+
i
)
=
str
[
i
];
}
HOOK_DATA_BYTE
(
8
+
i
)
=
0
;
/* null byte */
HOOK_DATA_BYTE
(
8
+
i
)
=
0
;
/* null byte */
}
}
else
{
else
{
va_start
(
ap
,
pcnt
);
va_start
(
ap
,
pcnt
);
for
(
i
=
1
;
i
<=
pcnt
;
i
++
)
HOOK_DATA
(
i
)
=
va_arg
(
ap
,
unsigned
);
for
(
i
=
1
;
i
<=
pcnt
;
i
++
)
HOOK_DATA
(
i
)
=
va_arg
(
ap
,
unsigned
);
va_end
(
ap
);
va_end
(
ap
);
}
}
// read from mem to make sure data has propagated to memory before trigging
/* read from mem to make sure data has propagated to memory before
*
((
volatile
unsigned
*
)
HOOK_MEM_BASE_ADDR
);
* trigging */
ret
=
*
((
volatile
unsigned
*
)
HOOK_MEM_BASE_ADDR
);
// trigger hook
/* trigger hook */
HOOK_TRIG
(
id
);
HOOK_TRIG
(
id
);
// wait for call to finish
/* wait for call to finish */
while
(
VHOOK_DATA
(
0
)
>
0
)
{}
while
(
VHOOK_DATA
(
0
)
>
0
)
;
// extract return value
/* extract return value */
ret
=
VHOOK_DATA
(
1
);
ret
=
VHOOK_DATA
(
1
);
...
@@ -73,24 +75,26 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
...
@@ -73,24 +75,26 @@ int hook_call( unsigned id, unsigned pcnt, ...) {
return
ret
;
return
ret
;
}
}
unsigned
unsigned
hook_buf
(
unsigned
i
)
hook_buf
(
unsigned
i
)
{
{
return
(
HOOK_DATA
(
i
));
return
(
HOOK_DATA
(
i
));
}
}
void
print_str
(
const
char
*
str
)
{
void
print_str
(
const
char
*
str
)
{
int
i
;
int
i
;
for
(
i
=
1
;
str
[
i
];
i
++
);
/* find null at end of string */
/* find null at end of string */
for
(
i
=
1
;
str
[
i
];
i
++
)
;
hook_call
(
hook_print_str
,
i
,
str
);
hook_call
(
hook_print_str
,
i
,
str
);
}
}
// --------------------------------------------------------------- CPU_KICK_DOG
void
CPU_KICK_DOG
(
void
)
void
CPU_KICK_DOG
(
void
)
{
{
(
void
)
hook_call
(
hook_kick_dog
,
0
);
(
void
)
hook_call
(
hook_kick_dog
,
0
);
}
}
// ------------------------------------------------------- CPU_WATCHDOG_TIMEOUT
void
CPU_WATCHDOG_TIMEOUT
(
unsigned
t
)
void
CPU_WATCHDOG_TIMEOUT
(
unsigned
t
)
{
{
(
void
)
hook_call
(
hook_dog_timeout
,
1
,
t
);
(
void
)
hook_call
(
hook_dog_timeout
,
1
,
t
);
}
}
arch/cris/arch-v32/mach-fs/vcs_hook.h
View file @
a474de0a
/
/ $Id: vcs_hook.h,v 1.1 2003/08/12 12:01:06 starvik Exp $
/
*
//
* Call simulator hook functions
// Call simulator hook functions
*/
#ifndef HOOK_H
#ifndef HOOK_H
#define HOOK_H
#define HOOK_H
int
hook_call
(
unsigned
id
,
unsigned
pcnt
,
...);
int
hook_call
(
unsigned
id
,
unsigned
pcnt
,
...);
enum
hook_ids
{
enum
hook_ids
{
hook_debug_on
=
1
,
hook_debug_on
=
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment