Commit Graph

59 Commits

Author SHA1 Message Date
thorpej
543bc9a286 The native compiler defines __NO_LEADING_UNDERSCORES__, so key off
that to determine if __LEADING_UNDERSCORE is necessary.
2002-09-28 02:27:03 +00:00
scw
84b2ccee63 Add sh5_nmi_clear(), a board-specific hook for clearing the NMI one-shot. 2002-09-22 20:48:09 +00:00
scw
5a529aa332 - Add a /e option to db_stack_trace_print() which dumps the saved
registers in any trap/interrupt exception frame found.

- Slight tweak to more accurately detect the correct call-site when
  looking for a function's prologue.
2002-09-22 20:31:18 +00:00
simonb
63096043b3 Use "#define\t" instead of "#define ". 2002-09-22 08:30:56 +00:00
chs
c081614ea2 it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not.  doh.
2002-09-22 07:53:39 +00:00
chs
55e1f79335 add pmap_remove_all() hook (empty on most platforms so far). 2002-09-22 07:17:08 +00:00
gmcgarry
dca80f08fd Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives. 2002-09-22 04:11:32 +00:00
scw
47e178df57 Move opcode_t typedef into db_machdep.h. 2002-09-19 10:03:11 +00:00
scw
a9c1bc6c83 Add code to deal with the "Cache Purge/Invalidate can cause TLB Miss"
problem, such that a TLB miss no longer occurs.

With the above, it is now safe to enable write-back caching for userland
mappings.

TODO: Deal with cache issues for shared mappings with different VAs.
2002-09-12 12:44:13 +00:00
scw
22569e09ed The cacheops functions now need the physical address of the region
to be purged/invalidated.
2002-09-12 12:37:49 +00:00
scw
b0ecf76dd4 sh5_setasid() now returns the value of the previous ASID. 2002-09-12 12:35:00 +00:00
scw
08dfbb4305 - Be more consistent about using ptel_t where it matters.
- Add event counters for some key pmap events (similar to mpc6xx pmap).

 - Use the cache-friendly, optimised copy/zero page functions.

 - Add the necessary cache management code to enable WriteBack caching
   of KSEG1 mappings. Seems to work fine so far.
2002-09-11 11:08:45 +00:00
scw
0d7cafd74b Add a few more cpu-specific cacheop functions. 2002-09-10 11:56:32 +00:00
scw
fdd9155a03 Manifest constants for errors pertaining to recursive critical section
handling.
2002-09-10 11:51:01 +00:00
scw
d2336580d6 Manifest constants for ASID values. 2002-09-10 11:11:44 +00:00
scw
8cd70003d7 Add external reference for _sh5_delay_constant. 2002-09-10 11:11:12 +00:00
scw
7af71ec12b Some tidying up, and a fix for an event counter array overrun
which was responsible for corrupting the kernel IPT.
2002-09-07 20:43:32 +00:00
scw
690813872b Account for the clock interrupt itself in CLKF_INTR(). 2002-09-06 15:36:16 +00:00
scw
12968d78e9 Double-precision FP regs use a single register_t, despite the FP number
being a multiple of two. Correct for this in the _JB_DR macro.
2002-09-06 15:35:41 +00:00
scw
45eb1758c0 Clean this up somewhat, and correct some bad offsets. 2002-09-05 09:53:17 +00:00
scw
94d1813039 Don't inlcude "opt_kernel_ipt.h" here.
Move KERNEL_IPT_SIZE inside _KERNEL check.
2002-09-04 15:26:29 +00:00
scw
693ffb8185 Catch the case where a synchronous exception occurs during the critical
section of another exception. This is likely to happen if the kernel
stack is misaligned, has dropped off the bottom of the PCB, or has
otherwise gone into orbit.

In this case, switch to a safe stack, save as much of the machine
state as possible and dump it to the console.
2002-09-02 14:00:25 +00:00
scw
f387921c31 Move registers r10-r13 over to the Caller-saved set, at least as far
as intrframe and trapframe are concerned.

According to the ABI, only the low 32-bits of these registers are
guaranteed to be preserved by the callee. Therefore, we need to
preserve all 64-bits of them in the interrupt trampoline.
2002-09-01 11:40:54 +00:00
scw
5938c04bbe Yay, single-step now works.
Also do a wee bit tidying up.
2002-09-01 09:01:33 +00:00
scw
da6c509ffa Pick a better T_NMI code. The previous one clashed with T_AST|T_USER. 2002-08-31 09:25:53 +00:00
scw
d7dbb0862d Deal with NMIs by jumping through the normal trap() code path.
At the very least, this will dump the machine state. At best,
we get into ddb().

This provides a useful way to regain control using an NMI button
if the cpu decides to spin at a high ipl.
2002-08-31 09:11:56 +00:00
scw
ec32f137a2 Add byte_swap.h 2002-08-30 10:50:55 +00:00
scw
5bb390ef0d Re-arrange the endian/byteswap headers a bit by splitting off the
byte swap code into a separate file and renaming them.
Fix a typo which prevented ntohX and htonX macros DTRT for
little-endian mode.
2002-08-30 10:50:06 +00:00
scw
1256340461 Add the frame pointer (r14) to the list of registers to save in
the pcb during a context switch.
2002-08-29 16:04:10 +00:00
scw
a57d38854c Save SSR and SPC while in the critical section of an exception. The
previous behaviour of storing them with SR.BL clear was in breach
of the SH5 documentation.

Make an effort to catch PANIC traps and dump machine state to the console.
2002-08-26 10:38:52 +00:00
scw
8bd3eb387d Don't block exceptions in the initial SR value. 2002-08-26 10:34:43 +00:00
scw
10ce1fc51b s/pmap_bootstrap_mapping/pmap_map_device/ 2002-08-26 10:33:33 +00:00
scw
abc568b5e1 In cpu_fork(), if p1 == curproc, call sh5_savectx() to ensure the
pcb contains valid state before copying it to p2's pcb.
Previously, we just lazy-sync the fpu state. This wasn't quite good
enough if p1 had not previously slept.
2002-08-26 10:32:55 +00:00
scw
2774f9d77b Basic ddb(4) support.
Still to do:
 - disassembly
 - breakpoints
 - single-step
 - stack trace
2002-08-26 10:16:44 +00:00
briggs
0b956d0b8b Implement pmc(9) -- An interface to hardware performance monitoring
counters.  These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface.  Initially, the Intel XScale
counters are the only ones supported.
2002-08-07 05:14:47 +00:00
scw
e9688612da Make it so kernels can be compiled for 32-bit or 64-bit with a
simple config file option.

Also, don't hard code the endian setting in a header file. Rely instead
on the compiler defining __LITTLE_ENDIAN__ and DTRT as appropriate.
2002-07-12 19:33:27 +00:00
scw
c02c1c7cd2 Clean up <sh5/asm.h> to be more 64-bit friendly.
Clean up the kernel asm files to be less 32-bit dependent.
2002-07-12 15:42:27 +00:00
scw
1664941b2c Blah, missed a comma. 2002-07-12 13:37:32 +00:00
scw
2675306718 Add IEEE FP mode control functions and definitions for SH5. 2002-07-12 12:20:24 +00:00
scw
270555326f More SH5 toolchain hacks: Don't define _BSD_WCHAR_T if compiling C++. 2002-07-12 11:19:08 +00:00
scw
14013f679d Add a macro which verifies that a 64-bit value is a valid effective
address as defined by the cpu's Implemented Effective Address bits.
2002-07-11 21:21:58 +00:00
scw
d08670adc8 Sync with reality. 2002-07-11 21:20:23 +00:00
scw
d55184012a Cleanup the sigcontext structure, and sync {,sig}jmp_buf size and
offsets with it.
2002-07-11 14:16:42 +00:00
scw
384b76c19b Install <sh5/pte.h> for the benefit of cpu.h. 2002-07-11 14:11:18 +00:00
scw
e0e8310758 Include <machine/frame.h>, not <sh5/frame.h> 2002-07-11 14:10:39 +00:00
scw
026df6bf33 Cleanup the frame link/unlink macroes. 2002-07-11 14:09:34 +00:00
scw
b234c1aa10 Moved MID_MACHINE definition from <machine/param.h> 2002-07-11 14:08:45 +00:00
scw
52876ee77d First cut of the kernel side support for sh5 signals. 2002-07-10 15:55:01 +00:00
scw
528a743ee9 Update sh5_fpsave() prototype to match reality. 2002-07-10 15:53:57 +00:00
scw
a30ba3dd9a Need <sys/types.h> 2002-07-10 15:52:49 +00:00