mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-26 16:33:45 +01:00 
			
		
		
		
	+ implemented set_jmp and long_jmp on win16 via the Catch and Throw winapi
functions, which provide the same functionality, but are safe to use in all windows modes (e.g. they include the magic for handling jumps to discarded or moved code segments in real mode) git-svn-id: trunk@31579 -
This commit is contained in:
		
							parent
							
								
									600d2cfbc6
								
							
						
					
					
						commit
						024ebb287e
					
				| @ -13,6 +13,28 @@ | |||||||
| 
 | 
 | ||||||
|  **********************************************************************} |  **********************************************************************} | ||||||
| 
 | 
 | ||||||
|  | {$ifdef WIN16} | ||||||
|  | 
 | ||||||
|  | Function fpc_SetJmp (Var S : Jmp_buf) : smallint;[Public, alias : 'FPC_SETJMP']; compilerproc; | ||||||
|  | begin | ||||||
|  | {$ifdef FPC_X86_DATA_NEAR} | ||||||
|  |   fpc_SetJmp:=Catch(Ptr(DSeg,Word(@CATCHBUF(S.catch_buf)))); | ||||||
|  | {$else FPC_X86_DATA_NEAR} | ||||||
|  |   fpc_SetJmp:=Catch(@CATCHBUF(S.catch_buf)); | ||||||
|  | {$endif FPC_X86_DATA_NEAR} | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | Procedure fpc_longJmp (Var S : Jmp_buf; value : smallint);[Public, alias : 'FPC_LONGJMP']; compilerproc; | ||||||
|  | begin | ||||||
|  | {$ifdef FPC_X86_DATA_NEAR} | ||||||
|  |   Throw(Ptr(DSeg,Word(@CATCHBUF(S.catch_buf))),value); | ||||||
|  | {$else FPC_X86_DATA_NEAR} | ||||||
|  |   Throw(@CATCHBUF(S.catch_buf),value); | ||||||
|  | {$endif FPC_X86_DATA_NEAR} | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | {$else WIN16} | ||||||
|  | 
 | ||||||
| Function fpc_SetJmp (Var S : Jmp_buf) : smallint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP']; compilerproc; | Function fpc_SetJmp (Var S : Jmp_buf) : smallint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP']; compilerproc; | ||||||
| asm | asm | ||||||
|   mov si, sp |   mov si, sp | ||||||
| @ -80,3 +102,5 @@ asm | |||||||
|   {$endif FPC_X86_CODE_NEAR} |   {$endif FPC_X86_CODE_NEAR} | ||||||
| {$endif FPC_X86_DATA_NEAR} | {$endif FPC_X86_DATA_NEAR} | ||||||
| end; | end; | ||||||
|  | 
 | ||||||
|  | {$endif WIN16} | ||||||
|  | |||||||
| @ -15,12 +15,16 @@ | |||||||
| 
 | 
 | ||||||
| Type | Type | ||||||
|   jmp_buf = packed record |   jmp_buf = packed record | ||||||
|  | {$ifdef WIN16} | ||||||
|  |     catch_buf: array [0..8] of SmallInt; | ||||||
|  | {$else WIN16} | ||||||
| //    bx,si,di: Word;
 | //    bx,si,di: Word;
 | ||||||
|     bp,sp: Word; |     bp,sp: Word; | ||||||
|     ip: Word; |     ip: Word; | ||||||
| {$ifdef FPC_X86_CODE_FAR} |   {$ifdef FPC_X86_CODE_FAR} | ||||||
|     cs: Word; |     cs: Word; | ||||||
| {$endif FPC_X86_CODE_FAR} |   {$endif FPC_X86_CODE_FAR} | ||||||
|  | {$endif WIN16} | ||||||
|   end; |   end; | ||||||
|   PJmp_buf = ^jmp_buf; |   PJmp_buf = ^jmp_buf; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 nickysn
						nickysn