mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: add dummy section for stage3 heap and stack
The firmware needs to know which memory locations are used by the stage 3 loader so that it can allocate its own memory. To indicate the usage of the heap and stack area of the stage 3 loader add a dummy component to block this memory area for the firmware. Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
75d4317f20
commit
dc2e439550
@@ -32,6 +32,11 @@
|
||||
#define MAXIMUM_PARMLINE_SIZE 0x380
|
||||
#define MAXIMUM_PHYSICAL_BLOCKSIZE 0x1000
|
||||
|
||||
#define STAGE3_HEAP_SIZE 0x4000
|
||||
#define STAGE3_HEAP_ADDRESS 0x2000
|
||||
#define STAGE3_STACK_SIZE 0x1000
|
||||
#define STAGE3_STACK_ADDRESS 0xF000
|
||||
|
||||
#define PSW_ADDRESS_MASK 0x000000007fffffffLL
|
||||
#define PSW_LOAD 0x0008000080000000LL
|
||||
#define PSW_DISABLED_WAIT 0x000a000000000000LL
|
||||
|
||||
@@ -391,6 +391,30 @@ add_component_buffer(int fd, void* buffer, size_t size, component_data data,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
add_dummy_buffer(int fd, size_t size, address_t addr, void *component,
|
||||
struct disk_info *info, struct component_loc *comp_loc)
|
||||
{
|
||||
char *buffer;
|
||||
int rc;
|
||||
|
||||
buffer = misc_malloc(size);
|
||||
if (buffer == NULL)
|
||||
return -1;
|
||||
|
||||
memset(buffer, 0, size);
|
||||
rc = add_component_buffer(fd, buffer, size,
|
||||
(component_data) (uint64_t) addr,
|
||||
component, info, comp_loc, component_load);
|
||||
if (rc) {
|
||||
free(buffer);
|
||||
return rc;
|
||||
}
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_components(const char *name[], struct component_loc *loc, int num)
|
||||
{
|
||||
@@ -520,8 +544,36 @@ add_ipl_program(int fd, struct job_ipl_data* ipl, disk_blockptr_t* program,
|
||||
}
|
||||
}
|
||||
ramdisk_size = stats.st_size;
|
||||
if (info->type == disk_type_scsi)
|
||||
if (info->type == disk_type_scsi) {
|
||||
flags |= STAGE3_FLAG_SCSI;
|
||||
/*
|
||||
* Add dummy components for stage 3 heap and stack to block the
|
||||
* associated memory areas against firmware use.
|
||||
*/
|
||||
rc = add_dummy_buffer(fd, STAGE3_HEAP_SIZE, STAGE3_HEAP_ADDRESS,
|
||||
VOID_ADD(table, offset), info,
|
||||
&comp_loc[comp_nr]);
|
||||
if (rc) {
|
||||
error_text("Could not add stage3 HEAP dummy");
|
||||
free(table);
|
||||
return rc;
|
||||
}
|
||||
comp_name[comp_nr] = "heap area";
|
||||
offset += sizeof(struct component_entry);
|
||||
comp_nr++;
|
||||
rc = add_dummy_buffer(fd, STAGE3_STACK_SIZE,
|
||||
STAGE3_STACK_ADDRESS,
|
||||
VOID_ADD(table, offset), info,
|
||||
&comp_loc[comp_nr]);
|
||||
if (rc) {
|
||||
error_text("Could not add stage3 STACK dummy");
|
||||
free(table);
|
||||
return rc;
|
||||
}
|
||||
comp_name[comp_nr] = "stack area";
|
||||
offset += sizeof(struct component_entry);
|
||||
comp_nr++;
|
||||
}
|
||||
if (ipl->is_kdump)
|
||||
flags |= STAGE3_FLAG_KDUMP;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user