/* And swapping */
#define SWAPDEV 0x0 /* Uses part of IDE slice 0 */
#define SWAP_SIZE 0x40 /* 32K in 512 byte blocks */
-#define SWAPBASE 0x8000 /* We swap the lot, including stashed uarea */
+#define SWAPBASE 0x8000 /* We swap the lot */
#define SWAPTOP 0xFE00 /* so it's a round number of 512 byte sectors */
#define UDATA_SIZE 0x0200 /* one block */
#define MAX_SWAPS 32
#define TICKSPERSEC 50 /* Ticks per second */
#define PROGBASE 0x8000 /* also data base */
#define PROGLOAD 0x8000 /* also data base */
-#define PROGTOP 0xF000 /* Top of program */
+#define PROGTOP 0xFE00 /* Top of program */
/* We need a tidier way to do this from the loader */
#define CMDLINE NULL /* Location of root dev name */
cmpa #0
bne not_swapped
- jsr _swapper ; void swapper(ptptr p)
+ ldx U_DATA__U_PTAB
+ ldx P_TAB__P_PAGE_OFFSET+1,x
+ beq not_swapout ; it's dead don't swap it out
+ ldx U_DATA__U_PTAB
+ jsr _swapout ; swapout(pptr)
+not_swapout:
+ lds #$0100 ; FIXME: need to use something else
+ ; when we enable IRQ during this !!
ldx newpp
- lda P_TAB__P_PAGE_OFFSET+1,x
-
+ jsr _swapper ; fetch our process
+ ldx newpp
+ lda #1
+ sta P_TAB__P_PAGE_OFFSET+1,x ; marked paged in
not_swapped:
; we have now new stacks so get new stack pointer before any jsr
lds U_DATA__U_SP
ldx U_DATA__U_PTAB
jsr _swapout
- cmpd #0
+ ; now the copy operation is complete we can get rid of the stuff
+ ; _switchin will be expecting from our copy of the stack.
+ cmpx #0
bne forked_up
+ puls x
; We are now in the kernel child context
- ; now the copy operation is complete we can get rid of the stuff
- ; _switchin will be expecting from our copy of the stack.
- puls x
ldx fork_proc_ptr
jsr _newproc
; to be the live uarea. The parent is frozen in time and space as
; if it had done a switchout().
puls y,u,pc
-
-forked_up: ; d is already -1
+forked_up:
+ puls x
+ ldx #0
puls y,u,pc
- rts
\ No newline at end of file
+