Skip to content

Commit

Permalink
translate _convert_subbx_to_eax
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 25, 2013
1 parent 2fc505a commit cbb5377
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 49 deletions.
11 changes: 11 additions & 0 deletions alloc/alloc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ endif
externdef _get_4k_segment:proc
externdef _release_4k_segment:proc
externdef _release_block:proc
externdef _convert_subbx_to_eax:proc

EXTERNDEF OOM_ERR:ABS,SEG_ALREADY_RELEASED_ERR:ABS

Expand Down Expand Up @@ -82,6 +83,16 @@ RELEASE_IO_SEGMENT EQU (RELEASE_SEGMENT)
; jmp _oom_error

CONVERT_SUBBX_TO_EAX PROC
push ECX
push EDX

push EBX
call _convert_subbx_to_eax
add ESP,4

pop EDX
pop ECX
ret
;
; MOV EAX,[ESP]
MOV EAX,[EBX]
Expand Down
11 changes: 11 additions & 0 deletions alloc/allocc.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,14 @@ void _release_io_block(void *EAX)
}


void *_convert_subbx_to_eax(void **EBX)
{
void *p = *EBX;
if (!p)
{
p = _get_new_phys_blk();
*EBX = p;
memset(p, 0, PAGE_SIZE);
}
return p;
}
1 change: 1 addition & 0 deletions common/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void _release_segment(void *);
void *_get_new_phys_blk();
void *_get_new_log_blk();
void *_get_new_io_log_blk();
void *_convert_subbx_to_eax(void **);

// alloc.allopool
void _ap_fix(unsigned EAX, ALLOCS_STRUCT *EBX, unsigned ECX);
Expand Down
10 changes: 8 additions & 2 deletions common/lnkdat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1433,9 +1433,15 @@ if fg_cv
CV_TEMP_RECORD DB CV_TEMP_SIZE DUP(?)
CV_HEADER_LOC DD ?
CV_INDEX_BLK_PTR DD ?
*/

void **CV_INDEX_BLK_PTR;

/*
CV_INDEX_BLK DD ?
CV_INDEX_PTR DD ?
*/
void *CV_INDEX_PTR;
/*
CV_INDEX_COUNT DD ?
CV_INDEX_TEMP DB 12 DUP(?)
Expand Down
3 changes: 3 additions & 0 deletions cv/cvindex.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
.CODE PASS2_TEXT

externdef _handle_cv_index:proc
externdef _cv_index_another_block:proc

EXTERNDEF RELEASE_BLOCK:PROC,_xdebug_normal:proc,CONVERT_SUBBX_TO_EAX:PROC,GET_NEW_LOG_BLK:PROC,ERR_RET:PROC

Expand Down Expand Up @@ -172,6 +173,8 @@ WRITE_CV_INDEX ENDP


CV_INDEX_ANOTHER_BLOCK PROC
jmp _cv_index_another_block

;
;
;
Expand Down
74 changes: 27 additions & 47 deletions cv/cvindexc.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

#include "all.h"

unsigned CV_INDEX_PTR_LIMIT = 0;
unsigned CV_INDEX_BLOCK_END = 0;
void *CV_INDEX_PTR_LIMIT = 0;
void *CV_INDEX_BLOCK_END = 0;
extern unsigned CV_INDEX_SIZE;

void _write_cv_index(unsigned, unsigned);

Expand Down Expand Up @@ -121,34 +122,28 @@ L2$:
RET
WRITE_CV_INDEX ENDP
*/


CV_INDEX_ANOTHER_BLOCK PROC
;
;
;
MOV EDX,CV_INDEX_BLK_PTR
CALL GET_NEW_LOG_BLK ;LEAVE IN FASTER MEMORY
MOV [EDX],EAX
ADD EDX,4
MOV EDI,EAX
ADD EAX,PAGE_SIZE
MOV CV_INDEX_BLK_PTR,EDX
MOV CV_INDEX_BLOCK_END,EAX
SUB EAX,CV_INDEX_SIZE
MOV CV_INDEX_PTR,EDI
void _cv_index_another_block()
{
void **EDX = CV_INDEX_BLK_PTR;
void *EAX = _get_new_log_blk(); // LEAVE IN FASTER MEMORY

MOV CV_INDEX_PTR_LIMIT,EAX
*EDX = EAX;
++EDX;

RET
void *EDI = EAX;
EAX = (void *)((char *)EAX + PAGE_SIZE);

CV_INDEX_ANOTHER_BLOCK ENDP
CV_INDEX_BLK_PTR = EDX;
CV_INDEX_BLOCK_END = EAX;

CV_INDEX_PTR = EDI;
CV_INDEX_PTR_LIMIT = (void *)((char *)EAX - CV_INDEX_SIZE);
}

/*
FLUSH_CV_INDEXES PROC
;
;WRITE OUT BUFFERED INDEX ENTRIES
Expand Down Expand Up @@ -251,31 +246,16 @@ L5$:
FLUSH_CV_INDEXES ENDP
WRITE_INDEX_BLOCK PROC NEAR
;
;BX POINTS TO BLOCK
;CX IS BLOCK SIZE, WRITE IT OUT
;
CALL CONVERT_SUBBX_TO_EAX
push ECX
push EAX
call _xdebug_normal
add ESP,8
XOR ECX,ECX
MOV EAX,[EBX]
MOV [EBX],ECX
JMP RELEASE_BLOCK
WRITE_INDEX_BLOCK ENDP
.DATA?
void _write_index_block(void **EBX, unsigned ECX)
{
// EBX POINTS TO BLOCK
// ECX IS BLOCK SIZE, WRITE IT OUT
_xdebug_normal(_convert_subbx_to_eax(EBX), ECX);
END
void *EAX = *EBX;
*EBX = 0;
_release_block(EAX);
}
*/

0 comments on commit cbb5377

Please sign in to comment.